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

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

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

s-<left>/<right> Tile window to left or right of screen, Windows 7 AeroSnap style s-<up> Maximise window s-<down> Minimise window s-l lock screen C-M-<arrow> Move to a different workspace C-M-S-<arrow> Move current window to a different workspace F9 Switch to Emacs F10 Switch to terminal F11 Kill current window F12 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 cross-platform.

X11 (e.g. GNU/Linux)

There are numerous ways to do this. Here is how I do it:

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

Run-or-raise bindings

See my AutoHotKey script for my methodology. It’s quite specific as it hardcodes a bunch of paths I use at work; please see the article whose code I started from.

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

Workspaces

Install VirtuaWin and configure the above bindings graphically.

Rationale

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.

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.

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

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 article 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 StumpWM.