Working on a Thinkpad keyboard is pure bliss. The Trackpoint lets me point (and scroll!) without moving my wrists; within Emacs/screen, even it is superfluous. Being able to immediately act on one's intentions is an important factor in attaining a state of flow, and there is a huge psychological difference between being able to do something "now" and "wait, hang on for 500ms so I can reach the touchpad." When I'm really in the zone, I can actually notice my concentration dissipating if I need to reach for the arrow keys, or worse, the mouse or touchpad (this is hard to explain to people who don't use Emacs or Vim!).
But window managers are still awful
Yet, even if I'm using Emacs and/or a web browser 90% of the time, and even supposing they left nothing to be desired, there's another program I have to interact with near 100% of the time: the window manager.
It's a shame, but few of the usability lessons we learned over the years made it to any of the common window managers— Windows, Mac, or Metacity. The window manager acts an intermediary sitting between the user and every single app, but WM functions are often marginalized and too hard to activate. This is especially unfortunate, because now that huge monitors are commonplace, we actually need better WMs to help us effectively use that screen space— maximize and minimize alone don't cut it anymore! (Jeff Atwood pointed this out all the way back in 2007.)
How can we do better? Well, what does "better" even mean? Here are the assumptions I'm operating under, about what kinds of operations are easy or hard to perform:
- "Reaching is hard": reaching touch-typeable keys is easier than reaching the function keys (F1 … F12), the arrow keys, or the numpad.
- "Pointing is hard": typing a small number of keystrokes is easier than using the mouse (or any other pointing device).
- "Fitts's law": pointing at a large target with the mouse (e.g. a window) is easier than pointing at a small target (e.g. an icon, menu, button, border, or title bar).
You may be able to see where the problems are. Windows and Metacity map a bunch of window management functions to far-away placed keys like Alt+F4 and Alt+F10. Mac OS has better bindings for some functions, but doesn't map Maximize at all by default, instead providing access via itty-bitty buttons on each window. On both Windows and Mac OS, the fastest way to move (or resize) a window is by dragging it by its title bar (or resize handle). It doesn't get any worse than that.
Dragging resize handles… seriously? Fitts's law, anyone? This is nonsense.
This is the main reason that I can only use Windows or Mac OS for about 30 seconds before my blood pressure starts to go up. They are not usable. Having to fish around with the pointer every time you want to do something is also a great way to develop RSI.
Building a better WM
I've played around with a few scattered ideas with the goal of making a better WM for myself. I've implemented these in my Openbox config, although any reasonably configurable WM will do.
But, I would like to stress here, the details are unimportant. If you can find the parts of your workflow that are unnecessarily slow, and eliminate them, more power to you.
1. Manage windows and workspaces with shortcuts that don't require function keys or arrow keys. For example, Alt+F10 (maximize a window) and Ctrl+Alt+LeftArrow (switch workspaces) are out. In my setup they are replaced by Win+1 and Win+j, respectively.
2. Move and resize windows with alt-dragging (actually, Win-key dragging). When you want to move or resize the window, the entire window is your drag target. No need to aim for the title bar, or the resize handle, or the window border. Fitts's law, suckers.
To move windows: point at the window, hold down Win, and drag with the left mouse button. To resize windows: point at the window anywhere near the corner you want to move, hold down Win, and drag with the right mouse button.
Kudos to Metacity (and most other X WMs) for shipping with something similar by default.
3. Arrange windows using the keyboard.
It took me the longest time to realize that this was something that would actually be useful.
Most people only have a couple of common ways they like to arrange windows on the screen— for example, one window filling the entire screen, or two half-width windows side by side. What this means is that in the common case, you are really not asking for windows to be placed at specific pixel positions on your screen. Hence, the mouse isn't actually needed.
I use a couple of different window management "idioms," which are probably best illustrated by example:
-
Win+s i j k RET, for example expands the current window until it meets the nearest edge to the north, west, and south. Before and after:
Win+s activates window-expanding and i, j, k, and l indicate north, west, south, and east, respectively.
-
Win+s Win+s means "expand the current window as much as possible without covering anything else," which seems like a common thing to want. Before and after:
Openbox's smart window placement policy attempts to place a second window within the space left by the first one. So a quick Win+s Win+s makes a second window neatly fill up all the space left unused by the first one!
For more complex arrangements, it's very fast to drag a window to an approximate location (see alt-dragging, above), then use Win+s Win+s to make it neatly fill the available space.
-
Win+w is analagous to Win+s except that it moves a window to the nearest edge to the north/west/south/east instead of resizing it.
An alternative strategy is to bind keys to move windows to a small number of fixed "slots," such as the two halves of a screen. Jeff Atwood mentions this strategy and its implementation in WinSplit Revolution.
4. Configure single-key shortcuts for launching common apps. For example, Win+b for a web browser. Not always a window-manager responsibility, but it can really streamline one's work.
Conclusion
Although I am still experimenting with some aspects of this setup, I am fairly happy with it. For better or for worse it does feel a lot like a "normal" window manager, just one that is highly streamlined (and doesn't give me hypertension). I'd be curious to see what additional improvements can be gained by giving up some of the associated flexibility and moving to a more restrictive model (e.g. something like a tiling WM).
For the curious, I've posted Openbox configuration recipes for tips 2 and 3 here.
I'm a huge fan of tiling window managers. I've been using Awesome for a little over a year now, and I love it. Automatic tiling means that 80% of the time, your windows will do exactly what you want without any intervention, and a wide array of keybindings (and customizability) means that the remaining 20% is easily handled without straying far from the home row.
ReplyDeleteThanks for the tip. I tried StumpWM some time ago, and didn't love it, but I've been hearing good things about Awesome.
ReplyDeleteThought you might find my setup somewhat interesting. Most x-based wm's provide for multiple desktops. In a normal session, I am generally, managing a large number of servers in our cluster, my dev environment (several dedicated terminals either locally or remote, with emacs as the workhorse), several design documents open, music + im, sometimes some other stuff.
ReplyDeleteAnyhow, I find that leveraging (5) virtual desktops has allowed me to organize my work intuitively in 'space'. I bind keyboard shortcuts to all the virtual desktops and also to 'desktop to the right' and 'desktop to the left'. You get a sense of where things are in this 'space' after a while. So, if I want to manage my master database server, for example, and I'm currently editing a document, I just go one desktop to the right. Within a desktop, to get from window to window, of course I just use alt-tab.
To sum up, I don't like window clutter, and have solved the problem by positioning different types of tasks/concerns in alternative spaces, which seems to reduce complexity quite a bit, and takes advantage of the fact that our minds (at least mine) pick up on the notion of where things are in space...I really don't have to think about it at this point. Finally, I can do all this on my laptop screen itself, which is 1400x1050 (thinkpad).
Btw, I enjoy your blog, so keep it coming.
That's a good idea. I sometimes set aside separate workspaces for different major tasks. It is really nice because you end up with a *predictable* way to return to a particular window.
ReplyDeleteHowever, everything always slowly seems to drift back to the workspace that has my web browser in it, so maybe I am doing something wrong. :P
great thread, thanks phil. i love this topic. i've been using a mac laptop + x11 for the last eight years and my flow is still not on par with when i was using a linux desktop with customized window mgr before that. i'm a big fan of the cardinal directions and would love to get back to using them.
ReplyDeletenowadays i spend a lot of time in a full screen urxvt+screen+emacs so it's not so bad, but it drives me nuts that i have not been able to improve my flow outside of that (except for launching, where quicksilver excels). last time i checked using a window mgr besides xquartz caused more problems than it solved, which is a bummer. might be time to try again tho.
Maybe you will like this stumpwm demo: http://www.youtube.com/watch?v=tKt_rVO960Q
ReplyDeleteLike Anon, I dedicate different workspaces for different tasks, and even named them so in Workspace Switcher preferences. (emacs,xterm,math,chromium,firefox, if you were curious.)
ReplyDeleteI notice that you, like me, have no use for the ability to litter your desktop with icons.
everything always slowly seems to drift back to the workspace that has my web browser in it
At work I borrowed a second monitor, and have made the browser Always on Visible Workspace. So when I Ctrl-Left and Ctrl-Right to get around, it's only to play with the first monitor.
With Compiz one can have different backgrounds with different workspaces. I feel like I should be able to use that to help me remember what I'm "supposed" to be doing on a given workspaces, like naming them did. (Like in Disneyland, where the pavement color tells you which land you're in.) If you use this Compiz feature you can't have icons on your desktop, but I was okay with that.
@phil - re everything drifts back to the window where the web browser is...yeah...you are right that this does tend to happen to me as well. in my setup, which i describe above, there are certain things that are always in certain places, and certain things that come with me depending on what i am currently working on most. my web browser actually follows me, along with IM for the most part.
ReplyDelete@Dmitry: thanks! I will have to look more closely at StumpWM. Glad to see that it apparently handles gnome-panel well (I seem to recall having issues with this in the past).
ReplyDelete@_marks, Allen, Anonymous: thanks for sharing your perspectives.
I noticed that I use multiple workspaces far less than I used to, in part because almost all of my work these days happens within two windows: Chrome (mail and many other apps) or screen (emacs, shell). These programs sort of come with their own window/app management functionality, which I suppose is sometimes good and sometimes bad.
BTW while your "maximize this window to take up half the screen" sounds like a good idea, I realized that I had just done this by making my emacs and xterm buttons on the Gnome panel include a --geometry putting emacs in the left half, xterm in the right.
ReplyDeleteNow that I'm playing with two monitors, I've gone down to three (double) workspaces from five.
I am a Fluxbox fan since I used it for the first time in a virtual machine in my Macbook. As soon as I bought my netbook, I installed Fluxbox on it... and it works wonders.
ReplyDeleteCheers,
Ruben