“spectrwm is a small dynamic tiling window manager for Xorg. It tries to stay out of the way so that valuable screen real estate can be used for much more important stuff. It has sane defaults and does not require one to learn a language to do any configuration. It was written by hackers for hackers and it strives to be small, compact and fast.”

Spectrwm is written in C and configured with a text configuration file. It was previously known as scrotwm.

Installation

The modkey (the main key to issue commands with) is set to Mod4, which is usually the Windows key.

spectrwm can make use of the dmenu package, so you may want to install that too.

It can also execute a screenshot command from a keybinding which may be used to call scrot using the script given below.

There is also a screen lock keybinding. By default calls xlock, provided in Arch by the xlockmore package.

xscreensaver is also useful for screen saving and power management after an idle period, and screen locking.

See Xdefaults for details of how to set up fonts, colours and other settings for xterm and xscreensaver. Run xscreensaver-demo to select the animation (or blank) and display power management (recommended).

Configuration

spectrwm first tries to open the user specific file, ~/.spectrwm.conf. If that file is unavailable, it tries to open the global configuration file, /etc/spectrwm.conf. The initial configuration provides a good set of defaults.

Optionally, spectrwm can call baraction.sh (in the user's path), which should output a text status message to stdout for the status bar at the top of the screen.

Starting spectrwm

To start spectrwm via startx or the SLIM login manager, simply append the following to ~/.xinitrc:

exec spectrwm

Starting spectrwm with XDM

Note: if you do not create ~/.xsession then ~/.xinitrc will be used, but you might want different settings depending on if you use startx or XDM. Remember to make ~/.xinitrc executable, or XDM won't start, if you use that method.

Starting spectrwm with KDM

For KDM, make sure /usr/share/xsessions is listed in SessionDirs in /usr/share/config/kdm/kdmrc as described here. SpectrWM will then be available as an option in the Session Type menu in KDM.

To start other tasks when the session is launched, for example to launch xscreensaver and set the background image, copy /usr/share/config/kdm/Xsession to a custom version as
described here, and then edit it, for example like this:

Press Modkey+Q to restart spectrwm and after a few seconds you should see the output in the status bar. If you have problems at this stage, make sure the script is executable, test it from the command line, and check the path/filename you specified in bar_action.

Next replace baraction.sh with the more useful file below. Note it needs these packages, and whatever you need for WiFi:

Note: You may need to modify this script slightly for your computer. You may have different units in the acpi battery info, different temperature output from sensors or a different wifi interface than wlan0.

Here are some other ideas for status bar items : ethernet, email notification, disk space, mounts, now playing (mpc current).

The baraction.sh script may also show the date, in which case the built-in clock can be disabled:

clock_enabled = 0

Conky

Instead of a bash script, conky may be used. It should be used in non-graphical mode as shown below to output a text string to stdout which can be read in by spectrwm. First install conky.
It is not necessary to install the cut-down "conky-cli" from AUR (although that would work too).

Alternative status bar

An alternative is to use dzen2 to create a status bar. This has the advantage that colors and even icons may be used, but the disadvantage that the bar is not integrated with spectrwm. So the current workspace number and layout and the bar-toggle keybinding are not available. The "region" option can be used to reserve the required screen space.
For example to reserve 14 pixels at the top of the screen in spectrwm.conf change

Screenshots

Spectrwm has the facility to execute a script called screenshot.sh with the keybindings

Meta+s for a full screenshot
Meta+Shift+s for a screenshot of a single window

First install scrot
Then copy the default script supplied in the spectrwm package to a location in your $PATH, for example:

$ cp /usr/share/spectrwm/screenshot.sh ~/bin

Screen locking

By default the lock keybinding (Mod+Shift+Delete) executes xlock

program[lock] = xlock

An alternative, if xscreensaver is already running, is to use

program[lock] = xscreensaver-command -lock

Using spectrwm

To save space, window title bars are not shown. Window borders are one pixel wide. The border changes colour to indicate focus.

Layouts are handled dynamically and can be changed on the fly. There are three standard layouts (stacking algorithms): vertical, horizontal and maximized (indicated in the status bar as [|], [-] and [ ])

There is the concept of a master area (a working area). Any window can be switched to become the master and will then be shown in the master area. The master area is the left (top) portion of the screen in vertical (horizontal) mode. The size of the master area can be adjusted with the keys. By default the master area holds one window, but this can be increased.

The area excluding the master area is called the stacking area. New windows are added to the stacking area. By default the stacking area has one column (row) in vertical (horizontal) mode, but his can be increased.

Windows may be moved to a floating layer -- i.e. removed from the tiling management. This is useful for programs which are not suitable for tiling.

Meta+,/. : increase/decrease the number of windows in master area (default is 1)
Meta+Shift+,/. : increase/decrease number of columns(rows) in stacking area in vertical(horizontal) mode (default is 1)
Meta+Shift+j/k: swap window position with next/previous window
Meta+t: float<->tile toggle