SPECTRWM(1)

NAME
spectrwm - window manager for X11

SYNOPSIS
spectrwm

DESCRIPTION
spectrwm is a minimalistic window manager that 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.

When spectrwm starts up, it reads settings from its configuration file, spectrwm.conf. See the CONFIGURATION FILES section below.

The following notation is used throughout this page:

M   Meta
S   Shift
<Name>
    Named key
M1  Mouse button 1
M3  Mouse button 3

spectrwm is very simple in its use. Most of the actions are initiated via key or mouse bindings. See the BINDINGS section below for defaults and customizations.

CONFIGURATION FILES
spectrwm first tries to open the user specific file, ~/.spectrwm.conf. If that file is unavailable, it then tries to open the global configuration file /etc/spectrwm.conf.

The format of the file is keyword = setting. For example:

    color_focus = red

Enabling or disabling an option is done by using 1 or 0 respectively.

The file supports the following keywords:

autorun
    Launch an application in a specified workspace at start-of-day. Defined in the format ws[<idx>]:application, e.g. ws[2]:xterm launches an xterm in workspace 2.

bar_action
    External script that populates additional information in the status bar, such as battery life.

bar_at_bottom
    Place the statusbar at the bottom of each region instead of the top.

bar_border[x]
    Color of the status bar border in screen x.

bar_border_width
    Set status bar border thickness in pixels. Disable border by setting to 0.

bar_color[x]
    Color of the status bar window in screen x.

bar_delay
    Update frequency, in seconds, of external script that populates the status bar.

bar_enabled
    Enable or disable status bar.

bar_font
    Status bar font.

bar_font_color[x]
    Color of the font in status bar in screen x.

bar_format
    Set the bar_format string and overrides clock_format and all of the enabled options. The format is passed through strftime(3) before being used. It may contain the following character sequences:
    Character sequence | Replaced with
    +< | Pad with a space
    +A | Output of the external script
    +C | Window class
    +D | Workspace name
    +F | Floating indicator
    +I | Workspace index
    +N | Screen number
    +P | Window class and title separated by a colon
    +S | Stacking algorithm
    +T | Window title
    +U | Urgency hint
    +V | Program version
    +W | Window name
    ++ | A literal ‘+’

    All character sequences may limit its output to a specific length, for example +64A. Any characters that don't match the specification are copied as-is.

bar_justify
    Justify the status bar text. Possible values are left, center, and right.

    Note that if the output is not left justified, it may not be properly aligned in some circumstances, due to the white-spaces in the default static format. See the bar_format option for more details.

bind[x]
    Bind key combo to action x. See the BINDINGS section below.

border_width
    Set window border thickness in pixels. Disable all borders by setting to 0.

clock_enabled
    Enable or disable displaying the clock in the status bar. Disable by setting to 0 so a custom clock could be used in the bar_action script.

color_focus
    Border color of the currently focussed window.

color_unfocus
    Border color of unfocussed windows.

dialog_ratio
    Some applications have dialogue windows that are too small to be useful. This ratio is the screen size to what they will be resized. For example, 0.6 is 60% of the physical screen size.

disable_border
    Remove border when bar is disabled and there is only one window on the screen.

focus_close
    Window to put focus when the focused window is closed. Possible values are first, next, previous (default) and last. next and previous are relative to the window that is closed.

focus_close_wrap
    Whether to allow the focus to jump to the last window when the first window is closed or vice versa. Disable by setting to 0.

focus_default
    Window to put focus when no window has been focused. Possible values are first and last (default).

focus_mode
    Using a value of follow_cursor will make the window manager focus the window under the mouse when switching workspaces and creating windows.

keyboard_mapping
    Clear all key bindings and load new key bindings from the specified file. This allows you to load pre-defined key bindings for your keyboard layout. See the KEYBOARD MAPPING FILES section below for a list of keyboard mapping files that have been provided for several keyboard layouts.

