3.0 KiB

General Config

This section contains the general configuration for EXWM.

(defun jm/exwm-update-class ()
  (exwm-workspace-rename-buffer exwm-class-name))

(use-package exwm
  :config
  
  ; Set default number of workspaces
  (setq exwm-workspace-number 5)

  ; Add key remaps
  (start-process-shell-command "xmodmap" nil "xmodmap ~/.Xmodmap")
  
  ; Add hook to rename EXWM window to running application name
  (add-hook 'exwm-update-class-hook #'jm/exwm-update-class)

  ;; These keys should always pass through to Emacs
  (setq exwm-input-prefix-keys
    '(?\C-x
      ?\C-w
      ?\C-u
      ?\C-h
      ?\M-x
      ?\M-`
      ?\M-&
      ?\M-:
      ?\C-\M-j  ;; Buffer list
      ?\C-\ ))  ;; Ctrl+Space
      
  ;; Set up global key bindings.  These always work, no matter the input state!
  ;; Keep in mind that changing this list after EXWM initializes has no effect.
  (setq exwm-input-global-keys
        `(
          ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
          ([?\s-r] . exwm-reset)
          
          ;; Move window to other workspace
          ([?\s-m] . exwm-workspace-move-window)

          ;; Launch applications via shell command
          ([?\s-&] . (lambda (command)
                       (interactive (list (read-shell-command "$ ")))
                       (start-process-shell-command command nil command)))

          ;; Switch workspace
          ([?\s-w] . exwm-workspace-switch)
          ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))

          ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
          ,@(mapcar (lambda (i)
                      `(,(kbd (format "s-%d" i)) .
                        (lambda ()
                          (interactive)
                          (exwm-workspace-switch-create ,i))))
                    (number-sequence 0 9))))

  (exwm-enable))

Randr

EXWM Randr is a built-in plugin that allows you to add two monitor support. By default EXWM merges the two monitors into one making the desktop environment unusable.

(use-package exwm-randr
  :ensure nil
  :config
  (exwm-randr-enable)
  (start-process-shell-command "xrandr" nil "xrandr --output HDMI-1 --mode 2560x1080 --pos 0x694 --rotate normal --output DP-0 --off --output DP-1 --primary --mode 3440x1440 --pos 2560x0 --rotate normal --output DP-2 --off --output DP-3 --off --output DP-4 --off --output DP-5 --off")

  ;; This will need to be updated to the name of a display!  You can find
  ;; the names of your displays by looking at arandr or the output of xrandr
  (setq exwm-randr-workspace-monitor-plist '(2 "HDMI-1" 3 "HDMI-1")))

System Tray

(use-package exwm-systemtray
  :ensure nil
  :config
  (exwm-systemtray-enable))

Volume Control

To control volume through EXWM you can install the pulseaudio-control package.

(use-package pulseaudio-control
  :config
  (pulseaudio-control-default-keybindings))