Abstract
I have been using Spacemacs for roughly a year or so now, and thought it might be time to try out EXWM. DWM is a very good window manager, and I don’t have any issue that is making me want to move away from DWM, but I also like trying new things. So, here is my experience in working with EXWM on Spacemacs.
Getting Started
Getting started with EXWM on Spacemacs is as simple as enabling the
layer, docs can be found here.
For myself, I added the following to my .spacemacs
file:
;; In the `dotspacemacs-configuration-layers` section
t
(exwm :variables exwm-systemtray-mode "st"
exwm-terminal-command "slock"
exwm-locking-command t
exwm-hide-tiling-modeline t
exwm-workspace-switch-wrap t)
exwm-randr-mode
;; In the `dotspacemacs/user-config` section
;; This puts workspaces 2 and 3 on my second monitor
setq exwm-randr-workspace-monitor-plist '(2 "HDMI-A-0" 3 "HDMI-A-0"))
(;; This auto refreshes randr so the workspaces go to the appropraite
;; monitor automatically
(exwm-randr-refresh);; Turns on transparency
(spacemacs/toggle-transparency)
Then simply modify your .xinitrc file to run emacs rather than your window manager or desktop environment, for example my .xinitrc looks as follows:
# This swaps the functionality of the escape and caps lock key
exec setxkbmap -option caps:swapescape &
# Sets the wallpaper to ~/.config/wall.png
exec feh --bg-fill ~/.config/wall.png &
# Turns on transparency settings I like
exec xcompmgr -slt &
# Network Manager applet for FreeBSD
exec networkmgr &
# Starts emacs and EXWM
exec emacs
From there, just exit X and run startx
again; the
process will be slightly different for people that use display managers,
I might recommend using the Arch
Wiki for guides on adding EXWM to the one you are using. Once emacs
is running, Spacemacs will download and install the relevant layer
packages for emacs, and after a few minutes you will be using EXWM.
That all seems good, but checking the Spacemacs documentation for the
keybindings, some (many) of them don’t work as documented. For example,
s-RET (super/meta/windows + return I assume) should launch the terminal
that was configured in the .spacemacs
file, but hitting the
meta and return keys just shows an error. After digging through the
files and messing around a bit, I found that the file:
~/.emacs.d/layers/+window-management/exwm/packages.el
is
where the keybindings are configured. From there, it was as simple as
changing some lines, though I am still playing around with them. The
diff of what I have done so far is as follow:
- (require 'exwm-config)
- (unless exwm-workpsace-number)
- (custom-set-variables '(exwm-workspace-number (/ (length exwm--randr-displays) 2)))
+ (setq exwm-workspace-number 4)
- (exwm-input-set-key (kbd "s-TAB") #'exwm/jump-to-last-exwm)
+ (exwm-input-set-key (kbd "s-W") #'exwm-workspace-move-window)
+ (exwm-input-set-key (kbd "s-<tab>") #'exwm/jump-to-last-exwm)
- (exwm-input-set-key (kbd "s-RET") #'exwm/terminal-command)
+ (exwm-input-set-key (kbd "s-<return>") #'exwm/terminal-launcher)
There are still some paper cuts that I am trying to figure out a more convenient way to handle such as:
- Launching lf (I know emacs has dired, but I don’t think it works as well for all types of files as a proper file manager)
- Launching neomutt (emacs can do email, so might replace it with something like GNUs or Mu4e)
- Launching moc (I have used an emacs music player before, and it is alright so I might switch, but am still undecided)
Usability
Getting EXWM setup is one thing, but how pleasant is it to use? The
answer to that question, in my opinion, really comes down to how
comfortable you are in emacs. EXWM is designed so that you truly never
leave emacs, thus every aspect of window management will be based around
emacs concepts. Coming from other window managers such as DWM and i3,
EXWM takes a lot of getting used to. The is even more true because I
only started using emacs about a year ago, that being said, I also feel
quite a bit more focused using EXWM then I did in DWM. For example, I
can do an org capture on the fly without having to leave the window that
I am on; simply pressing s-i
to put the workspace into line
mode will allow me to use Spacemacs keyboard shortcuts to add something
to my org-agenda or any other capture that I want to do. This makes
taking notes or scheduling very easy and minimally disruptive to what I
am currently doing.
Gaming?
Now that I have spoken about how EXWM makes me feel more productive, how does it handle gaming? Games that automatically go fullscreen seem to work without issue; I was able to play Tomb Raider without much of a problem just like normal. Other games, such as Payday 2, worked as expected, however, I could not figure out how to make the game fullscreen, nor could I figure out how to center the game onto the screen. The EXWM keybindings were not working from within the game window, and I could not figure out how to manipulate the game window otherwise. There is probably a way to fix this, but I could not figure out what it was at the time of this blog post.
Final Thoughts
EXWM is a pretty good window manager, especially when considering productivity, for people that are already comfortable in emacs. However, if you are new to emacs, expect to struggle with it for a while. Again, I have been using Spacemacs for a bit more than a year and I am still struggling with it consistently. I am not sure that it will be replacing DWM in the long term, but it is to play around with something different.