layout
    Select layout to use at start-of-day. Defined in the format ws[idx]:master_grow:master_add:stack_inc:layout:always_raise:stack_mode, e.g. ws[2]:-4:0:1:0:horizontal sets worskspace 2 to the horizontal stack mode and shrinks the master area by 4 ticks and adds one window to the stack, while maintaining default floating window behavior. Possible stack_mode values are vertical, vertical_flip, horizontal, horizontal_flip and fullscreen.

    See master_grow, master_shrink, master_add, master_del, stack_inc, stack_dec, and always_raise for more information. Note that the stacking options are complicated and have side-effects. One should familiarize oneself with these commands before experimenting with the layout option.

    This setting is not retained at restart.

modkey
    Change mod key. Mod1 is generally the ALT key and Mod4 is the windows key on a PC.

program[p]
    Define new action to spawn a program p. See the PROGRAMS section below.

quirk[c:n]
    Add "quirk" for windows with class c and name n. See the QUIRKS section below.

region
    Allocates a custom region, removing any autodetected regions which occupy the same space on the screen. Defined in the format screen[<idx>]:WIDTHxHEIGHT+X+Y, e.g. screen[1]:800x1200+0+0.

    To make a screen span multiple monitors, create a region big enough to cover them all, e.g. screen[1]:2048x768+0+0 makes the screen span two monitors with 1024x768 resolution sitting one next to the other.

spawn_position
    Position in stack to place newly spawned windows. Possible values are first, next, previous and last (default). next and previous are relative to the focused window.

stack_enabled
    Enable or disable displaying the current stacking algorithm in the status bar.

term_width
    Set a preferred minimum width for the terminal. If this value is greater than 0, spectrwm will attempt to adjust the font sizes in the terminal to keep the terminal width above this number as the window is resized. Only xterm(1) is currently supported. The xterm(1) binary must not be setuid or setgid, which it is by default on most systems. Users may need to set program[term] (see the PROGRAMS section) to use an alternate copy of the xterm(1) binary without the setgid bit set.

title_class_enabled
    Enable or disable displaying the window class in the status bar. Enable by setting to 1.

title_name_enabled
    Enable or disable displaying the window title in the status bar. Enable by setting to 1.

urgent_enabled
    Enable or disable the urgency hint. Note that many terminal emulators require this to be enabled for it to propagate. In xterm, for example, one needs to add the following line xterm.bellIsUrgent: true to .Xdefaults.

verbose_layout
    Enable or disable displaying the current master and stack values in the status bar. Enable by setting to 1.

window_name_enabled
    Enable or disable displaying the window name in the status bar. Enable by setting to 1.

    To prevent excessively large window names from pushing the remaining text off the screen, it's limited to 64 characters, by default. See the bar_format option for more details.

workspace_limit
    Set the total number of workspaces available. Minimum is 1, maximum is 22, default is 10.

Colors need to be specified per the XQueryColor(3) specification and fonts need to be specified per the XQueryFont(3) specification.

To list the available fonts in your system see fc-list(1) or xlsfonts(1) manpages. The xfontsel(1) application can help you to show the X Logical Font Description ("XLFD") used as setting in the keyword bar_font.

PROGRAMS
spectrwm allows you to define custom actions to launch programs of your choice and then bind them the same as with built-in actions. See the BINDINGS section below.

The default programs are described below:

term
    xterm
screenshot_all
    screenshot.sh full
screenshot_wind
    screenshot.sh window
lock
    xlock
initscr
    initscreen.sh
menu
    dmenu_run -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_border -sf $bar_color

Custom programs in the configuration file are specified as follows:

    program[<name>] = <progpath> [<arg> [... <arg>]]

<name> is any identifier that does not conflict with a built-in action or keyword, <progpath> is the desired program, and <arg> is zero or more arguments to the program.

The following variables represent settable values in spectrwm (see the CONFIGURATION FILES section above), and may be used in the <arg> fields and will be substituted for values at the time the program is spawned:

$bar_border
$bar_color
$bar_font
$bar_font_color
$color_focus
$color_unfocus

Example:

    program[ff] = /usr/local/bin/firefox http://spectrwm.org/
    bind[ff] = Mod+Shift+b # Now Mod+Shift+B launches firefox

