summaryrefslogtreecommitdiffhomepage
path: root/tech/xahkeys.mdwn
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-11-08 00:00:30 -0700
committerSean Whitton <spwhitton@spwhitton.name>2015-11-08 00:00:30 -0700
commit1a8a0b9648f45795c850852d7941c68f9896942d (patch)
tree27c8a4db89be5ee8afcdbfb4044f1e6fb2ec7967 /tech/xahkeys.mdwn
parentd6ca7a1ffe238e7dac54ea2456f279bd77c2f809 (diff)
downloadwiki-1a8a0b9648f45795c850852d7941c68f9896942d.tar.gz
import tech/xahkeys
Diffstat (limited to 'tech/xahkeys.mdwn')
-rw-r--r--tech/xahkeys.mdwn167
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
+============
+
+s-&lt;left&gt;/&lt;right&gt;
+: Tile window to left or right of screen, Windows 7 AeroSnap style
+
+s-&lt;up&gt;
+: Maximise window
+
+s-&lt;down&gt;
+: Minimise window
+
+s-l
+: lock screen
+
+C-M-&lt;arrow&gt;
+: Move to a different workspace
+
+C-M-S-&lt;arrow&gt;
+: 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:
+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](https://github.com/spwhitton/dotfiles/blob/master/.xbindkeysrc),
+ and here is [my run-or-raise
+ script](https://github.com/spwhitton/dotfiles/blob/master/bin/xlaunch).
+ If you're just starting out, you should probably try something like
+ [jumpapp](https://github.com/mkropat/jumpapp).
+
+Microsoft Windows
+-----------------
+
+The keys for AeroSnap, maximise, minimise and screen lock are built into
+Windows.
+
+### Run-or-raise bindings
+
+See [my AutoHotKey
+script](https://github.com/spwhitton/dotfiles/blob/master/bin/sariulahk.ahk)
+for my methodology. It's quite specific as it hardcodes a bunch of paths
+I use at work; please see [the
+article](http://lifehacker.com/5468862/create-a-shortcut-key-for-restoring-a-specific-window)
+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
+reference](https://technet.microsoft.com/en-us/library/cc957204.aspx))
+
+### Workspaces
+
+Install [VirtuaWin](http://virtuawin.sourceforge.net/) and configure the
+above bindings graphically.
+
+Rationale
+=========
+
+Tiling window managers such as [dwm](http://dwm.suckless.org/) 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
+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](http://xahlee.info/linux/why_tiling_window_manager_sucks.html)
+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](https://stumpwm.github.io/).
+
+Notes
+=====
+
+[^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](http://emacswiki.org/emacs/OneOnOneEmacs) and a more recent
+ package is
+ [frames-only-mode](http://compsoc.man.ac.uk/~shep/tearing-out-the-emacs-window-manager.html).
+ 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.