Software engineering is a game of concentration. If you want to stay "in flow," you need the right information in front of your eyes at the right time. You need to bring it into view quickly, using only muscle memory. If your editor, or debugger, or web browser isn't in sight right when you need it, or if a distracting program like your email reader is visible when you don't need it, you can lose focus.
I remember being amazed by Genera, the operating system of the Symbolics Lisp Machine. Genera made it easy to bring up exactly the program I wanted with a simple key combination of my choosing. On every OS I've used since, I've built up a set of keyboard shortcuts, or "chords," to do the same with programs I use regularly. I've posted this collection on Github as Window Chord.
Here are some example chords I use on Linux:
|Evince (document viewer)
|Nautilus file browser
If my web browser isn't yet running, then ctrl-alt-shift-w starts it. If the browser is already running, but isn't the selected window, the same chord makes it visible and selects it. If the browser is already running and selected, that chord switches to another browser window. So my caveman brain can think "show me web page," and my fingers make the right thing happen instantly. No fiddling with the mouse, no traversing workspaces, no distractions.
I use the ctrl-alt-shift prefix because such chords don't interfere with Emacs [edit: too much]. It's surprisingly easy to hit such a chord without looking, but you can choose simpler chords if you prefer.
Adding a chord for a new program is simple. Here's an example,
#!/bin/bash launch-or-select \ google-chrome \ /opt/google/chrome/chrome \ --enable-dom-distiller \ --remote-debugging-port=9222
launch-or-select program first looks for an X11 window with class
google-chrome. If there isn't one, it starts Chrome using the remaining
command-line arguments, starting with
In many Linux distributions, once you've written something like
launch-or-select-chrome, it's a simple matter to add it as a custom shortcut. For example, in
Pop! OS, which I use on my fantastic System76 Lemur Pro,
Settings > Keyboard > Customize Shortcuts > Custom Shortcuts
> Add Shortcut pops up a dialog box that asks for a name (e.g.
Google Chrome), a command line (e.g.
launch-or-select-chrome), and a key chord (e.g. ctrl-alt-shift-w).
In addition to chords for selecting programs, Window Chord includes a few for positioning windows. So that I don't get distracted worrying about exactly where each window should be, they're simple, leaving little room for fiddling. If you have a bigger monitor, you could easily expand the set. Here they are:
|Fill the left half of the screen.
|Fill the right half of the screen.
|Fill both sides of the screen.
|Hide the window.
|Hide other windows in the same program.
Even if you prefer a window manager that places windows for you, the
launch-or-select programs above can be useful. I prefer to do placement myself. A
simple left-half/right-half system requires almost no attention, but
doesn't lead to distracting surprises, either.
To use Window Chord, put all of its programs somewhere on your
$PATH, then install Chibi Scheme, an excellent implementation of Scheme
written by Alex Shinn, as well as
xdotool, which are low-level command-line programs for manipulating X11
I wish you all maximum productivity and minimum distractions.
Edit on Tue 26 Jul 2022: I got a vertical monitor and extended Window Chord to make good use of it. I also added commands to the tables above.
- Chibi Scheme, by Alex Shinn
- I'm using version 0.10.0.
- wmctrl, by Tomas Styblo
- I'm using version 1.07.
- xdotool, by Jordan Sissel
- I'm using version 3.20160805.1.
Symbolics Lisp machine keyboard photo
This project is licensed under the MIT License except where otherwise noted.
You might also like Ecky Putrady's Using xdotool as a Tiling Window Solution.