My favourite window manager is Spectrwm but with its default setting I get a minor annoyance in relation to window focusing.
Suppose you have Window A in Main and Window B in Stack and the focus is on Window A. You now swap these two windows with Mod+Return, so that Window A is in the Stack and Window B is in Main. With the default setting the focus is still on Window A but I usually want it to be on Window B, in Main.
Of course, I can easily achieve this with Mod+m, but I find it irritating to have to do this each time I switch windows, which I do very frequently. In dwm the problem doesn’t arise and I was seriously thinking of changing to dwm for this reason. But Spectrwm has so many features I like that this wasn’t really an option.
The solution, as so often, was RTFM. The man page says that setting “focus mode” to “follow” does this:
Set window focus on all cursor border crossings,
including workspace switches and changes to layout.
This gives me the behaviour I want. The cursor is normally in the window I’m working in (Window A initially in this case). When I swap the windows the cursor is still Main, which now contains Window B, and the focus follows it. Simple, really.
However, this creates a problem. Mod+Space cycles between three different layouts one of which is layout_max, but when I access this the display flickers. As I don’t need layout_max (I can use Mod+e for this) I unbind Mod+Space to prevent that layout being accessed accidentally; I bind Mod+v for vertical layout and Mod+z for horizontal layout. Here are the relevant entries in the configuration file.
bind = Mod+space # unbind mod + Space
bind[layout_vertical] = Mod+v
bind[layout_horizontal] = Mod+z
Note: For this to work, the pointer must be in the window you want the focus to be in (on the left of the sceeen, i.e. in Main). Just occasionally I still get a flicker, e.g. if starting Firefox from dmenu); to stop this, use Mod+q.
I’ve long heen an enthusiast for tiling window managers and have blogged about them previously. I last used i3 a number of years ago (perhaps version 4.11). At that time I said that I liked it but preferred Spectrwm. Now i3 is at version.4.6 and its popularity seems to be expanding, so I thought it was time to give it a fresh look to see whether I still prefer Spectrwm. I find I do although i3 is certainly impressive.
Here I summarise what seem to me to be the main differences between the two WMs. Obviously this is a subjective comparison but I shall give the reasons for my preferences.
Community and support
Here i3 has the clear advantage. It has a large user base and lots of online support (mailing list, IRC etc.), which makes it easy for newcomers to get help.
For Spectrwm this element is pretty much lacking. It has good documentation but there isn’t an online community of the kind that i3 enjoys. But it is still maintained; the most recent version (3.2.0) was released in Sept. 2018, and you can chat with the developers at OFTC channel #spectrwm.
The main way in which the two WMs differ is in how they arrange their tiled windows (both offer floating windows if wanted.)
Spectrwm is similar to Dwm and Xmonad. The first window appears in the ‘master’ area on the left of the screen; subsequent windows are created in a stacking area on the right.
This isn’t as rigid as it may sound. You can work in any window you have open, whether it is in the master area or not.
i3 doesn’t have the concept of a master area. It places its windows either side by side (horizontally) or one above the other (vertically). All the windows are of equal status.
Each of these methods has its advantages and disadvantages.
i3 can produce more complex patterns than Spectrwm; you can mix vertical and horizontal windows in the same workspace, as shown above. Spectrwm can’t do this; the windows are either horizontal or vertical but not both in the same workspace.
However, in i3 you have to decide which layout, horizontal or vertical, to use before you create a new window, and as far as I know you can’t alter this later without deleting and recreating the windows concerned. In Spectrwm you can alternate between these layouts on the fly with Mod + Space.
In practice I hardly ever need the complexity that i3 offers because I seldom have more than two or three windows open in any one workspace. On the other hand I prefer the working window to be on the left of the screen; this is easy to achieve in Spectrwm, simply by swapping the stacked and master windows with Mod + Return. Swapping two windows is possible in i3 but more complicated.
Altering the size of the windows
In Spectrwm you can increase or decrease the size of the master area by pressing Mod + l or Mod + h. I find this extremely useful. In i3 you are encouraged to use the mouse to alter the size of windows, which is quite fiddly. I prefer to use the keyboard whenever possible; there is a way of doing this in i3 but it’s not very straightforward.
A peculiarity of i3 is that instead of using the vi key bindings (hjkl) for movement it uses jkl; by default. This annoys me . You can of course change it, but then you have to find an alternative for Mod + h which by default is used to set the horizontal window layout. This seems an unnecessary complication.
As far as I can see, all the commands that i3 offers are also present in Spectrwm apart from those that are i3-specific . On the other hand, a useful feature of Spectrwm that I don’t think is present in i3 is the option to “iconify” a process, which means that it is no longer on-screen but doesn’t stop working. For example, suppose you start mplayer or mpv in an xterm to play some music. If you iconify the window the music will continue playing. When it finishes or if you want a different piece you simply un-iconify the window to make the changes. This command is also useful if you want to start a second browser temporarily or compile a large program.
As you can see, for me Spectrwm comes out on top for all comparisons except community support.
Making this analysis of the differences between i3 and Spectrwm has been a useful exercise. It’s shown me why I prefer Spectrwm. But I don’t want to knock i3; it’s an excellent tiling WM and deciding which is better comes down to personal preference and priorities. Newcomers to the world of tiling WMs would probably find it easier to use i3 initially because it allows for more hand-holding. But even if that’s your case I’d suggest trying Spectrwm later as well.
Fortunately experimentation is easy. Both i3 and Spectrwm work well out of the box with their default settings; perhaps the only immediate change that may be needed is to assign the Windows key (Mod4) as modifier in place of Alt (i3 has a wizard which offers you this choice as part of its setup process.) Anyway, both have configuration via plain text files so there is no need to learn a new programming language in order to configure them.