Actually, the default spectrwm.conf works pretty well, apart perhaps from changing the Mod key. It’s easy to try out changes on the fly; just edit the file with the help of the man page and test it with Mod+q. If you make a mistake Spectrwm will tell you by printing an error message in the bar.
Just one caution: some mistakes may prevent spectrwm (and therefore X) from starting, so be careful about using Mod+Shift+q. If that happens you will have to edit .spectrwm.conf without using X. This doesn’t apply to Mod+q.
Note: to improve readability I mostly don’t show unused (commented out) options. See the man page for these.
# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE #
# Mod key, (Windows key is Mod4) (Apple key on OSX is Mod2)
modkey = Mod4
# Workspaces and Layout
workspace_limit = 5 # I don’t need more than this.
# Changes to Defaults
# The next two entries replace the default Mod+Space. Why? By default, this command cycles between the different layouts (vertical, horizontal, full screen). I seldom need to do this whereas I very frequently need to alternate the focus between main and stack. So I set Mod+Space to toggle focus_main and use Mod+c to cycle the layout.
bind[focus_main] = Mod+space
bind[cycle_layout] = Mod+c
# Other (minor) changes to defaults
bind = Mod+Shift+Delete # I don’t need to lock the screen and I want to avoid doing so accidentally, so disable the default.
bind[flip_layout] = Mod+r # default binding doesn’t work on my keyboard.
# Window Decoration
border_width = 2
color_focus = red
color_unfocus = blue
tile_gap = 2
disable_border = 1 # Remove window border when bar is disabled and there is only one window in workspace
# Bar Settings
bar_enabled = 1
bar_border_width = 2
bar_border = yellow
bar_border_unfocus = yellow
bar_font_color = white
bar_font = -*-courier-*-r-*–*-120-*–*–*-
bar_format = %a %b %d %R +S +F +L +V
bar_at_bottom = 1
bind[bar_toggle_ws] = Mod+b # restrict this to only one workspace
One of the commonest things I do in Spectrwm is swap two windows (Main to Stack or vice versa). This is done instantly with Mod+Return. But a minor annoyance is that the focus doesn’t follow the swap.
Suppose you have two windows open, A in Main and B in Stack, and the focus is on A. After the swap the focus is still on A but this is now in the Stack. I usually want it to be in Main, which now contains B. I can achieve this with Mod+m, which alternates the focus back and forth between the two windows. This is OK but can become annoying if I do it a lot since it’s easy to miss-type the m.
For a time I solved this by setting the pointer focus to “follow” instead of the default, but this wasn’t ideal; it required me to keep the pointer always in the left side of the screen.
The solution I’ve adopted now is to remap Mod+Space (quick and easy to type) to give me focus_main. By default Mod+Space cycles between vertical, horizontal, and full-screen layouts, but I hardly ever need to do this. I’ve mapped Mod+v and Mod+z to give me vertical and horizontal layouts in case I do need to change them; for full-screen I use Mod+e.
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 actively maintained; the most recent version (3.3.1) was released on 25/06/2020, 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 you create occupies the whole screen. Subsequent windows are created in a stacking area on the right. The area on the left of the screen is known as the “master” area.
This isn’t as rigid as it may sound. You can swap the master window with one of the others and you can work in any window you have open, whether it is in the master area or not. You can have more than one window in the master area if you want.
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 (you have to change the “mode”).
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 and I do it a lot. 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 (change the “mode”).
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 and eccentric 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 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. (Actually i3 can do something similar via its scratchpad – see comment below – but it doesn’t work out of the box and has to be set up by the user.)
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.
I’m an enthusiast for tiling window managers. I’ve tried out quite a few over the years, and here I offer my assessment of the four I’ve liked best: spectrwm, i3, xmonad and dwm.
Summary for the impatient
My outright favourite is Spectrwm because I find that it offers all the features I want without making things over-complicated. Configuration via the text file is easy and the commands quickly become intuitive and automatic. Dwm is almost as good as Spectrwm but lacks some features that I want. i3 seems to be a popular WM and is better known than Spectrwm, I like it quite a lot but I find Spectrwm more intuitive to use. Xmonad is an attractive WM but is irretrievably let down by requiring Haskell to configure it. (Detailed comparison of Spectrwm and i3 )
The window managers in more detail
This is currently my favourite. Configuration by a plain text file is simple. I should say that it is the most flexible and intuitive WM that I’ve tried.
Here are some screenshots.
Firefox in master position; two other windows open
Enlarge master window (Mod + L)
Change to horizontal split (Mod + Space)
Make a window fullscreen.(Mod + E)
Switch to Workspace 2 containing xsane (Mod +2 or Mod + R. arrow)
Note: xsane was started from xterm; the xsane windows are floating (set via Quirk in ~/.spectrwm.conf)
I liked i3 quite a lot and used it for a time. Configuration is simple since it is done in a plain text file. In many ways it is similar to Spectrwm but the way the windows are arranged is slightly different. i3 seems to be better known than Spectrwm with a larger following However, having tried out both of them fairly extensively I find I prefer Spectrwm.
This has a large user base and a helpful mailing list. It has many of the features I want and is quite similar to Spectrwm but is let down by its being configured in Haskell, which makes any configuration beyond the most basic a major undertaking requiring hours of research on the internet. There is also a large disk space overhead required to house the libraries needed for said configuration. For these reasons Xmonad loses out to its competitors, at least for me.
Dwm is the forerunner from which many other tiling WMs forked. There is still a lot going for it: it’s simple and functional and easy to learn. Configuration is via C, but don’t be put off; it’s easier than it looks even if you don’t know C (I don’t). If you are not willing to embark on learning Haskell, dwm would be an attractive alternative. If Spectrwn were not available I’d use Dwm.