From 635aba05c368fa982d2565698eb7f9f1df77714d Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 May 2022 03:21:32 +0100 Subject: working better in term mode --- completion.org | 7 +++- init.org | 94 +++++++++++++++++++++++++++++++++++++++++++++-------- lib/eos/jao-afio.el | 6 ++-- 3 files changed, 89 insertions(+), 18 deletions(-) diff --git a/completion.org b/completion.org index c1fd686..7285bf5 100644 --- a/completion.org +++ b/completion.org @@ -380,10 +380,14 @@ (window-height . fit-window-to-buffer))) :bind (("C-;" . embark-act) + ("C-c ;" . embark-act) ("C-'" . embark-dwim) + ("C-c '" . embark-dwim) (:map minibuffer-local-map (("C-'" . embark-dwim) + ("C-c '" . embark-dwim) ("C-," . embark-become) + ("C-c ," . embark-become) ("C-o" . embark-export))))) (use-package embark-consult @@ -561,7 +565,8 @@ (embark-act))) (add-to-list 'avy-dispatch-alist '(?\; . avy-embark-act)) - :bind (("s-j" . avy-goto-char-timer))) + :bind (("s-j" . avy-goto-char-timer) + ("C-M-j" . avy-goto-char-timer))) (use-package link-hint :ensure t diff --git a/init.org b/init.org index f11ed70..a6fae4a 100644 --- a/init.org +++ b/init.org @@ -121,7 +121,7 @@ *** Server #+begin_src emacs-lisp (setenv "EDITOR" "emacsclient") - (when (and window-system (not (daemonp))) (server-start)) + ;; (unless (daemonp) (server-start)) #+end_src * System utilities *** Tramp @@ -383,7 +383,7 @@ (defvar jao-theme-dark 'jao-dark) (defvar jao-theme-light 'jao-light) (defvar jao-theme-term-dark 'modus-vivendi) - (defvar jao-theme-term-light 'modus-operandi) + (defvar jao-theme-term-light 'jao-light) (defun jao-themes-setup () (let* ((dark (jao-colors-scheme-dark-p)) @@ -469,9 +469,6 @@ #+end_src *** exwm - To start emacs in an exwm session we use the flag - ~-f jao-exwm-enable~, which calls the function below enabling it. - This function, in turn, loads exwm's configuration from [[./exwm.org][exwm.org]]. #+begin_src emacs-lisp (defvar jao-exwm-enabled nil) (defun jao-exwm-enabled-p () jao-exwm-enabled) @@ -555,6 +552,12 @@ (add-hook 'after-init-hook #'jao-sway-enable)) #+end_src +*** detect ws + #+begin_src emacs-lisp + (defvar jao-window-system + (or jao-exwm-enabled jao-xmonad-enabled jao-sway-enabled)) + (defun jao-window-system-p () jao-window-system) + #+end_src *** wallpaper #+begin_src emacs-lisp (defvar jao-wallpaper-dir "~/.wallpapers/") @@ -629,6 +632,20 @@ ("poof" "power-off" jao-poweroff)]) #+end_src +*** mouse + #+begin_src emacs-lisp + (dolist (k '([mouse-4] + [down-mouse-4] + [drag-mouse-4] + [double-mouse-4] + [triple-mouse-4] + [mouse-5] + [down-mouse-5] + [drag-mouse-5] + [double-mouse-5] + [triple-mouse-5])) + (global-unset-key k)) + #+end_src *** X clipboard #+BEGIN_SRC emacs-lisp (setq select-enable-clipboard t @@ -752,6 +769,7 @@ (when (and window-system (not jao-modeline-in-minibuffer)) (add-to-list 'after-make-frame-functions #'jao-mode-line-hide-inactive) (add-hook 'after-init-hook #'jao-toggle-inactive-mode-line)) + :demand t :bind (("" . jao-mode-line-toggle-inactive) ("" . jao-mode-line-toggle) ("" . jao-mode-line-echo))) @@ -1011,7 +1029,8 @@ (use-package goto-chg :ensure t :bind (("C-." . goto-last-change) - ("C-," . goto-last-change-reverse))) + ("C-c ." . goto-last-change) + ("C-c ," . goto-last-change-reverse))) #+end_src *** Eval-and-replace #+BEGIN_SRC emacs-lisp @@ -1227,6 +1246,7 @@ (global-set-key (kbd "C-x p") #'jao-prev-window) (global-set-key (kbd "s-a") #'jao-first-window) + (global-set-key (kbd "M-a") #'jao-first-window) #+end_src *** ace window @@ -1255,11 +1275,56 @@ (alist-get ?u aw-dispatch-alist)) - :bind (("s-o" . ace-window) - ("s-O" . ace-swap-window) + :bind (("M-o" . ace-window) + ("M-O" . ace-swap-window) ("C-x 4 t" . ace-swap-window))) #+end_src +*** window navigation (custom) + #+begin_src emacs-lisp + (defun jao-nth-window (n) + (if (zerop n) + 'jao-first-window + `(lambda () + (interactive) + (select-window (frame-first-window)) + (dotimes (x ,n) (other-window 1))))) + + (defun jao-prev-window () + "Go to previous window" + (interactive) + (other-window -1)) + + (defun jao-next-window () + "Go to previous window" + (interactive) + ;; next-window-any-frame + (other-window 1)) + + (global-set-key (kbd "C-x p") 'jao-prev-window) + (global-set-key (kbd "C-x o") 'other-window) + (mapc (lambda (n) + (global-set-key (format "\C-c%s" (1+ n)) (jao-nth-window n))) + '(0 1 2 3 4 5 6 7 8)) + + ;; transposing windows + (defun transpose-windows (arg) + "Transpose the buffers shown in two windows." + (interactive "p") + (let ((selector (if (>= arg 0) 'next-window 'previous-window))) + (while (/= arg 0) + (let ((this-win (window-buffer)) + (next-win (window-buffer (funcall selector)))) + (set-window-buffer (selected-window) next-win) + (set-window-buffer (funcall selector) this-win) + (select-window (funcall selector))) + (setq arg (if (plusp arg) (1- arg) (1+ arg)))))) + + (define-key ctl-x-4-map (kbd "t") 'transpose-windows) + #+end_src + + #+RESULTS: + : transpose-windows *** winner mode #+begin_src emacs-lisp (winner-mode 1) @@ -1335,9 +1400,10 @@ (jao-minibuffer-add-variable '(jao-current--frame-id) 100) (defun jao-afio--set-mode-line () - (if (string= "Docs" (jao-afio-current-frame)) - (jao-mode-line-show-inactive nil) - (jao-mode-line-hide-inactive nil))) + (when (and window-system (fboundp 'jao-mode-line-hide-inactive)) + (if (string= "Docs" (jao-afio-current-frame)) + (jao-mode-line-show-inactive nil) + (jao-mode-line-hide-inactive nil)))) (unless jao-modeline-in-minibuffer (add-hook 'jao-afio-switch-hook #'jao-afio--set-mode-line)) @@ -3392,7 +3458,7 @@ ("n" "capture note" jao-org-notes-open-or-create) ("/" "search notes" jao-org-notes-open) ("\\" "grep notes" jao-org-notes-grep)] - ["Documents" :if window-system + ["Documents" :if jao-window-system-p ("d" "go to doc" jao-select-pdf) ("D" "open to doc" jao-open-doc)] ["Packages" @@ -3412,7 +3478,7 @@ ("s" "slack" jao-chats-slack) ("i" "irc" jao-chats-irc) ("T" "telegram rooster" telega)] - ["Window system" :if window-system + ["Window system" :if jao-window-system-p ("w" "set wallpaper" jao-set-wallpaper) ("W" "set radom wallpaper" jao-set-random-wallpaper) ("x" "restart xmobar" jao-xmobar-restart :if jao-exwm-enabled-p) @@ -3420,7 +3486,7 @@ ["Helpers" ("r" "org reveal" org-reveal) ("k" (lambda () (concat "keyboard" (when (jao-kb-toggled-p) "*"))) - jao-kb-toggle :if window-system) + jao-kb-toggle :if jao-window-system-p) ("M" (lambda () (concat "minibuffer" (when jao-minibuffer-mode "*"))) jao-minibuffer-mode)]]) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 2a4efbb..306a1d5 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -56,9 +56,9 @@ (defun jao-afio--check-frame () (unless (jao-afio--check-frame-p) - (or (when jao-afio-fallback-fun - (funcall jao-afio-fallback-fun) - t) + (or ;; (when jao-afio-fallback-fun + ;; (funcall jao-afio-fallback-fun) + ;; t) (when (y-or-n-p "Another frame is using afio. Steal? ") (jao-afio--steal) t) -- cgit v1.2.3