To undo the previous:

    bind[] = Mod+Shift+b
    program[ff] =

BINDINGS
spectrwm provides many functions (or actions) accessed via key or mouse bindings.

The current mouse bindings are described below:

M1  Focus window
M-M1
    Move window
M-M3
    Resize window
M-S-M3
    Resize window while maintaining it centered

The default key bindings are described below:

M-S-<Return>
    term
M-p menu
M-S-q
    quit
M-q restart
M-<Space>
    cycle_layout
M-S-<\>
    flip_layout
M-S-<Space>
    stack_reset
M-h master_shrink
M-l master_grow
M-, master_add
M-. master_del
M-S-,
    stack_inc
M-S-.
    stack_dec
M-<Return>
    swap_main
    M-j, M-<TAB> focus_next
    M-k, M-S-<TAB> focus_prev
M-m focus_main
M-S-j
    swap_next
M-S-k
    swap_prev
M-b bar_toggle
M-x wind_del
M-S-x
    wind_kill
M-<1-9,0,F1-F12>
    ws_<1-22>
M-S-<1-9,0,F1-F12>
    mvws_<1-22>
M-<Right>
    ws_next
M-<Left>
    ws_prev
M-<Up>
    ws_next_all
M-<Down>
    ws_prev_all
M-a ws_prior
M-S-<Right>
    screen_next
M-S-<Left>
    screen_prev
M-s screenshot_all
M-S-s
    screenshot_wind
M-S-v
    version
M-t float_toggle
M-S-<Delete>
    lock
M-S-i
    initscr
M-w iconify
M-S-w
    uniconify
M-S-r
    always_raise
M-v button2
M-- width_shrink
M-= width_grow
M-S--
    height_shrink
M-S-=
    height_grow
M-[ move_left
M-] move_right
M-S-[
    move_up
M-S-]
    move_down
M-S-/
    name_workspace
M-/ search_workspace
M-f search_win

The action names and descriptions are listed below:

term
    Spawn a new terminal (see PROGRAMS above).
menu
    Menu (see PROGRAMS above).
quit
    Quit spectrwm.
restart
    Restart spectrwm.
cycle_layout
    Cycle layout.
flip_layout
    Swap the master and stacking areas.
stack_reset
    Reset layout.
master_shrink
    Shrink master area.
master_grow
    Grow master area.
master_add
    Add windows to master area.
master_del
    Remove windows from master area.
stack_inc
    Add columns/rows to stacking area.
stack_dec
    Remove columns/rows from stacking area.
swap_main
    Move current window to master area.
focus_next
    Focus next window in workspace.
focus_prev
    Focus previous window in workspace.
focus_main
    Focus on main window in workspace.
swap_next
    Swap with next window in workspace.
swap_prev
    Swap with previous window in workspace.
bar_toggle
    Toggle status bar in all workspaces.
wind_del
    Delete current window in workspace.
wind_kill
    Destroy current window in workspace.
ws_n
    Switch to workspace n, where n is 1 through workspace_limit.
mvws_n
    Move current window to workspace n, where n is 1 through workspace_limit.
ws_next
    Switch to next workspace with a window in it.
ws_prev
    Switch to previous workspace with a window in it.
ws_next_all
    Switch to next workspace.
ws_prev_all
    Switch to previous workspace.
ws_prior
    Switch to last visited workspace.
screen_next
    Move pointer to next region.
screen_prev
    Move pointer to previous region.
screenshot_all
    Take screenshot of entire screen (if enabled) (see PROGRAMS above).
screenshot_wind
    Take screenshot of selected window (if enabled) (see PROGRAMS above).
version
    Toggle version in status bar.
float_toggle
    Toggle focused window between tiled and floating.
lock
    Lock screen (see PROGRAMS above).
initscr
    Reinitialize physical screens (see PROGRAMS above).
iconify
    Minimize (unmap) currently focused window.
uniconify
    Maximize (map) window returned by dmenu selection.
always_raise
    When set tiled windows are allowed to obscure floating windows.
