summary refs log tree commit diff
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-07-11 05:58:23 +0000
committernoa@gaiwan.org2024-07-11 05:58:23 +0000
commitffd06dd137b90a64143718428131255da8921e6c (patch)
tree8366d3a9fce1d383b3889abedc6b97e6884e2bf6
parentd2b1378d517e19f071f4a21c88adbfa13c58d9dc (diff)
Add default configuration for exwm
-rw-r--r--config.org52
1 files changed, 52 insertions, 0 deletions
diff --git a/config.org b/config.org
index a67c398..e83c17a 100644
--- a/config.org
+++ b/config.org
@@ -1958,4 +1958,56 @@ Just a few settings i haven't put into another category yet.
 	  ediff-window-setup-function 'ediff-setup-windows-plain)
 #+end_src
 
+* Window management
+#+begin_src elisp
+  (package-ensure 'exwm)
+  (require 'exwm)
+  (require 'exwm-config)
+
+  ;; Set the initial workspace number.
+  (unless (get 'exwm-workspace-number 'saved-value)
+    (setq exwm-workspace-number 4))
+
+  ;; Make class name the buffer name
+  (add-hook 'exwm-update-class-hook
+            (lambda ()
+              (exwm-workspace-rename-buffer exwm-class-name)))
+
+  ;; Global keybindings.
+  (unless (get 'exwm-input-global-keys 'saved-value)
+    (setq exwm-input-global-keys
+          `(
+            ;; 's-r': Reset (to line-mode).
+            ([?\s-r] . exwm-reset)
+            ;; 's-w': Switch workspace.
+            ([?\s-w] . exwm-workspace-switch)
+            ;; 's-&': Launch application.
+            ([?\s-&] . (lambda (command)
+                         (interactive (list (read-shell-command "$ ")))
+                         (start-process-shell-command command nil command)))
+            ;; 's-N': Switch to certain workspace.
+            ,@(mapcar (lambda (i)
+                        `(,(kbd (format "s-%d" i)) .
+                          (lambda ()
+                            (interactive)
+                            (exwm-workspace-switch-create ,i))))
+                      (number-sequence 0 9)))))
+
+  ;; Line-editing shortcuts
+  (unless (get 'exwm-input-simulation-keys 'saved-value)
+    (setq exwm-input-simulation-keys
+          '(([?\C-b] . [left])
+            ([?\C-f] . [right])
+            ([?\C-p] . [up])
+            ([?\C-n] . [down])
+            ([?\C-a] . [home])
+            ([?\C-e] . [end])
+            ([?\M-v] . [prior])
+            ([?\C-v] . [next])
+            ([?\C-d] . [delete])
+            ([?\C-k] . [S-end delete]))))
+
+  ;; Enable EXWM
+  (exwm-enable)
+#+end_src