Skip to content

Latest commit

 

History

History
1596 lines (1200 loc) · 46 KB

Desktop.org

File metadata and controls

1596 lines (1200 loc) · 46 KB
 
Jan 27, 2020
Jan 27, 2020
1
#+TITLE: Desktop Environment
Jan 27, 2020
Jan 27, 2020
2
3
#+PROPERTY: header-args :mkdirp yes
Jan 29, 2020
Jan 29, 2020
4
This file contains configuration for my overall desktop environment. My workflow is driven by Emacs but there are still a number of applications, tools, themes, and fonts that I must install to have a complete desktop experience.
Jan 27, 2020
Jan 27, 2020
6
* Table of Contents
Jan 24, 2020
Jan 24, 2020
7
:PROPERTIES:
Oct 18, 2020
Oct 18, 2020
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
:TOC: :include all :ignore this
:END:
:CONTENTS:
- [[#system-settings][System Settings]]
- [[#fonts-and-themes][Fonts and Themes]]
- [[#window-management][Window Management]]
- [[#helper-functions][Helper Functions]]
- [[#configuration][Configuration]]
- [[#desktop-configuration][Desktop Configuration]]
- [[#window-switcher][Window Switcher]]
- [[#panel][Panel]]
- [[#keybindings][Keybindings]]
- [[#useful-links][Useful Links]]
- [[#panel-via-polybar][Panel via Polybar]]
- [[#desktop-notifications-via-dunst][Desktop Notifications via Dunst]]
- [[#display-management][Display Management]]
- [[#user-services][User Services]]
- [[#scheduled-tasks][Scheduled Tasks]]
- [[#applications][Applications]]
- [[#browsers][Browsers]]
Nov 10, 2020
Nov 10, 2020
28
- [[#qutebrowser][Qutebrowser]]
Oct 18, 2020
Oct 18, 2020
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- [[#vimb][vimb]]
- [[#mail][Mail]]
- [[#password-management][Password Management]]
- [[#syncing-passwords][Syncing Passwords]]
- [[#audio-device-control][Audio Device Control]]
- [[#media-players][Media Players]]
- [[#mpv][mpv]]
- [[#codecs-and-drivers][Codecs and Drivers]]
- [[#image-viewers-and-editors][Image Viewers and Editors]]
- [[#games][Games]]
- [[#document-readers][Document Readers]]
- [[#syncthing][Syncthing]]
- [[#flatpak][Flatpak]]
- [[#printing][Printing]]
- [[#desktop-tools][Desktop Tools]]
- [[#system-tools][System Tools]]
- [[#xorg-tools][Xorg Tools]]
- [[#desktop-profile][Desktop Profile]]
- [[#notes][Notes]]
- [[#bluetooth-setup][Bluetooth Setup]]
Jan 24, 2020
Jan 24, 2020
49
:END:
Jan 28, 2020
Jan 28, 2020
51
52
53
54
* System Settings
Load system-specific settings from =.emacs.d/per-system-settings.el= and unpack relevant values into blocks so that they can be used in configuration file blocks. These settings are configured in [[file:Systems.org::*Per-System Settings][Systems.org]].
Jan 29, 2020
Jan 29, 2020
55
#+NAME: system-settings
Feb 1, 2020
Feb 1, 2020
56
#+begin_src emacs-lisp :session system-settings
Jan 28, 2020
Jan 28, 2020
57
(load-file ".emacs.d/per-system-settings.el")
Feb 1, 2020
Feb 1, 2020
58
#+end_src
Jan 28, 2020
Jan 28, 2020
59
Jan 29, 2020
Jan 29, 2020
60
#+NAME: get-setting
Feb 1, 2020
Feb 1, 2020
61
#+begin_src emacs-lisp :var name="nil" :session system-settings
Jan 29, 2020
Jan 29, 2020
62
(alist-get (intern name) dw/system-settings)
Feb 1, 2020
Feb 1, 2020
63
#+end_src
Jan 29, 2020
Jan 29, 2020
64
Jan 27, 2020
Jan 27, 2020
65
* Fonts and Themes
Jan 27, 2020
Jan 27, 2020
66
Jan 27, 2020
Jan 27, 2020
67
I use [[https://github.com/derat/xsettingsd][xsettingsd]] as a minimal settings daemon for Xorg applications. It replaces similar daemons from desktop environments like GNOME and XFCE and enables me to use a simple configuration file like the following:
Jan 27, 2020
Jan 27, 2020
68
69
70
*.config/xsettingsd/xsettingsd.conf:*
Jan 28, 2020
Jan 28, 2020
71
#+begin_src conf :tangle .config/xsettingsd/xsettingsd.conf :noweb yes
Jan 27, 2020
Jan 27, 2020
72
73
74
75
76
77
78
79
80
81
Net/ThemeName "Matcha-dark-azul"
Net/IconThemeName "Papirus-Dark"
Gtk/DecorationLayout "menu:minimize,maximize,close"
Gtk/FontName "Cantarell 11"
Gtk/MonospaceFontName "Fira Mono 10"
Gtk/CursorThemeName "Adwaita"
Xft/Antialias 1
Xft/Hinting 0
Xft/HintStyle "hintnone"
Jan 28, 2020
Jan 28, 2020
82
Xft/DPI <<dpi()>> # 1024 * DPI
Jan 27, 2020
Jan 27, 2020
83
84
85
#+end_src
Feb 2, 2020
Feb 2, 2020
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
I also have to do an extra step to make sure Emacs can find the font path from the "desktop" profile.
*.config/fontconfig/fonts.conf:*
#+begin_src xml :tangle .config/fontconfig/fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>~/.guix-extra-profiles/desktop/desktop/share/fonts</dir>
<alias>
<family>Apple Color Emoji</family>
<prefer>
<family>Noto Color Emoji</family>
</prefer>
</alias>
</fontconfig>
#+end_src
Jan 28, 2020
Jan 28, 2020
106
107
108
*DPI*
#+NAME: dpi
Feb 1, 2020
Feb 1, 2020
109
#+begin_src emacs-lisp :session=system-settings :var settings=system-settings
Jan 28, 2020
Jan 28, 2020
110
(* 1024 (alist-get 'desktop/dpi dw/system-settings))
Feb 1, 2020
Feb 1, 2020
111
#+end_src
Jan 28, 2020
Jan 28, 2020
112
Jan 28, 2020
Jan 28, 2020
113
114
115
116
117
*Guix Packages*
#+begin_src scheme :noweb-ref packages :noweb-sep ""
;; Settings Manager
Jan 31, 2020
Jan 31, 2020
118
"xsettingsd"
Jan 28, 2020
Jan 28, 2020
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
;; GTK Themes
"arc-icon-theme"
"matcha-theme"
"hicolor-icon-theme"
"gnome-icon-theme"
"gnome-backgrounds"
"papirus-icon-theme"
;; Fonts
"font-fira-mono"
"font-fira-code"
"font-abattis-cantarell"
"font-dejavu"
"font-google-noto"
"font-gnu-freefont-ttf"
"font-liberation"
"font-awesome"
"font-google-material-design-icons"
"gs-fonts"
#+end_src
Jan 27, 2020
Jan 27, 2020
142
* Window Management
Jan 24, 2020
Jan 24, 2020
143
144
145
146
147
148
149
150
151
152
153
I use Emacs as the desktop window manager thanks to the excellent EXWM. This configuration gets loaded relatively early in Emacs startup if running on a Linux machine.
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
(use-package exwm
:init
(setq mouse-autoselect-window nil
focus-follows-mouse t
exwm-workspace-warp-cursor t
exwm-workspace-number 5)
Feb 7, 2020
Feb 7, 2020
154
;exwm-workspace-display-echo-area-timeout 5
Jan 24, 2020
Jan 24, 2020
155
156
157
158
159
160
161
162
;exwm-workspace-minibuffer-position 'bottom) ;; Annoying focus issues
:config
;; Make class name the buffer name
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
(add-hook 'exwm-update-title-hook
(lambda ()
Nov 10, 2020
Nov 10, 2020
163
164
165
(pcase exwm-class-name
("Vimb" (exwm-workspace-rename-buffer (format "vimb: %s" exwm-title)))
("qutebrowser" (exwm-workspace-rename-buffer (format "Qutebrowser: %s" exwm-title))))))
Jan 24, 2020
Jan 24, 2020
166
167
168
169
170
171
172
173
174
(exwm-enable))
;; Enable exwm-randr before exwm-init gets called
(use-package exwm-randr
:if dw/exwm-enabled
:after (exwm)
:config
(exwm-randr-enable)
Jan 28, 2020
Jan 28, 2020
175
(setq exwm-randr-workspace-monitor-plist '(4 "eDP-1")))
Jan 24, 2020
Jan 24, 2020
177
#+end_src
Jan 27, 2020
Jan 27, 2020
179
** Helper Functions
Jan 24, 2020
Jan 24, 2020
180
181
182
183
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
(defun exwm/run-in-background (command)
Aug 20, 2020
Aug 20, 2020
184
185
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
Jan 24, 2020
Jan 24, 2020
186
187
188
189
190
191
192
(defun exwm/bind-function (key invocation &rest bindings)
"Bind KEYs to FUNCTIONs globally"
(while key
(exwm-input-set-key (kbd key)
`(lambda ()
(interactive)
Aug 20, 2020
Aug 20, 2020
193
(funcall ',invocation)))
Jan 24, 2020
Jan 24, 2020
194
(setq key (pop bindings)
Aug 20, 2020
Aug 20, 2020
195
invocation (pop bindings))))
Jan 24, 2020
Jan 24, 2020
196
197
198
199
200
201
202
203
204
(defun exwm/bind-command (key command &rest bindings)
"Bind KEYs to COMMANDs globally"
(while key
(exwm-input-set-key (kbd key)
`(lambda ()
(interactive)
(exwm/run-in-background ,command)))
(setq key (pop bindings)
Aug 20, 2020
Aug 20, 2020
205
command (pop bindings))))
Jan 24, 2020
Jan 24, 2020
206
Feb 1, 2020
Feb 1, 2020
207
#+end_src
Jan 24, 2020
Jan 24, 2020
208
Jan 27, 2020
Jan 27, 2020
209
** Configuration
Jan 24, 2020
Jan 24, 2020
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
(defun dw/exwm-init-hook ()
;; Launch Telega in workspace 0 if we've logged in before
(when (file-exists-p "~/.telega/db.sqlite")
(telega nil))
;; Make workspace 1 be the one where we land at startup
(exwm-workspace-switch-create 1)
;; Open eshell by default
(eshell)
;; Launch apps that will run in the background
Jan 27, 2020
Jan 27, 2020
225
(exwm/run-in-background "dunst")
Jan 24, 2020
Jan 24, 2020
226
(exwm/run-in-background "nm-applet")
Nov 2, 2020
Nov 2, 2020
227
(exwm/run-in-background "syncthing-gtk --minimized")
Jan 24, 2020
Jan 24, 2020
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
(exwm/run-in-background "redshift -l 47.675510:-122.203362 -t 6500:3500"))
(use-package exwm
:if dw/exwm-enabled
:config
;(display-time-mode 1) ;; Not needed for now since we have a panel
(add-hook 'exwm-mode-hook
(lambda ()
(evil-local-set-key 'motion (kbd "C-u") nil)))
(require 'dw-exwm)
(defun dw/setup-window-by-class ()
(interactive)
(pcase exwm-class-name
("Pidgin" (exwm-workspace-move-window 0))
("Pidgin<2>" (exwm-workspace-move-window 0))
("teams-for-linux" (exwm-workspace-move-window 3))
("Microsoft Teams - Preview" (exwm-workspace-move-window 3))
("Spotify" (exwm-workspace-move-window 4))
("Vimb" (exwm-workspace-move-window 2))
Nov 10, 2020
Nov 10, 2020
250
("qutebrowser" (exwm-workspace-move-window 2))
Jan 24, 2020
Jan 24, 2020
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
("qjackctl" (exwm-floating-toggle-floating))
("mpv" (exwm-floating-toggle-floating)
(dw/exwm-floating-toggle-pinned))))
;; Do some post-init setup
(add-hook 'exwm-init-hook #'dw/exwm-init-hook)
;; Manipulate windows as they're created
(add-hook 'exwm-manage-finish-hook
(lambda ()
;; Send the window where it belongs
(dw/setup-window-by-class)))
;; Hide the modeline on all X windows
;(exwm-layout-hide-mode-line)))
;; Hide the modeline on all X windows
(add-hook 'exwm-floating-setup-hook
(lambda ()
(exwm-layout-hide-mode-line))))
(use-package exwm-systemtray
:disabled
:if dw/exwm-enabled
:after (exwm)
:config
(exwm-systemtray-enable)
(setq exwm-systemtray-height 35))
Feb 1, 2020
Feb 1, 2020
280
#+end_src
Jan 24, 2020
Jan 24, 2020
281
Jan 27, 2020
Jan 27, 2020
282
** Desktop Configuration
Jan 24, 2020
Jan 24, 2020
283
284
285
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
Feb 2, 2020
Feb 2, 2020
286
287
288
289
290
291
(defun dw/run-xmodmap ()
(interactive)
(start-process-shell-command "xmodmap" nil "xmodmap ~/.dotfiles/.config/i3/Xmodmap"))
(defun dw/update-wallpapers ()
(interactive)
Feb 2, 2020
Feb 2, 2020
292
293
294
(start-process-shell-command
"feh" nil
(format "feh --bg-scale ~/.dotfiles/backgrounds/%s" (alist-get 'desktop/background dw/system-settings))))
Feb 2, 2020
Feb 2, 2020
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
(setq dw/panel-process nil)
(defun dw/kill-panel ()
(interactive)
(when dw/panel-process
(ignore-errors
(kill-process dw/panel-process)))
(setq dw/panel-process nil))
(defun dw/start-panel ()
(interactive)
(dw/kill-panel)
(setq dw/panel-process (start-process-shell-command "polybar" nil "polybar panel")))
(defun dw/update-screen-layout ()
(interactive)
(let ((layout-script "~/.bin/update-screens"))
(message "Running screen layout script: %s" layout-script)
(start-process-shell-command "xrandr" nil layout-script)))
(defun dw/configure-desktop ()
(interactive)
(dw/run-xmodmap)
(dw/update-screen-layout)
(run-at-time "2 sec" nil (lambda () (dw/update-wallpapers))))
(defun dw/on-exwm-init ()
(dw/configure-desktop)
(dw/start-panel))
(when dw/exwm-enabled
;; Configure the desktop for first load
(add-hook 'exwm-init-hook #'dw/on-exwm-init))
Jan 24, 2020
Jan 24, 2020
328
Feb 1, 2020
Feb 1, 2020
329
#+end_src
Jan 24, 2020
Jan 24, 2020
330
Jan 27, 2020
Jan 27, 2020
331
** Window Switcher
Jan 24, 2020
Jan 24, 2020
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
(defalias 'switch-to-buffer-original 'exwm-workspace-switch-to-buffer)
;; (defalias 'switch-to-buffer 'exwm-workspace-switch-to-buffer)
;; (defun dw/counsel-switch-buffer ()
;; "Switch to another buffer.
;; Display a preview of the selected ivy completion candidate buffer
;; in the current window."
;; (interactive)
;; (ivy-read "Switch to buffer: " 'internal-complete-buffer
;; :preselect (buffer-name (other-buffer (current-buffer)))
;; :keymap ivy-switch-buffer-map
;; :action #'ivy--switch-buffer-action
;; :matcher #'ivy--switch-buffer-matcher
;; :caller 'counsel-switch-buffer
;; :unwind #'counsel--switch-buffer-unwind
;; :update-fn 'counsel--switch-buffer-update-fn)
;; )
Jan 24, 2020
Jan 24, 2020
353
#+end_src
Jan 27, 2020
Jan 27, 2020
355
** Panel
Jan 24, 2020
Jan 24, 2020
357
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
Jan 24, 2020
Jan 24, 2020
359
360
(defun dw/send-polybar-hook (name number)
(start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" name number)))
Nov 8, 2020
Nov 8, 2020
362
363
364
(defun dw/update-polybar-exwm (&optional path)
(dw/send-polybar-hook "exwm" 1)
(dw/send-polybar-hook "exwm-path" 1))
Jan 24, 2020
Jan 24, 2020
366
367
368
369
370
371
372
373
374
375
376
(defun dw/update-polybar-telegram ()
(dw/send-polybar-hook "telegram" 1))
(defun dw/polybar-exwm-workspace ()
(pcase exwm-workspace-current-index
(0 "")
(1 "")
(2 "")
(3 "")
(4 "")))
Nov 8, 2020
Nov 8, 2020
377
378
379
380
381
382
(defun dw/polybar-exwm-workspace-path ()
(let ((workspace-path (frame-parameter nil 'bufler-workspace-path-formatted)))
(if workspace-path
(substring-no-properties workspace-path)
"")))
Jan 24, 2020
Jan 24, 2020
383
384
385
386
387
388
389
390
391
392
393
394
395
(defun dw/polybar-mail-count (max-count)
(if dw/mail-enabled
(let* ((mail-count (shell-command-to-string
(format "mu find --nocolor -n %s \"%s\" | wc -l" max-count dw/mu4e-inbox-query))))
(format " %s" (string-trim mail-count)))
""))
(defun dw/telega-normalize-name (chat-name)
(let* ((trimmed-name (string-trim-left (string-trim-right chat-name "}") "◀{"))
(first-name (nth 0 (split-string trimmed-name " "))))
first-name))
(defun dw/propertized-to-polybar (buffer-name)
Jan 29, 2020
Jan 29, 2020
396
397
398
399
400
(if-let* ((text (substring-no-properties buffer-name))
(fg-face (get-text-property 0 'face buffer-name))
(fg-color (face-attribute fg-face :foreground)))
(format "%%{F%s}%s%%{F-}" fg-color (dw/telega-normalize-name text))
text))
Jan 24, 2020
Jan 24, 2020
401
402
403
404
405
406
407
(defun dw/polybar-telegram-chats ()
(if (> (length tracking-buffers) 0)
(format " %s" (string-join (mapcar 'dw/propertized-to-polybar tracking-buffers) ", "))
""))
(add-hook 'exwm-workspace-switch-hook #'dw/update-polybar-exwm)
Nov 8, 2020
Nov 8, 2020
408
(add-hook 'bufler-workspace-set-hook #'dw/update-polybar-exwm)
409
410
411
#+end_src
Jan 27, 2020
Jan 27, 2020
412
** Keybindings
Jan 24, 2020
Jan 24, 2020
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
#+begin_src emacs-lisp :tangle .emacs.d/exwm.el
(when dw/exwm-enabled
;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
'(?\C-x
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j ;; Buffer list
?\C-\M-k ;; Browser list
?\C-\ ;; Ctrl+Space
?\C-\;))
;; Ctrl+Q will enable the next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
Aug 20, 2020
Aug 20, 2020
433
434
435
436
(defun exwm/run-vimb ()
(exwm/run-in-background "vimb")
(exwm-workspace-switch-create 2))
Nov 10, 2020
Nov 10, 2020
437
438
439
440
(defun exwm/run-qute ()
(exwm/run-in-background "qutebrowser")
(exwm-workspace-switch-create 2))
Aug 20, 2020
Aug 20, 2020
441
(exwm/bind-function
Nov 10, 2020
Nov 10, 2020
442
"s-o" 'exwm/run-qute)
Aug 20, 2020
Aug 20, 2020
443
Jan 24, 2020
Jan 24, 2020
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
(exwm/bind-command
"s-p" "playerctl play-pause"
"s-[" "playerctl previous"
"s-]" "playerctl next")
(use-package desktop-environment
:after exwm
:config (desktop-environment-mode)
:custom
(desktop-environment-brightness-small-increment "2%+")
(desktop-environment-brightness-small-decrement "2%-")
(desktop-environment-brightness-normal-increment "5%+")
(desktop-environment-brightness-normal-decrement "5%-"))
;; This needs a more elegant ASCII banner
(defhydra hydra-exwm-move-resize (:timeout 4)
"Move/Resize Window (Shift is bigger steps, Ctrl moves window)"
("j" (lambda () (interactive) (exwm-layout-enlarge-window 10)) "V 10")
("J" (lambda () (interactive) (exwm-layout-enlarge-window 30)) "V 30")
("k" (lambda () (interactive) (exwm-layout-shrink-window 10)) "^ 10")
("K" (lambda () (interactive) (exwm-layout-shrink-window 30)) "^ 30")
("h" (lambda () (interactive) (exwm-layout-shrink-window-horizontally 10)) "< 10")
("H" (lambda () (interactive) (exwm-layout-shrink-window-horizontally 30)) "< 30")
("l" (lambda () (interactive) (exwm-layout-enlarge-window-horizontally 10)) "> 10")
("L" (lambda () (interactive) (exwm-layout-enlarge-window-horizontally 30)) "> 30")
("C-j" (lambda () (interactive) (exwm-floating-move 0 10)) "V 10")
("C-S-j" (lambda () (interactive) (exwm-floating-move 0 30)) "V 30")
("C-k" (lambda () (interactive) (exwm-floating-move 0 -10)) "^ 10")
("C-S-k" (lambda () (interactive) (exwm-floating-move 0 -30)) "^ 30")
("C-h" (lambda () (interactive) (exwm-floating-move -10 0)) "< 10")
("C-S-h" (lambda () (interactive) (exwm-floating-move -30 0)) "< 30")
("C-l" (lambda () (interactive) (exwm-floating-move 10 0)) "> 10")
("C-S-l" (lambda () (interactive) (exwm-floating-move 30 0)) "> 30")
("f" nil "finished" :exit t))
;; Workspace switching
(setq exwm-input-global-keys
`(([?\s-\C-r] . exwm-reset)
([?\s-w] . exwm-workspace-switch)
([?\s-r] . hydra-exwm-move-resize/body)
([?\s-e] . dired-jump)
([?\s-E] . (lambda () (interactive) (dired "~")))
([?\s-Q] . (lambda () (interactive) (kill-buffer)))
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
Jan 27, 2020
Jan 27, 2020
495
(exwm-input-set-key (kbd "<s-return>") 'vterm)
Jan 24, 2020
Jan 24, 2020
496
497
498
(exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app)
(exwm-input-set-key (kbd "s-f") 'exwm-layout-toggle-fullscreen))
Feb 1, 2020
Feb 1, 2020
499
#+end_src
Jan 24, 2020
Jan 24, 2020
500
Jan 27, 2020
Jan 27, 2020
501
** Useful Links
Jan 24, 2020
Jan 24, 2020
502
503
504
505
506
- https://github.com/ch11ng/exwm/wiki
- https://www.reddit.com/r/emacs/comments/6huok9/exwm_configs/
- https://ambrevar.xyz/de/index.html
Jan 27, 2020
Jan 27, 2020
507
* Panel via Polybar
508
509
510
511
512
I use [[https://github.com/polybar/polybar][Polybar]] to display a panel at the top of the primary screen to display my current EXWM workspace, CPU usage and temperature, battery status, time, and system tray. It uses some custom hooks back into Emacs via =emacsclient=.
*.config/polybar/config:*
Jan 28, 2020
Jan 28, 2020
513
#+begin_src conf :tangle .config/polybar/config :noweb yes
514
515
516
517
518
519
520
521
522
523
524
525
; Docs: https://github.com/polybar/polybar
;==========================================================
[settings]
screenchange-reload = true
[global/wm]
margin-top = 0
margin-bottom = 0
[colors]
Jun 5, 2020
Jun 5, 2020
526
background = #f0232635
527
background-alt = #576075
Jun 5, 2020
Jun 5, 2020
528
foreground = #A6Accd
529
530
531
532
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
Jun 5, 2020
Jun 5, 2020
533
underline-1 = #c792ea
534
535
536
[bar/panel]
width = 100%
Jan 29, 2020
Jan 29, 2020
537
height = <<get-setting(name="polybar/height")>>
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
offset-x = 0
offset-y = 0
fixed-center = true
enable-ipc = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 2
line-color = #f00
border-size = 0
border-color = #00000000
padding-top = 5
padding-left = 1
padding-right = 1
module-margin = 1
Jan 29, 2020
Jan 29, 2020
558
559
560
561
font-0 = "Cantarell:size=<<get-setting(name="polybar/font-0-size")>>:weight=bold;2"
font-1 = "Font Awesome:size=<<get-setting(name="polybar/font-1-size")>>;2"
font-2 = "Material Icons:size=<<get-setting(name="polybar/font-2-size")>>;5"
font-3 = "Fira Mono:size=<<get-setting(name="polybar/font-3-size")>>;-3"
Nov 8, 2020
Nov 8, 2020
563
modules-left = exwm exwm-path
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
modules-center = spotify
modules-right = telegram mu4e cpu temperature battery date
tray-position = right
tray-padding = 2
tray-maxsize = 28
cursor-click = pointer
cursor-scroll = ns-resize
[module/exwm]
type = custom/ipc
hook-0 = emacsclient -e "(dw/polybar-exwm-workspace)" | sed -e 's/^"//' -e 's/"$//'
initial = 1
format-underline = ${colors.underline-1}
format-background = ${colors.background-alt}
format-padding = 1
Nov 8, 2020
Nov 8, 2020
582
583
584
585
586
587
[module/exwm-path]
type = custom/ipc
hook-0 = emacsclient -e "(dw/polybar-exwm-workspace-path)" | sed -e 's/^"//' -e 's/"$//'
format-foreground = #f78c6c
initial = 1
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
[module/spotify]
type = custom/script
exec = ~/.config/polybar/player-status.sh
interval = 3
[module/mu4e]
type = custom/ipc
hook-0 = emacsclient -e '(dw/polybar-mail-count 500)' | sed -e 's/^"//' -e 's/"$//'
initial = 1
format-underline = ${colors.underline-1}
click-left = emacsclient -e '(dw/go-to-inbox)'
[module/telegram]
type = custom/ipc
hook-0 = emacsclient -e '(dw/polybar-telegram-chats)' | sed -e 's/^"//' -e 's/"$//'
format-padding = 3
initial = 1
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix-font = 1
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.underline-1}
label-layout = %layout%
label-layout-underline = ${colors.underline-1}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-underline = ${colors.underline-1}
[module/cpu]
type = internal/cpu
interval = 2
format = <label> <ramp-coreload>
format-underline = ${colors.underline-1}
click-left = emacsclient -e "(proced)"
label = %percentage:2%%
ramp-coreload-spacing = 0
ramp-coreload-0 = ▁
ramp-coreload-0-foreground = ${colors.foreground-alt}
ramp-coreload-1 = ▂
ramp-coreload-2 = ▃
ramp-coreload-3 = ▄
ramp-coreload-4 = ▅
ramp-coreload-5 = ▆
ramp-coreload-6 = ▇
[module/memory]
type = internal/memory
interval = 2
format-prefix = "M:"
format-prefix-foreground = ${colors.foreground-alt}
format-underline = ${colors.underline-1}
label = %percentage_used%%
[module/date]
type = internal/date
interval = 5
Feb 9, 2020
Feb 9, 2020
650
date = "W%U: %a %b %e"
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
date-alt = "%A %B %d %Y"
time = %l:%M %p
time-alt = %H:%M:%S
format-prefix-foreground = ${colors.foreground-alt}
format-underline = ${colors.underline-1}
label = %date% %time%
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 98
time-format = %-l:%M
label-charging = %percentage%% / %time%
format-charging = <animation-charging> <label-charging>
format-charging-underline = ${colors.underline-1}
label-discharging = %percentage%% / %time%
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${self.format-charging-underline}
format-full = <ramp-capacity> <label-full>
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
Feb 3, 2020
Feb 3, 2020
697
format = <label>
698
format-underline = ${colors.underline-1}
Feb 3, 2020
Feb 3, 2020
699
format-warn = <label-warn>
700
701
702
703
704
705
706
707
708
709
format-warn-underline = ${self.format-underline}
label = %temperature-c%
label-warn = %temperature-c%!
label-warn-foreground = ${colors.secondary}
#+end_src
I created a simple script to grab Spotify player information using =playerctl=:
Jan 27, 2020
Jan 27, 2020
710
*.config/polybar/player-status.sh:*
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
#+begin_src sh :tangle .config/polybar/player-status.sh :shebang #!/bin/sh
status="$(playerctl -p spotify status 2>&1)"
if [ "$status" != "No players found" ]
then
artist="$(playerctl -p spotify metadata artist)"
if [ "$artist" != "" ]
then
echo " $(playerctl -p spotify metadata artist) - $(playerctl -p spotify metadata title)"
else
# Clear any string that was previously displayed
echo ""
fi
else
# Clear any string that was previously displayed
echo ""
fi
#+end_src
Jan 24, 2020
Jan 24, 2020
731
Jan 28, 2020
Jan 28, 2020
732
733
734
735
736
737
738
739
*Guix Packages*
#+begin_src scheme :noweb-ref packages :noweb-sep ""
"polybar"
#+end_src
Jan 27, 2020
Jan 27, 2020
740
* Desktop Notifications via Dunst
Jan 27, 2020
Jan 27, 2020
741
Jan 27, 2020
Jan 27, 2020
742
[[https://dunst-project.org/][Dunst]] is a minimal interface for displaying desktop notifications. It is quite hackable but I'm not currently taking much advantage of its power. One useful feature is the ability to recall notification history; the keybinding is =C-`= in my configuration (though I'd prefer if I could invoke it from an Emacs keybinding somehow).
Jan 27, 2020
Jan 27, 2020
743
744
745
*.config/dunst/dunstrc:*
Jan 28, 2020
Jan 28, 2020
746
#+begin_src conf :tangle .config/dunst/dunstrc :noweb yes
Jan 27, 2020
Jan 27, 2020
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
[global]
### Display ###
monitor = 0
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
geometry = "500x10-10+50"
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = yes
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = no
# The transparency of the window. Range: [0; 100].
Jan 31, 2020
Jan 31, 2020
764
transparency = 10
Jan 27, 2020
Jan 27, 2020
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
# The height of the entire notification. If the height is smaller
# than the font height and padding combined, it will be raised
# to the font height and padding.
notification_height = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 1
separator_color = frame
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 2
# Defines color of the frame around the notification window.
frame_color = "#89AAEB"
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
idle_threshold = 120
### Text ###
Jan 29, 2020
Jan 29, 2020
799
font = Cantarell <<get-setting(name="dunst/font-size")>>
Jan 27, 2020
Jan 27, 2020
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 0
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = yes
# When word_wrap is set to no, specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = middle
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = true
# Hide the count of stacked notifications with the same content
hide_duplicate_count = false
# Display indicators for URLs (U) and actions (A).
show_indicators = yes
### Icons ###
# Align icons left/right/off
icon_position = left
# Scale larger icons down to this size, set to 0 to disable
Jan 29, 2020
Jan 29, 2020
853
max_icon_size = <<get-setting(name="dunst/max-icon-size")>>
Jan 27, 2020
Jan 27, 2020
854
855
# Paths to default icons.
Feb 3, 2020
Feb 3, 2020
856
icon_path = /home/daviwil/.guix-extra-profiles/desktop/desktop/share/icons/gnome/256x256/status/:/home/daviwil/.guix-extra-profiles/desktop/desktop/share/icons/gnome/256x256/devices/:/home/daviwil/.guix-extra-profiles/desktop/desktop/share/icons/gnome/256x256/emblems/
Jan 27, 2020
Jan 27, 2020
857
858
859
860
861
862
863
864
865
866
867
868
869
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = no
# Maximum amount of notifications kept in history
history_length = 20
### Misc/Advanced ###
# Browser for opening urls in context menu.
Nov 10, 2020
Nov 10, 2020
870
browser = qutebrowser
Jan 27, 2020
Jan 27, 2020
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = Dunst
# Define the class of the windows spawned by dunst
class = Dunst
startup_notification = false
verbosity = mesg
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 4
mouse_left_click = close_current
mouse_middle_click = do_action
mouse_right_click = close_all
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[shortcuts]
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
#close = ctrl+space
# Close all notifications.
#close_all = ctrl+shift+space
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1". Make sure this key actually exists on your keyboard layout,
# e.g. check output of 'xmodmap -pke'
history = ctrl+grave
# Context menu.
context = ctrl+shift+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#222222"
foreground = "#888888"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#1c1f26"
foreground = "#ffffff"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon
[urgency_critical]
background = "#900000"
foreground = "#ffffff"
frame_color = "#ff0000"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon
#+end_src
Jan 28, 2020
Jan 28, 2020
953
954
955
956
957
958
959
960
*Guix Packages*
#+begin_src scheme :noweb-ref packages :noweb-sep ""
"dunst"
#+end_src
Jan 27, 2020
Jan 27, 2020
961
* Display Management
Jan 24, 2020
Jan 24, 2020
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
I use a script to automatically configure multiple displays with =xrandr= when I dock my laptops. This script invokes =xrandr= differently based on the hostname of the machine.
#+begin_src sh :tangle .bin/update-screens :shebang #!/bin/sh
case $(hostname) in
zerocool)
xrandr --output VIRTUAL1 --off --output eDP1 --mode 2560x1440 --pos 3840x416 --rotate normal --output DP1 --off --output HDMI1 --off --output DP1-3 --off --output DP1-2 --off --output DP1-1 --primary --mode 3840x2160 --pos 0x0 --rotate normal --output DP2 --off
;;
davinci)
# Temporary: this is for docking my laptop at home with HDMI!
#xrandr --output HDMI-2 --mode 3840x2160 --pos 0x0 --scale 0.6x0.6 --primary --rotate normal --output HDMI-1 --off --output DP-1 --off --output eDP-1 --mode 1920x1080 --pos 2304x216 --rotate normal --output DP-2 --off
xrandr --output eDP-1 --mode 1920x1080 --pos 2560x360 --rotate normal --output DP-1-2 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output HDMI-2 --off --output HDMI-1 --off --output DP-1 --off --output DP-1-3 --off --output DP-2 --off --output DP-1-1 --off
;;
phantom)
Aug 28, 2020
Aug 28, 2020
980
981
982
# On a new install, run this command first to ensure HDMI works!
# xrandr --setprovideroutputsource nouveau modesetting
xrandr --output eDP-1 --primary --mode 3840x2160 --pos 0x0 --rotate normal --output eDP-1-2 --off --output HDMI-1-1 --mode 3840x2160 --pos 3840x0 --rotate normal --output DP-1-1 --off --output DP-1-2 --off
Jan 24, 2020
Jan 24, 2020
983
984
985
986
987
;;
esac
#+end_src
Jan 24, 2020
Jan 24, 2020
988
Feb 2, 2020
Feb 2, 2020
989
990
991
992
993
994
995
996
997
998
999
1000
* User Services
I use [[https://www.gnu.org/software/shepherd/][GNU Shepherd]] to manage services that run in the background when I log in.
#+begin_src scheme :tangle .config/shepherd/init.scm
(define gpg-agent
(make <service>
#:provides '(gpg-agent)
#:respawn? #t
#:start (make-system-constructor "gpg-connect-agent /bye")
#:stop (make-system-destructor "gpgconf --kill gpg-agent")))