button2
    Fake a middle mouse button click (mouse button 2).
width_shrink
    Shrink the width of a floating window.
width_grow
    Grow the width of a floating window.
height_shrink
    Shrink the height of a floating window.
height_grow
    Grow the height of a floating window.
move_left
    Move a floating window a step to the left.
move_right
    Move a floating window a step to the right.
move_up
    Move a floating window a step upwards.
move_down
    Move a floating window a step downwards.
name_workspace
    Name the current workspace.
search_workspace
    Search for a workspace.
search_win
    Search the windows in the current workspace.

Custom bindings in the configuration file are specified as follows:

    bind[<action>] = <keys>

<action> is one of the actions listed above (or empty) and <keys> is in the form of zero or more modifier keys (MOD, Mod1, Shift, etc.) and one or more normal keys (b, space, etc.), separated by "+". For example:

    bind[reset] = Mod4+q # bind Windows-key + q to reset
    bind[] = Mod1+q # unbind Alt + q

To use the currently defined modkey, specify MOD as the modifier key.

Multiple key combinations may be bound to the same action.

To bind non-latin characters such as å or π you must enter the xkb character name instead of the character itself. Run xev, focus the window and press the specific key and in the terminal output read the symbol name. In the fallowing example for å:

    KeyPress event, serial 41, synthetic NO, window 0x2600001,
        root 0x15a, subw 0x0, time 106213808, (11,5), root:(359,823),
        state 0x0, keycode 24 (keysym 0xe5, aring), same_screen YES,
        XLookupString gives 2 bytes: (c3 a5) "å"
        XmbLookupString gives 2 bytes: (c3 a5) "å"
        XFilterEvent returns: False

The xkb name is aring. In other words, in .spectrwm.conf add:

    bind[program] = MOD+aring

KEYBOARD MAPPING FILES
Keyboard mapping files for several keyboard layouts are listed below. These files can be used with the keyboard_mapping setting to load pre-defined key bindings for the specified keyboard layout.

spectrwm_cz.conf
    Czech Republic keyboard layout
spectrwm_es.conf
    Spanish keyboard layout
spectrwm_fr.conf
    French keyboard layout
spectrwm_fr_ch.conf
    Swiss French keyboard layout
spectrwm_se.conf
    Swedish keyboard layout
spectrwm_us.conf
    United States keyboard layout

QUIRKS
spectrwm provides "quirks" which handle windows that must be treated specially in a tiling window manager, such as some dialogs and fullscreen apps.

The default quirks are described below:

Firefox-bin:firefox-bin
    TRANSSZ
Firefox:Dialog
    FLOAT
Gimp:gimp
    FLOAT + ANYWHERE
MPlayer:xv
    FLOAT + FULLSCREEN + FOCUSPREV
OpenOffice.org 2.4:VCLSalFrame
    FLOAT
OpenOffice.org 3.1:VCLSalFrame
    FLOAT
pcb:pcb
    FLOAT
xine:Xine Window
    FLOAT + ANYWHERE
xine:xine Panel
    FLOAT + ANYWHERE
xine:xine Video Fullscreen Window
    FULLSCREEN + FLOAT
Xitk:Xitk Combo
    FLOAT + ANYWHERE
Xitk:Xine Window
    FLOAT + ANYWHERE
XTerm:xterm
    XTERM_FONTADJ

The quirks themselves are described below:

FLOAT
    This window should not be tiled, but allowed to float freely.
TRANSSZ
    Adjusts size on transient windows that are too small using dialog_ratio (see CONFIGURATION FILES).
ANYWHERE
    Allow window to position itself, uncentered.
XTERM_FONTADJ
    Adjust xterm fonts when resizing.
FULLSCREEN
    Remove border to allow window to use full screen size.
FOCUSPREV
    On exit force focus on previously focused application not previous application in the stack.

Custom quirks in the configuration file are specified as follows:

    quirk[<class>:<name>] = <quirk> [+ <quirk> ...]

<class> and <name> specify the window to which the quirk(s) apply, and <quirk> is one of the quirks from the list above. For example:

    quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV
    quirk[pcb:pcb] = NONE  # remove existing quirk

