diff options
Diffstat (limited to '.emacs.d/jd/jd-exwm.el')
| -rwxr-xr-x | .emacs.d/jd/jd-exwm.el | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/.emacs.d/jd/jd-exwm.el b/.emacs.d/jd/jd-exwm.el index f083c44..98b5e89 100755 --- a/.emacs.d/jd/jd-exwm.el +++ b/.emacs.d/jd/jd-exwm.el | |||
| @@ -4,132 +4,132 @@ | |||
| 4 | ;;; Code: | 4 | ;;; Code: |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | (jd/use-package perspective "emacs-perspective") | 7 | (use-package! perspective "emacs-perspective") |
| 8 | 8 | ||
| 9 | (jd/use-package exwm "emacs-exwm" | 9 | (use-package! exwm "emacs-exwm" |
| 10 | :config | 10 | :config |
| 11 | (defun jd/exwm-update-class () | 11 | (defun jd/exwm-update-class () |
| 12 | (exwm-workspace-rename-buffer exwm-class-name)) | 12 | (exwm-workspace-rename-buffer exwm-class-name)) |
| 13 | 13 | ||
| 14 | (defun jd-exwm/run-in-background (command) | 14 | (defun jd-exwm/run-in-background (command) |
| 15 | (let ((command-parts (split-string command "[ ]+"))) | 15 | (let ((command-parts (split-string command "[ ]+"))) |
| 16 | (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) | 16 | (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) |
| 17 | 17 | ||
| 18 | (defun jd-exwm/restart-process (program-name) | 18 | (defun jd-exwm/restart-process (program-name) |
| 19 | (call-process "killall" nil nil nil program-name) | 19 | (call-process "killall" nil nil nil program-name) |
| 20 | (jd-exwm/run-in-background program-name)) | 20 | (jd-exwm/run-in-background program-name)) |
| 21 | 21 | ||
| 22 | (defun jd-exwm/exwm-init-hook () | 22 | (defun jd-exwm/exwm-init-hook () |
| 23 | (jd-exwm/run-in-background "nitrogen --restore") | 23 | (jd-exwm/run-in-background "nitrogen --restore") |
| 24 | (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1") | 24 | (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1") |
| 25 | (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d") | 25 | (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d") |
| 26 | 26 | ||
| 27 | (jd-exwm/restart-process "polybar") | 27 | (jd-exwm/restart-process "polybar") |
| 28 | (jd-exwm/restart-process "nm-applet") | 28 | (jd-exwm/restart-process "nm-applet") |
| 29 | (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6") | 29 | (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6") |
| 30 | (jd-exwm/restart-process "blueman-applet")) | 30 | (jd-exwm/restart-process "blueman-applet")) |
| 31 | 31 | ||
| 32 | (defun jd-exwm/exwm-update-title () | 32 | (defun jd-exwm/exwm-update-title () |
| 33 | (exwm-workspace-rename-buffer exwm-title)) | 33 | (exwm-workspace-rename-buffer exwm-title)) |
| 34 | 34 | ||
| 35 | (defun jd-exwm/configure-window-by-class () | 35 | (defun jd-exwm/configure-window-by-class () |
| 36 | (interactive) | 36 | (interactive) |
| 37 | (pcase exwm-class-name | 37 | (pcase exwm-class-name |
| 38 | ("firefox" (exwm-workspace-move-window 2)) | 38 | ("firefox" (exwm-workspace-move-window 2)) |
| 39 | ("Brave" (exwm-workspace-move-window 2)) | 39 | ("Brave" (exwm-workspace-move-window 2)) |
| 40 | ("qutebrowser" (exwm-workspace-move-window 2)) | 40 | ("qutebrowser" (exwm-workspace-move-window 2)) |
| 41 | ("discord" (exwm-workspace-move-window 5)) | 41 | ("discord" (exwm-workspace-move-window 5)) |
| 42 | ("obs" (exwm-workspace-move-window 5)) | 42 | ("obs" (exwm-workspace-move-window 5)) |
| 43 | ("Virt-manager" (exwm-workspace-move-window 4)))) | 43 | ("Virt-manager" (exwm-workspace-move-window 4)))) |
| 44 | 44 | ||
| 45 | (setq exwm-workspace-number 10) | 45 | (setq exwm-workspace-number 10) |
| 46 | 46 | ||
| 47 | ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook) | 47 | ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook) |
| 48 | (add-hook 'exwm-update-class-hook #'jd/exwm-update-class) | 48 | (add-hook 'exwm-update-class-hook #'jd/exwm-update-class) |
| 49 | (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title) | 49 | (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title) |
| 50 | (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class) | 50 | (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class) |
| 51 | 51 | ||
| 52 | (require 'exwm-randr) | 52 | (require 'exwm-randr) |
| 53 | (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) | 53 | (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) |
| 54 | (exwm-randr-enable) | 54 | (exwm-randr-enable) |
| 55 | 55 | ||
| 56 | (setq exwm-input-simulation-keys | 56 | (setq exwm-input-simulation-keys |
| 57 | '(([?\C-b] . [left]) | 57 | '(([?\C-b] . [left]) |
| 58 | ([?\C-f] . [right]) | 58 | ([?\C-f] . [right]) |
| 59 | ([?\C-p] . [up]) | 59 | ([?\C-p] . [up]) |
| 60 | ([?\C-n] . [down]) | 60 | ([?\C-n] . [down]) |
| 61 | ([?\C-a] . [home]) | 61 | ([?\C-a] . [home]) |
| 62 | ([?\C-e] . [end]) | 62 | ([?\C-e] . [end]) |
| 63 | ([?\C-k] . [S-end delete]) | 63 | ([?\C-k] . [S-end delete]) |
| 64 | ([?\M-w] . [C-c]) | 64 | ([?\M-w] . [C-c]) |
| 65 | ([?\C-y] . [C-v]) | 65 | ([?\C-y] . [C-v]) |
| 66 | ([?\C-v] . [next]) | 66 | ([?\C-v] . [next]) |
| 67 | ([?\M-v] . [prior]) | 67 | ([?\M-v] . [prior]) |
| 68 | )) | 68 | )) |
| 69 | 69 | ||
| 70 | (setq exwm-input-prefix-keys | 70 | (setq exwm-input-prefix-keys |
| 71 | '(?\C-x | 71 | '(?\C-x |
| 72 | ?\C-u | 72 | ?\C-u |
| 73 | ?\C-h | 73 | ?\C-h |
| 74 | ?\M-x | 74 | ?\M-x |
| 75 | ?\M-` | 75 | ?\M-` |
| 76 | ?\M-& | 76 | ?\M-& |
| 77 | ?\M-! | 77 | ?\M-! |
| 78 | ?\C-g | 78 | ?\C-g |
| 79 | ?\M-: | 79 | ?\M-: |
| 80 | ?\C-\M-j | 80 | ?\C-\M-j |
| 81 | ?\C-\ )) | 81 | ?\C-\ )) |
| 82 | 82 | ||
| 83 | (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) | 83 | (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) |
| 84 | (exwm-input-set-key (kbd "s-p") 'counsel-linux-app) | 84 | (exwm-input-set-key (kbd "s-p") 'counsel-linux-app) |
| 85 | 85 | ||
| 86 | (setq exwm-input-global-keys | 86 | (setq exwm-input-global-keys |
| 87 | `(([?\s-R] . exwm-reset) | 87 | `(([?\s-R] . exwm-reset) |
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | ([?\s-r] . (lambda (command) | 90 | ([?\s-r] . (lambda (command) |
| 91 | (interactive (list (read-shell-command "$ "))) | 91 | (interactive (list (read-shell-command "$ "))) |
| 92 | (start-process-shell-command command nil command))) | 92 | (start-process-shell-command command nil command))) |
| 93 | 93 | ||
| 94 | ([?\s-W] . exwm-workspace-move-window) | 94 | ([?\s-W] . exwm-workspace-move-window) |
| 95 | ([?\s-w] . exwm-workspace-switch) | 95 | ([?\s-w] . exwm-workspace-switch) |
| 96 | 96 | ||
| 97 | ,@(mapcar (lambda (i) | 97 | ,@(mapcar (lambda (i) |
| 98 | `(,(kbd (format "s-%d" i)) . | 98 | `(,(kbd (format "s-%d" i)) . |
| 99 | (lambda () | 99 | (lambda () |
| 100 | (interactive) | 100 | (interactive) |
| 101 | (exwm-workspace-switch-create ,i)))) | 101 | (exwm-workspace-switch-create ,i)))) |
| 102 | (number-sequence 0 9)))) | 102 | (number-sequence 0 9)))) |
| 103 | 103 | ||
| 104 | (exwm-enable) | 104 | (exwm-enable) |
| 105 | (require 'exwm-systemtray) | 105 | (require 'exwm-systemtray) |
| 106 | (exwm-systemtray-enable)) | 106 | (exwm-systemtray-enable)) |
| 107 | 107 | ||
| 108 | (jd/use-package desktop-environment "emacs-desktop-environment" | 108 | (use-package! desktop-environment "emacs-desktop-environment" |
| 109 | :after exwm | 109 | :after exwm |
| 110 | :custom | 110 | :custom |
| 111 | (desktop-environment-brightness-small-increment "2%+") | 111 | (desktop-environment-brightness-small-increment "2%+") |
| 112 | (desktop-environment-brightness-small-decrement "2%-") | 112 | (desktop-environment-brightness-small-decrement "2%-") |
| 113 | (desktop-environment-brightness-normal-increment "5%+") | 113 | (desktop-environment-brightness-normal-increment "5%+") |
| 114 | (desktop-environment-brightness-normal-decrement "5%-") | 114 | (desktop-environment-brightness-normal-decrement "5%-") |
| 115 | 115 | ||
| 116 | :config | 116 | :config |
| 117 | (defun jd/dunst-show-history () | 117 | (defun jd/dunst-show-history () |
| 118 | (interactive) | 118 | (interactive) |
| 119 | (start-process-shell-command "dunstctl" nil "dunstctl history-pop")) | 119 | (start-process-shell-command "dunstctl" nil "dunstctl history-pop")) |
| 120 | (global-set-key (kbd "C-c N h") #'jd/dunst-show-history) | 120 | (global-set-key (kbd "C-c N h") #'jd/dunst-show-history) |
| 121 | 121 | ||
| 122 | (defun jd/dunst-close () | 122 | (defun jd/dunst-close () |
| 123 | (interactive) | 123 | (interactive) |
| 124 | (start-process-shell-command "dunstctl" nil "dunstctl close")) | 124 | (start-process-shell-command "dunstctl" nil "dunstctl close")) |
| 125 | (global-set-key (kbd "C-c N c") #'jd/dunst-close) | 125 | (global-set-key (kbd "C-c N c") #'jd/dunst-close) |
| 126 | 126 | ||
| 127 | (defun jd/dunst-close-all () | 127 | (defun jd/dunst-close-all () |
| 128 | (interactive) | 128 | (interactive) |
| 129 | (start-process-shell-command "dunstctl" nil "dunstctl close-all")) | 129 | (start-process-shell-command "dunstctl" nil "dunstctl close-all")) |
| 130 | (global-set-key (kbd "C-c N a") #'jd/dunst-close-all) | 130 | (global-set-key (kbd "C-c N a") #'jd/dunst-close-all) |
| 131 | 131 | ||
| 132 | (desktop-environment-mode)) | 132 | (desktop-environment-mode)) |
| 133 | 133 | ||
| 134 | ;; (set-frame-parameter (selected-frame) 'alpha '(90 . 90)) | 134 | ;; (set-frame-parameter (selected-frame) 'alpha '(90 . 90)) |
| 135 | ;; (add-to-list 'default-frame-alist `(alpha . (90 . 90))) | 135 | ;; (add-to-list 'default-frame-alist `(alpha . (90 . 90))) |
