about summary refs log tree commit diff stats
path: root/exwm
diff options
context:
space:
mode:
Diffstat (limited to 'exwm')
-rw-r--r--exwm43
1 files changed, 26 insertions, 17 deletions
diff --git a/exwm b/exwm index 0b52846..08d410f 100644 --- a/exwm +++ b/exwm
@@ -15,6 +15,17 @@
15 (start-process-shell-command 15 (start-process-shell-command
16 (format "<autostart> %s" command) " *autostart*" command)) 16 (format "<autostart> %s" command) " *autostart*" command))
17 17
18(defun run-or-raise (command &optional buffer-name)
19 "Raise BUFFER-NAME if it exists, else run COMMAND.
20BUFFER-NAME defaults to the first word of COMMAND."
21 (let ((buffer-name (or buffer-name (car (string-split command)))))
22 (if (buffer-live-p (get-buffer buffer-name))
23 (switch-to-buffer buffer-name)
24 (exwm-spawn command))))
25
26(defun ^run-or-raise (command)
27 (lambda () (interactive) (run-or-raise command)))
28
18;; Wifi info 29;; Wifi info
19(defun dBm->perc (dBm) 30(defun dBm->perc (dBm)
20 (truncate (+ (- (/ (* dBm dBm) 105.0)) 31 (truncate (+ (- (/ (* dBm dBm) 105.0))
@@ -84,6 +95,11 @@
84(setopt display-time-format "%e %a %R") 95(setopt display-time-format "%e %a %R")
85(setopt battery-mode-line-format "[🔋%b%p%]") 96(setopt battery-mode-line-format "[🔋%b%p%]")
86 97
98(display-wifi-info-mode)
99(display-battery-mode)
100(display-time-mode)
101
102;; Must come after the above
87(setopt global-mode-string 103(setopt global-mode-string
88 '("" jabber-activity-mode-string 104 '("" jabber-activity-mode-string
89 display-wifi-info-string 105 display-wifi-info-string
@@ -91,10 +107,6 @@
91 " " (:propertize ("" display-time-string) 107 " " (:propertize ("" display-time-string)
92 face tab-bar-tab))) 108 face tab-bar-tab)))
93 109
94(display-wifi-info-mode)
95(display-battery-mode)
96(display-time-mode)
97
98;;; Window management 110;;; Window management
99 111
100(after exwm-update-class-hook 112(after exwm-update-class-hook
@@ -104,21 +116,15 @@
104 116
105(setopt exwm-input-global-keys 117(setopt exwm-input-global-keys
106 `(;; Command shortcuts 118 `(;; Command shortcuts
107 ([?\s-p] . ,(^exwm-spawn "keepassxc")) 119 ([?\s-p] . ,(^run-or-raise "keepassxc"))
108 ([?\s-b] . ,(^exwm-spawn "firefox --new-tab")) 120 ([?\s-b] . ,(^run-or-raise "firefox"))
109 ;; 's-r': Reset (to line-mode). 121 ;; 's-r': Reset (to line-mode).
110 ([?\s-r] . exwm-reset) 122 ([?\s-r] . exwm-reset)
111 ;; 's-w': Switch workspace. 123 ;; 's-w': Bury buffer (I honestly don't really use workspaces)
112 ([?\s-w] . exwm-workspace-switch) 124 ([?\s-w] . bury-buffer)
125 ([?\s-o] . other-window-dwim)
113 ;; 's-&': Launch application. 126 ;; 's-&': Launch application.
114 ([?\s-&] . exwm-spawn) 127 ([?\s-&] . exwm-spawn)))
115 ;; 's-N': Switch to certain workspace.
116 ,@(mapcar (lambda (i)
117 `(,(kbd (format "s-%d" i)) .
118 (lambda ()
119 (interactive)
120 (exwm-workspace-switch-create ,i))))
121 (number-sequence 1 9))))
122 128
123(setopt exwm-input-simulation-keys 129(setopt exwm-input-simulation-keys
124 '(([?\C-b] . [left]) 130 '(([?\C-b] . [left])
@@ -130,7 +136,10 @@
130 ([?\M-v] . [prior]) 136 ([?\M-v] . [prior])
131 ([?\C-v] . [next]) 137 ([?\C-v] . [next])
132 ([?\C-d] . [delete]) 138 ([?\C-d] . [delete])
133 ([?\C-k] . [S-end delete]))) 139 ([?\C-k] . [S-end delete])
140 ([?\M-w] . [?\C-c])
141 ([?\C-w] . [?\C-x])
142 ([?\C-y] . [?\C-v])))
134 143
135;;; Startup 144;;; Startup
136 145