The path to GNUrvana

Desktop Environment

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.

Table of Contents

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 Systems.org.

(load-file ".emacs.d/per-system-settings.el")
(dw/system-settings-get (intern name))

Fonts and Themes

I use 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:


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"
Xft/DPI <<dpi()>> # 1024 * DPI

I also have to do an extra step to make sure Emacs can find the font path from the "desktop" profile.


<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <family>Apple Color Emoji</family>
      <family>Noto Color Emoji</family>


(* 1024 (alist-get 'desktop/dpi dw/system-settings))

Guix Packages

;; Settings Manager

;; GTK Themes

;; Fonts

Window Management

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.

(use-package exwm
  (setq mouse-autoselect-window nil
        focus-follows-mouse t
        exwm-workspace-warp-cursor t
        exwm-workspace-number 5)
        ;exwm-workspace-display-echo-area-timeout 5
        ;exwm-workspace-minibuffer-position 'bottom) ;; Annoying focus issues
  ;; 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 ()
              (pcase exwm-class-name
                ("Vimb" (exwm-workspace-rename-buffer (format "vimb: %s" exwm-title)))
                ("qutebrowser" (exwm-workspace-rename-buffer (format "Qutebrowser: %s" exwm-title))))))


;; Enable exwm-randr before exwm-init gets called
(use-package exwm-randr
  :if dw/exwm-enabled
  :after (exwm)
  (setq exwm-randr-workspace-monitor-plist '(4 "eDP-1")))

Helper Functions

(defun exwm/run-in-background (command)
  (let ((command-parts (split-string command "[ ]+")))
    (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))

(defun exwm/bind-function (key invocation &rest bindings)
  "Bind KEYs to FUNCTIONs globally"
  (while key
    (exwm-input-set-key (kbd key)
                        `(lambda ()
                           (funcall ',invocation)))
    (setq key (pop bindings)
          invocation (pop bindings))))

(defun exwm/bind-command (key command &rest bindings)
  "Bind KEYs to COMMANDs globally"
  (while key
    (exwm-input-set-key (kbd key)
                        `(lambda ()
                           (exwm/run-in-background ,command)))
    (setq key (pop bindings)
          command (pop bindings))))


(defun dw/exwm-init-hook ()
  (with-eval-after-load 'perspective
    ;; Set up perspective names on initial workspaces
    (exwm-workspace-switch-create 0)
    (persp-switch "Chat")

    ;; Launch Telega in workspace 0 if we've logged in before
    (when (file-exists-p "~/.telega/db.sqlite")
      (telega nil))

    (persp-kill "Main")
    (exwm-workspace-switch-create 1)
    (exwm-workspace-switch-create 2)
    (persp-switch "Browsers")
    (persp-kill "Main")
    (exwm-workspace-switch-create 3)
    (persp-switch "Comms")
    (persp-kill "Main")
    (exwm-workspace-switch-create 4)
    (persp-switch "Media")
    (persp-kill "Main")

    ;; Make workspace 1 be the one where we land at startup
    (exwm-workspace-switch-create 1)

    ;; Open eshell by default

  ;; Launch apps that will run in the background
  (exwm/run-in-background "dunst")
  (exwm/run-in-background "nm-applet")
  (exwm/run-in-background "syncthing-gtk --minimized")
  (exwm/run-in-background "udiskie -t")
  (exwm/run-in-background "redshift -l 47.675510:-122.203362 -t 6500:3500"))

(use-package exwm
  :if dw/exwm-enabled

  (add-hook 'exwm-mode-hook
            (lambda ()
              (evil-local-set-key 'motion (kbd "C-u") nil)))

  (defun dw/setup-window-by-class ()
    (pcase exwm-class-name
      ("Pidgin" (exwm-workspace-move-window 0))
      ("Pidgin<2>" (exwm-workspace-move-window 0))
      ("discord" (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))
      ("qutebrowser" (exwm-workspace-move-window 2))
      ("qjackctl" (exwm-floating-toggle-floating))
      ("mpv" (exwm-floating-toggle-floating)
      ("gsi" (exwm-input-toggle-keyboard))))

  ;; 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

              ;; Hide the modeline on all X windows

  ;; Hide the modeline on all X windows
  (add-hook 'exwm-floating-setup-hook
            (lambda ()

(use-package exwm-systemtray
  :if dw/exwm-enabled
  :after (exwm)
  (setq exwm-systemtray-height 35))

Desktop Configuration

(defun dw/run-xmodmap ()
  (start-process-shell-command "xmodmap" nil "xmodmap ~/.dotfiles/.config/i3/Xmodmap"))

(defun dw/update-wallpapers ()
   "feh" nil
   (format "feh --bg-scale ~/.dotfiles/backgrounds/%s" (alist-get 'desktop/background dw/system-settings))))

(setq dw/panel-process nil)
(defun dw/kill-panel ()
  (when dw/panel-process
      (kill-process dw/panel-process)))
  (setq dw/panel-process nil))

(defun dw/start-panel ()
  (setq dw/panel-process (start-process-shell-command "polybar" nil "polybar panel")))

(defun dw/update-screen-layout ()
  (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 ()
    (run-at-time "2 sec" nil (lambda () (dw/update-wallpapers))))

(defun dw/on-exwm-init ()

(when dw/exwm-enabled
  ;; Configure the desktop for first load
  (add-hook 'exwm-init-hook #'dw/on-exwm-init))


(defun dw/send-polybar-hook (name number)
  (start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" name number)))

(defun dw/update-polybar-exwm (&optional path)
  (dw/send-polybar-hook "exwm" 1)
  (dw/send-polybar-hook "exwm-path" 1))

(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 "")))

(defun dw/polybar-exwm-workspace-path ()
  (let ((workspace-path (frame-parameter nil 'bufler-workspace-path-formatted)))
    (if workspace-path
        (substring-no-properties workspace-path)

(defun dw/polybar-mail-count (max-count)
  (if (and dw/mail-enabled dw/mu4e-inbox-query)
    (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 " "))))

(defun dw/propertized-to-polybar (buffer-name)
  (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))

(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)
(add-hook 'bufler-workspace-set-hook #'dw/update-polybar-exwm)


(when dw/exwm-enabled
  ;; These keys should always pass through to Emacs
  (setq exwm-input-prefix-keys
      ?\C-\M-j  ;; Buffer list
      ?\C-\M-k  ;; Browser list
      ?\C-\M-n  ;; Next workspace
      ?\C-\     ;; Ctrl+Space

  ;; Ctrl+Q will enable the next key to be sent directly
  (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)

  (defun exwm/run-vimb ()
    (exwm/run-in-background "vimb")
    (exwm-workspace-switch-create 2))

  (defun exwm/run-qute ()
    (exwm/run-in-background "qutebrowser")
    (exwm-workspace-switch-create 2))

    "s-o" 'exwm/run-qute
    "s-q" 'kill-buffer)

    "s-p" "playerctl play-pause"
    "s-[" "playerctl previous"
    "s-]" "playerctl next")

  (use-package desktop-environment
    :after exwm
    :config (desktop-environment-mode)
    (desktop-environment-brightness-small-increment "2%+")
    (desktop-environment-brightness-small-decrement "2%-")
    (desktop-environment-brightness-normal-increment "5%+")
    (desktop-environment-brightness-normal-decrement "5%-")
    (desktop-environment-screenshot-command "flameshot gui"))

  ;; 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 ()
                           (exwm-workspace-switch-create ,i))))
                      (number-sequence 0 9))))

  (exwm-input-set-key (kbd "<s-return>") 'vterm)
  (exwm-input-set-key (kbd "s-SPC") 'app-launcher-run-app)
  (exwm-input-set-key (kbd "s-f") 'exwm-layout-toggle-fullscreen))

Useful Links

Panel via Polybar

I use 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.


; Docs: https://github.com/polybar/polybar

screenchange-reload = true

margin-top = 0
margin-bottom = 0

background = #f0232635
background-alt = #576075
foreground = #A6Accd
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
underline-1 = #c792ea

width = 100%
height = <<get-setting(name="polybar/height")>>
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

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"

modules-left = exwm exwm-path
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

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

type = custom/ipc
hook-0 = emacsclient -e "(dw/polybar-exwm-workspace-path)" | sed -e 's/^"//' -e 's/"$//'
format-foreground = #f78c6c
initial = 1

type = custom/script
exec = ~/.config/polybar/player-status.sh
interval = 3

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)'

type = custom/ipc
hook-0 = emacsclient -e '(dw/polybar-telegram-chats)' | sed -e 's/^"//' -e 's/"$//'
format-padding = 3
initial = 1

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}

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 = ▇

type = internal/memory
interval = 2
format-prefix = "M:"
format-prefix-foreground = ${colors.foreground-alt}
format-underline = ${colors.underline-1}
label = %percentage_used%%

type = internal/date
interval = 5

date = "W%U: %a %b %e"
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%

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

type = internal/temperature
thermal-zone = 0
warn-temperature = 60

format = <label>
format-underline = ${colors.underline-1}
format-warn = <label-warn>
format-warn-underline = ${self.format-underline}

label = %temperature-c%
label-warn = %temperature-c%!
label-warn-foreground = ${colors.secondary}

I created a simple script to grab Spotify player information using playerctl:


status="$(playerctl -p spotify status 2>&1)"
if [ "$status" != "No players found" ]
  artist="$(playerctl -p spotify metadata artist)"
  if [ "$artist" != "" ]
    echo " $(playerctl -p spotify metadata artist) - $(playerctl -p spotify metadata title)"
    # Clear any string that was previously displayed
    echo ""
  # Clear any string that was previously displayed
  echo ""

Guix Packages


Desktop Notifications via Dunst

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).


    ### 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].
    transparency = 10

    # 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 ###

    font = Cantarell <<get-setting(name="dunst/font-size")>>

    # 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
    max_icon_size = <<get-setting(name="dunst/max-icon-size")>>

    # Paths to default icons.
    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/

    ### 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.
    browser = qutebrowser

    # 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.
    # 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 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

    # 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

    background = "#1c1f26"
    foreground = "#ffffff"
    timeout = 10
    # Icon for notifications with normal urgency, uncomment to enable
    #icon = /path/to/icon

    background = "#900000"
    foreground = "#ffffff"
    frame_color = "#ff0000"
    timeout = 0
    # Icon for notifications with critical urgency, uncomment to enable
    #icon = /path/to/icon

Guix Packages

"libnotify"  ; For notify-send

Automatic Disk Mounting with Udiskie

Guix Packages


Display Management

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.

case $(hostname) in

        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

        # 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

        # 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


Default Applications

The file .config/mimeapps.list configures default applications for various content types. Right now I'm using it to control which browser opens URLs from other applications.

[Default Applications]

User Services

I use GNU Shepherd to manage services that run in the background when I log in.

(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")))

(define mcron
  (make <service>
    #:provides '(mcron)
    #:respawn? #t
    #:start (make-forkexec-constructor '("mcron"))
    #:stop  (make-kill-destructor)))

(define syncthing
  (make <service>
    #:provides '(syncthing)
    #:respawn? #t
    #:start (make-forkexec-constructor '("syncthing" "-no-browser"))
    #:stop  (make-kill-destructor)))

(define pulseaudio
  (make <service>
    #:provides '(pulseaudio)
    #:respawn? #t
    #:start (make-forkexec-constructor '("pulseaudio"))
    #:stop  (make-kill-destructor)))

(register-services gpg-agent mcron syncthing pulseaudio)
(action 'shepherd 'daemonize)

;; Start user services
(for-each start '(gpg-agent mcron syncthing pulseaudio))

Scheduled Tasks

I use GNU mcron for scheduling tasks to run periodically in the background.

Syncing Passwords

   '(next-hour (range 0 24 4))

Guix Packages




Guix Packages



Qutebrowser is a great keyboard-centric browser which uses the Chromium rendering engine via QT 5's WebEngine component. I've configured it to act more like Vimb for window-per-tab behavior that integrates well into Emacs. One thing I like about this browser is that it does a much better job of remembering what windows you had open when it exits so that you can maintain your session more easily. I also like that when you reopen a tab/window, the history of that window is still present.

# Open every tab as a new window, Vimb style
c.tabs.tabs_are_windows = True
c.tabs.show = "multiple"
c.tabs.last_close = "close"

c.auto_save.session = True
c.scrolling.smooth = True
c.session.lazy_restore = True
c.content.autoplay = False

# Scale pages and UI better for hidpi
c.zoom.default = "<<get-setting(name="qutebrowser/default-zoom")>>%"
c.fonts.hints = "bold 20pt monospace"

# Better default fonts
c.fonts.web.family.standard = "Bitstream Vera Sans"
c.fonts.web.family.serif = "Bitstream Vera Serif"
c.fonts.web.family.sans_serif = "Bitstream Vera Sans"
c.fonts.web.family.fixed = "Fira Mono"
c.fonts.statusbar = "18pt Cantarell"

# Use dark mode where possible
c.colors.webpage.darkmode.enabled = True
c.colors.webpage.darkmode.policy.images = "never"
c.colors.webpage.bg = "black"

# Automatically turn on insert mode when a loaded page focuses a text field
c.input.insert_mode.auto_load = True

# Edit fields in Emacs with Ctrl+E
c.editor.command = ["emacsclient", "+{line}:{column}", "{file}"]

# Make Ctrl+g quit everything like in Emacs
config.bind('<Ctrl-g>', 'leave-mode', mode='insert')
config.bind('<Ctrl-g>', 'leave-mode', mode='command')
config.bind('<Ctrl-g>', 'leave-mode', mode='prompt')
config.bind('<Ctrl-g>', 'leave-mode', mode='hint')
config.bind('v', 'spawn ~/.dotfiles/bin/umpv {url}')
config.bind('V', 'hint links spawn ~/.dotfiles/bin/umpv {hint-url}')

# Tweak some keybindings
config.unbind('d') # Don't close window on lower-case 'd'
config.bind('yy', 'yank')

# Vim-style movement keys in command mode
config.bind('<Ctrl-j>', 'completion-item-focus --history next', mode='command')
config.bind('<Ctrl-k>', 'completion-item-focus --history prev', mode='command')

# More binding hints here: https://gitlab.com/Kaligule/qutebrowser-emacs-config/blob/master/config.py

# Load the autoconfig file (quteconfig.py)

1p https://my.1password.com/vaults/kyxq62du37adb3lpjh2sphdq4i/allitems/tkr5tuo4gqyuco4x25upt6iaia
gn https://github.com/notifications
dot https://github.com/daviwil/dotfiles
efs https://github.com/daviwil/emacs-from-scratch
sc https://github.com/SystemCrafters
scv https://github.com/SystemCrafters/video-planning
ddg https://duckduckgo.com/?q $0
gh https://github.com/$0
gm https://www.iro.umontreal.ca/~gambit/doc/gambit.html
gam https://github.com/gambit/gambit
zig https://github.com/ziglang/zig
zigd https://ziglang.org/documentation/master/
zigl https://ziglang.org/documentation/master/std
sub https://github.com/substratic/
sube https://github.com/substratic/engine
subb https://github.com/substratic/build
subf https://github.com/substratic/forge
subc https://github.com/substratic/crash-the-stack
tspl https://scheme.com/tspl4/
mail https://fastmail.com
cups http://localhost:631
az https://portal.azure.com
azdo https://dev.azure.com/azure-sdk/
ajs https://github.com/Azure/azure-sdk-for-js
adl https://github.com/Azure/adl
dajs https://github.com/daviwil/azure-sdk-for-js
anet https://github.com/Azure/azure-sdk-for-net
aja https://github.com/Azure/azure-sdk-for-java
apy https://github.com/Azure/azure-sdk-for-python
ats https://github.com/Azure/autorest.typescript
ats3 https://github.com/Azure/autorest.typescript.v3
atest https://github.com/Azure/autorest.testserver
amf https://github.com/Azure/autorest.modelerfour
ar https://github.com/Azure/autorest
arpy https://github.com/Azure/autorest.python
arc https://github.com/Azure/autorest.csharp
are https://github.com/Azure/autorest/tree/master/docs/extensions
arp https://github.com/orgs/Azure/projects/48
ac https://github.com/Azure/autorest.compare
ap https://github.com/Azure/perks
specs https://github.com/Azure/azure-rest-api-specs
oai2 https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
oai3 https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md
npm https://www.npmjs.com/search?q $0
oms https://outlook.com/microsoft.com
msw https://microsoft.sharepoint.com


I used Vimb for a while because the latest Qutebrowser wasn't available in Guix's package repository, but since that problem has since been solved I've switched back to Qutebrowser as primary. Keeping this configuration around in case I need it again.

# Set the home page to a local file
set home-page=file:///home/daviwil/.config/vimb/home.html

# Use home-row keys for hints
set hint-keys=asdfg;lkjh
set hint-match-element=false
set hint-keys-same-length=true
set hint-timeout=0

# Enable smooth scrolling
set smooth-scrolling=true

# Fake a Chromium User-Agent header
#set user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
set user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36

# Set download directory
set download-path=~/Downloads

# If enabled the inputbox will be hidden whenever it contains no text
set input-autohide=true

# Set the default zoom
set default-zoom=<<get-setting(name="vimb/default-zoom")>>

# Hint sites to use dark themes
set dark-mode=on

# Use Emacs as the external editor
set editor-command=emacsclient

# Enable support for WebGL
set webgl=true

# While typing a search command, show where the pattern typed so far matches.
set incsearch=true

# Enable developer tools (binding is gF)
set webinspector=true

# Turn off dark mode on some sites
au LoadCommitted https://outlook.office.com/* set dark-mode=off

# Keybindings
# - 'e' edits URL in current window
# - 'E' edits URL in new window
# - 'O' opens URL in new window
# - 'H' navigates back
# - 'L' navigates forward
# - 'D' closes the window
# - 'C-g' exits command and input mode
# - 'C-j' and 'C-k' move down and up command selections
nn e O
nn E T
nm O :tabopen<Space>
nn H <C-O>
nn L <C-I>
nm D :q<CR>
ino <C-G> <Esc>
cno <C-J> <Tab>
cno <C-K> <S-Tab>

# Zoom keys
nmap + zI
nmap - zO
nmap = zz

# Shortcuts
shortcut-add gn=https://github.com/notifications
shortcut-add dot=https://github.com/daviwil/dotfiles
shortcut-add ddg=https://duckduckgo.com/?q=$0
shortcut-add gh=https://github.com/$0
shortcut-add gm=https://www.iro.umontreal.ca/~gambit/doc/gambit.html
shortcut-add gam=https://github.com/gambit/gambit
shortcut-add zig=https://github.com/ziglang/zig
shortcut-add zigd=https://ziglang.org/documentation/master/
shortcut-add zigl=https://ziglang.org/documentation/master/std
shortcut-add sub=https://github.com/substratic/
shortcut-add sube=https://github.com/substratic/engine
shortcut-add subb=https://github.com/substratic/build
shortcut-add subf=https://github.com/substratic/forge
shortcut-add subc=https://github.com/substratic/crash-the-stack
shortcut-add tspl=https://scheme.com/tspl4/
shortcut-add mail=https://fastmail.com
shortcut-add cups=http://localhost:631
shortcut-add az=https://portal.azure.com
shortcut-add azdo=https://dev.azure.com/azure-sdk/
shortcut-add ajs=https://github.com/Azure/azure-sdk-for-js
shortcut-add dajs=https://github.com/daviwil/azure-sdk-for-js
shortcut-add anet=https://github.com/Azure/azure-sdk-for-net
shortcut-add aja=https://github.com/Azure/azure-sdk-for-java
shortcut-add apy=https://github.com/Azure/azure-sdk-for-python
shortcut-add ats=https://github.com/Azure/autorest.typescript
shortcut-add ats3=https://github.com/Azure/autorest.typescript.v3
shortcut-add atest=https://github.com/Azure/autorest.testserver
shortcut-add amf=https://github.com/Azure/autorest.modelerfour
shortcut-add ar=https://github.com/Azure/autorest
shortcut-add arpy=https://github.com/Azure/autorest.python
shortcut-add arc=https://github.com/Azure/autorest.csharp
shortcut-add are=https://github.com/Azure/autorest/tree/master/docs/extensions
shortcut-add arp=https://github.com/orgs/Azure/projects/48
shortcut-add ac=https://github.com/Azure/autorest.compare
shortcut-add ap=https://github.com/Azure/perks
shortcut-add specs=https://github.com/Azure/azure-rest-api-specs
shortcut-add oai2=https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
shortcut-add oai3=https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md
shortcut-add npm=https://www.npmjs.com/search?q=$0
shortcut-add oms=https://outlook.com/microsoft.com
shortcut-add msw=https://microsoft.sharepoint.com
shortcut-add man=https://fanglingsu.github.io/vimb/man.html

# A newline is needed at EOF because each line is executed like a command as if the user typed it and pressed Enter.


Password Management

Guix Packages


Syncing Passwords

pass git pull
pass git push

notify-send -i "emblem-synchronizing" "Passwords synced!"

Audio Device Control

Guix Packages


Media Players


mpv is a simple yet powerful video player. Paired with youtube-dl it can even stream YouTube videos. mpv-mpris allows playback control via playerctl.


# Configure playback quality

# Start the window in the upper right screen corner

# Save video position on quit

# Enable control by MPRIS

# Limit the resolution of YouTube videos

# When playing audio files, display the album art

# Keep the player open after the file finishes

Guix Packages


Codecs and Drivers

These packages are needed to enable many video formats to be played in browsers and video players. VAAPI drivers are also used to enable hardware-accelerated video decoding.

Guix Packages


Image Viewers and Editors

Guix Packages



Glorious time wasters! I keep these in a separate Guix profile so that I don't have them installed automatically on every machine. To opt in, I have to run activate-profiles games.



Document Readers

# Automatically adjust the document to full width
set adjust-open width

# Set the title to the filename
set window-title-basename true

# Larger scroll steps with j/k
set scroll-step 150

# Adjusting the document
map [normal] E adjust_window best-fit
map [fullscreen] E adjust_window best-fit
map [normal] e adjust_window width
map [fullscreen] e adjust_window width

# Toggling the inverted colours
map <C-i> recolor
map <C-g> abort

Guix Packages



Guix Packages



I use Flatpak and the Flathub repository to install applications that are otherwise difficult to install in Guix because of application frameworks, etc.

Applications to Install

flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install --user flathub com.spotify.Client
flatpak install --user flathub com.valvesoftware.Steam
flatpak install --user flathub com.microsoft.Teams
flatpak install --user flathub com.discordapp.Discord
flatpak install --user flathub-beta com.obsproject.Studio

Guix Packages



Guix Packages


Desktop Tools

Guix Packages

"xdg-utils"      ;; For xdg-open, etc
"xdg-dbus-proxy" ;; For Flatpak
"gtk+:bin"       ;; For gtk-launch
"glib:bin"       ;; For gio-launch-desktop

System Tools

Guix Packages


Xorg Tools

Guix Packages


Desktop Profile

The desktop.scm manifest holds the list of packages that I use to configure my desktop environment. The package names are pulled from the relevant sections titled Guix Packages in this file (Desktop.org).




Bluetooth Setup

If you need to manually connect to Bluetooth audio devices using bluetoothctl, as I currently do in Guix, you'll need to enter these commands at the bluetoothctl prompt:

system-alias "my-hostname" # To configure your laptop's device name
power on
scan on
# Wait for your device to appear
pair 04:52:C7:5E:5C:A8
trust 04:52:C7:5E:5C:A8 # To enable auto-connect
connect 04:52:C7:5E:5C:A8

Provide the dw-desktop package

(provide 'dw-desktop)