Skip to content
EXWM Layer to turn spacemacs into a full-fledged window manager
Emacs Lisp Shell
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
files initial for layer only, based on spacemacs fork Apr 10, 2018
img initial for layer only, based on spacemacs fork Apr 10, 2018
.gitignore Convert new exporter into standalone tool Aug 2, 2017 fix wrong quote in install code Jan 16, 2020
config.el [API-BREAK] Use naming convention for non-private variables Jan 16, 2020
funcs.el [API-BREAK] Use naming convention for non-private variables Jan 16, 2020

EXWM contribution layer for Spacemacs

Table of Contents


Fork Note: This layer is based on CestDiego’s PR from

The time has arrived when one can finally use Emacs as a Window Manager, long ago the concepts of windows and frames made so much sense when one was working in a TTY, and basically that’s all the window management you got. In these modern times though, it sounds silly to have those names. But not Anymore!

Thanks to @ch11ng and his EXWM project we can now use Emacs as our window manager, and all those windows that didn’t make sense before, now can not only hold buffers, but X Windows, that means that you can spawn a Browser Window, or your music player, or anything.

I urge you to read the EXWM Wiki for a more in depth explanation and if you can contribute, please do so! The purpose of me making this layer is that I find it awesome and having nice defaults would make more people dive into it and the project would receive more attention and contributions which will only make it more awesome, so if you try it and like it, share it!

This is how it looks like:



To use this contribution,

  • place this repository in one of Spacemacs’ layer directories (~/.emacs.d/private/local/exwm, ~/.spacemacs.d/private/exwm, or ~/.spacemacs.d/layers/exwm)
  • add an entry exwm for the layer in your ~/.spacemacs, optionally set some configuration variables:
;; (setq-default dotspacemacs-configuration-layers ...
(exwm :variables
       exwm-enable-systray t
       exwm-autostart-xdg-applications t
       exwm-locking-command "i3lock -n"
       exwm-install-logind-lock-handler t
       exwm-terminal-command "st"
       exwm-custom-init (lambda() (exwm/autostart-process "Dunst OSD" "dunst")))
;; )

Note about Display Managers

This is most common among Ubuntu and derivative users:

LightDM, GDM, and other Display managers that need a session file will need you to copy the desktop file I bundled with this layer to /usr/local/xsessions/exwm.desktop, that’s what I used on my Ubuntu box, but make sure the exwm-start script is in your PATH, you can put it in /usr/local/bin/exwm-start and that should be enough, next time you log out, select the EXWM session instead of the Ubuntu one and you should be alright.

Not having Display Managers

If you use Arch, Gentoo, or any other Linux, most probably you’ll start your configurations via a .xinitrc file, just append exwm-start to the end of that file and you should be fine. I do recommend to check the EXWM Wiki for more details.


If you are an OSX user, please report back on whether this works with xQuartz, always back up your data before attempting to try stuff like this.


Configurable support for optional EXWM features:

  • System Tray

The following features are preconfigured/provided on top of EXWM:

  • EXWM buffer names are prefixed with a configurable prefix (default: X:), to aid buffer selection in ivy/helm.
  • Limited Support for XDG autostart applications in ~/.config/autostart~ (does not support any advanced .desktop file entries, does not take into account system-wide share/applications/autostart files)
  • Session locking with specified lock command
  • Support for D-Bus based locking (e.g. loginctl lock-session)

Key bindings

Normal State Bindings

Key BindingDescription
i,<down-mouse-X>Switch from normal state to insert state, (similar to EXWM char mode)

Major Mode Bindings

These bindings are accessible via the major mode leader keys when EXWM buffers are focused, but only in normal state. This means that you usually have to get out of insert state with s-ESC first.

Key BindingDescription
SPC m fToggle floating/tiling for current window
SPC m wMove current window to different workspace
SPC m FToggle fullscreen

Global Bindings

As other window managers the s or Super key (Windows Key) is the one that is the prefix to every action. We’ll use a lot of s. These commands work in both normal state and insert state.

Key BindingDescription
s-SPCSpacemacs Leader Key (in insert state)
s-[1 2 3 ... 8 9 0]Switch to workspace [0 … 9]
s-[, s-]Switch to previous/next workspace
s-TABSwitch to last workspace
s-wWorkspace Switch Menu (kinda like micro-state)
s-ESCSwitch to normal state, cancel fullscreen
s-rApp Launcher
s-pauseLock Screen
s-<return>Open (X-)Terminal
s-u,UUndo, Redo window configurations
s-bSelect and switch to buffer
s-qClose current buffer
s-h,j,k,lSwitch to left,lower,upper,right window
s-H,J,K,LMove window to far left,down,lower,upper,right
M-s-h,j,k,lResizing (try them, it’s too hard to explain)
s-mToggle maximized buffer
s-dToggle exwm debug mode (for development)

Since running programs is one of the more common task, some explicit support is provided for that via the leader key SPC &.

For these commands as well as for s-r the working directory is set to the value of user-home-directory for the started process.

Key BindingDescription
SPC & sAsk for program to run in separate window below current window
SPC & vAsk for program to run in separate window to the right of current window.

This layer overrides the leader bindings on SPC F, which are tricky with EXWM anyways, and replaces them with the following bindings.

Key BindingDescription
SPC F rReset state of current window (exwm-reset)
SPC F hHide floating window
SPC F w wPrompt for workspace and switch to it
SPC F w aAdd new workspace
SPC F w dDelete current workspace
SPC F w mMove Workspace to different position
SPC F w sInterchange position of two workspaces
SPC F m dDetach Minibuffer (for autohide enabled)
SPC F m aAttach Minibuffer (for autohide enabled)

Window behaviour regarding char and line mode

In stock Emacs, EXWM uses char mode and line mode to distinguish between using the keyboard to control an application vs. using the keyboard to control the application’s buffer. Since Spacemacs pursues a different concept regarding keybindings SpacemacsOS handles this differently:

  • EXWM buffers are used in line mode, all local key bindings are removed per default. This corresponds to Spacemacs insert state.
  • The command exwm/enter-normal-state (default binding s-ESC) enters EXWM’s input passthrough mode, meaning that all key-presses are sent to Spacemacs, and not the application. This corresponds to Spacemacs normal state.

Known Limitations

(3rd party research welcome…)

  • s-SPC m does not work for accessing major mode bindings
  • When clicking into a buffer in normal state to press something, it has to be clicked twice, because the first click only gets you into insert state
  • In some cases, the Emacs GUI becomes completely unresponsive if an X window was opened by Emacs’ foreground command loop, e.g. when emacs starts an waits for the return of an interactive graphical password entry dialog. To get it to respond again, switch to a text console and send the SIGUSR2 signal (e.g. pkill -USR2 emacs).
  • Under certain conditions, an EXWM buffer may end up in a state where Emacs wants to insert into the underlying buffer, and pressing i does not get you into insert state. If that happens, use s-ESC to get to line mode/normal state, where you should be able to use i to to get into insert state again.
You can’t perform that action at this time.