path: root/tech/xahkeys.mdwn
diff options
authorSean Whitton <>2015-11-08 00:00:30 -0700
committerSean Whitton <>2015-11-08 00:00:30 -0700
commit1a8a0b9648f45795c850852d7941c68f9896942d (patch)
tree27c8a4db89be5ee8afcdbfb4044f1e6fb2ec7967 /tech/xahkeys.mdwn
parentd6ca7a1ffe238e7dac54ea2456f279bd77c2f809 (diff)
import tech/xahkeys
Diffstat (limited to 'tech/xahkeys.mdwn')
1 files changed, 167 insertions, 0 deletions
diff --git a/tech/xahkeys.mdwn b/tech/xahkeys.mdwn
new file mode 100644
index 0000000..bc2fe4f
--- /dev/null
+++ b/tech/xahkeys.mdwn
@@ -0,0 +1,167 @@
+[[!meta title="Cross-platform window management key bindings for Emacs users" updated="2015-06-10"]]
+I have figured out a set of window management key bindings which can be
+implemented under both X11 on GNU/Linux systems and Microsoft Windows.
+This lets you have
+- **run-or-raise keys** for your most commonly used programs (that is:
+ press one key to either launch the program or switch to its window);
+- **AeroSnap-style tiling**;
+- **focus-follow-mouse** and
+- **workspaces**
+... all with **the same bindings** on your GNU/Linux machine and your
+Windows machine.
+I find that this means I don't need a complicated and fragile tiling
+window manager configuration that I can't use on Windows and that
+doesn't work very well with Emacs anyway. See the
+[rationale](#rationale) for more.
+*Terminological note:* When I say 'window' I mean what most people think
+of as a window, that is, what Emacs users generally call a 'frame'.
+The bindings
+: Tile window to left or right of screen, Windows 7 AeroSnap style
+: Maximise window
+: Minimise window
+: lock screen
+: Move to a different workspace
+: Move current window to a different workspace
+: Switch to Emacs
+: Switch to terminal
+: Kill current window
+: Switch to web browser
+S-F{9, ..., 12}
+: Switch to other frequently used applications
+Setting up the bindings
+For now these are just rough notes; how you implement the bindings is up
+to you. The important thing is that the bindings really do work
+X11 (e.g. GNU/Linux)
+There are numerous ways to do this. Here is how I do it:
+1. Set up the AeroSnap, maximise, minimise, screen lock and workspace
+ bindings using my window manager's configuration dialogue (in my
+ case, XFCE's window manager Xfwm).
+2. Bind the remaining keys with xbindkeys: here is my [xbindkeys
+ configuration
+ file](,
+ and here is [my run-or-raise
+ script](
+ If you're just starting out, you should probably try something like
+ [jumpapp](
+Microsoft Windows
+The keys for AeroSnap, maximise, minimise and screen lock are built into
+### Run-or-raise bindings
+See [my AutoHotKey
+for my methodology. It's quite specific as it hardcodes a bunch of paths
+I use at work; please see [the
+whose code I started from.
+### focus-follow-mouse
+Open the registry editor and go to the key `HKCU\Control
+Panel\Desktop\UserPreferencesMask`. Set the first bit to 1 and the
+seventh bit to 0. ([MSDN
+### Workspaces
+Install [VirtuaWin]( and configure the
+above bindings graphically.
+Tiling window managers such as [dwm]( try to
+make window management smoother and more automatic. They do this by
+arranging windows automatically for the user, and by binding keys that
+let the user switch between windows, open new windows and control the
+tiling without thinking too much about it. The user is freed up to
+concentrate more on the contents of their windows.
+Unfortunately, Emacs doesn't fit naturally into a tiling window manager
+workflow. Emacs windows generally need to be fullscreen because lots of
+features of Emacs split the window into two. Due to this splitting, and
+unlike other text-based software such as programs made with ncurses,
+Emacs windows respond poorly to being shrunk and enlarged at regular
+intervals by the tiling window manager.[^1]
+A second problem for Emacs users is that Emacs is cross-platform, but
+tiling window managers aren't. If Emacs is the centre of your workflow
+and you use it on more than one operating system, you need your window
+management bindings and behaviour to work the same on the different OSs.
+Using a tiling window manager on GNU/Linux with Emacs carefully
+integrated---see the footnote to the previous paragraph---but then
+losing this functionality when switching to Microsoft Windows is
+The key bindings described in this document give you some of the
+benefits of heavily customised tiling window managers without tying your
+window management workflow to a particular operating system and without
+trying to squash Emacs into a window management philosophy it is not
+suited for.
+Personal background
+I tried a succession of different tiling window managers when vim was my
+editor, but I stopped using them after I switched to Emacs and found
+after a time that I didn't need all those terminal windows I used to
+have open. I then came across [this
+by Xah Lee who argues that run-or-raise bindings are all that you really
+need. I also had to start using Microsoft Windows 7 at work and found
+that AeroSnap provides enough tiling for most purposes, if you give
+yourself workspaces. Many people have written about the benefits of
+run-or-raise shortcuts, which I first used under
+[^1]: There have been attempts to make Emacs always open new windows
+ instead of splitting its windows. An older and more complicated
+ setup is [One On One
+ Emacs]( and a more recent
+ package is
+ [frames-only-mode](
+ The author of the latter tells me, to my surprise, that he doesn't
+ find himself constantly needing to tweak his Emacs configuration to
+ stop cranky Emacs features he brings into use splitting windows
+ instead of making new ones.