You can obtain <class> and <name> by running xprop(1) and then clicking on the desired window. In the following example the main window of Firefox was clicked:

    $ xprop | grep WM_CLASS
    WM_CLASS(STRING) = "Navigator", "Firefox"

Note that grepping for WM_CLASS flips class and name. In the example above the quirk entry would be:

    quirk[Firefox:Navigator] = FLOAT

spectrwm also automatically assigns quirks to windows based on the value of the window's _NET_WM_WINDOW_TYPE property as follows:

_NET_WM_WINDOW_TYPE_DOCK
    FLOAT + ANYWHERE
_NET_WM_WINDOW_TYPE_TOOLBAR
    FLOAT + ANYWHERE
_NET_WM_WINDOW_TYPE_UTILITY
    FLOAT + ANYWHERE
_NET_WM_WINDOW_TYPE_SPLASH
    FLOAT
_NET_WM_WINDOW_TYPE_DIALOG
    FLOAT

In all other cases, no automatic quirks are assigned to the window. Quirks specified in the configuration file override the automatic quirks.

EWMH
spectrwm partially implements the Extended Window Manager Hints (EWMH) specification. This enables controlling windows as well as spectrwm itself from external scripts and programs. This is achieved by spectrwm responding to certain ClientMessage events. From the terminal these events can be conveniently sent using tools such as wmctrl(1) and xdotool(1). For the actual format of these ClientMessage events, see the EWMH specification.

The id of the currently focused window is stored in the _NET_ACTIVE_WINDOW property of the root window. This can be used for example to retrieve the title of the currently active window with xprop(1) and grep(1):

    $ WINDOWID=`xprop -root _NET_ACTIVE_WINDOW | grep -o "0x.*"`
    $ xprop -id $WINDOWID WM_NAME | grep -o "\".*\""

A window can be focused by sending a _NET_ACTIVE_WINDOW client message to the root window. For example, using wmctrl(1) to send the message (assuming 0x4a0000b is the id of the window to be focused):

    $ wmctrl -i -a 0x4a0000b

Windows can be closed by sending a _NET_CLOSE_WINDOW client message to the root window. For example, using wmctrl(1) to send the message (assuming 0x4a0000b is the id of the window to be closed):

    $ wmctrl -i -c 0x4a0000b

Windows can be floated and un-floated by adding or removing the _NET_WM_STATE_ABOVE atom from the _NET_WM_STATE property of the window. This can be achieved by sending a _NET_WM_STATE client message to the root window. For example, the following toggles the floating state of a window using wmctrl(1) to send the message (assuming 0x4a0000b is the id of the window floated or un-floated):

    $ wmctrl -i -r 0x4a0000b -b toggle,_NET_WM_STATE_ABOVE

Floating windows can also be resized and moved by sending a _NET_MOVERESIZE_WINDOW client message to the root window. For example, using wmctrl(1) to send the message (assuming 0x4a0000b is the id of the window to be resize/moved):

    $ wmctrl -i -r 0x4a0000b -e 0,100,50,640,480

This moves the window to (100,50) and resizes it to 640x480.

Any _NET_MOVERESIZE_WINDOW events received for stacked windows are ignored.

SIGNALS
Sending spectrwm a HUP signal will restart it.

FILES
~/.spectrwm.conf
    spectrwm user specific settings.
/etc/spectrwm.conf
    spectrwm global settings.

HISTORY
spectrwm was inspired by xmonad & dwm.

AUTHORS
-nosplit spectrwm was written by:

Marco Peereboom <marco@peereboom.us>
Ryan Thomas McBride <mcbride@countersiege.com>
Darrin Chandler <dwchandler@stilyagin.com>
Pierre-Yves Ritschard <pyr@spootnik.org>
Tuukka Kataja <stuge@xor.fi>
Jason L. Wright <jason@thought.net>
Reginald Kennedy <rk@rejii.com>
Lawrence Teo <lteo@lteo.net>
Tiago Cunha <tcunha@gmx.com>