~/.spectrwm.conf
spectrwm user specific settings.
Window manager for x11
Part of spectrwm(1).
spectrwm
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:
Meta
Shift
Name⟩Named key
M1Mouse button 1
M3Mouse 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.
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:
autorunLaunch 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_actionExternal script that populates additional information in the status bar, such as battery life.
bar_at_bottomPlace 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_widthSet 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_delayUpdate frequency, in seconds, of external script that populates the status bar.
bar_enabledEnable or disable status bar.
bar_fontStatus bar font.
bar_font_color[x]Color of the font in status bar in screen x.
bar_justifyJustify the status bar text. Possible values are left, center, and right.
bind[x]Bind key combo to action x. See the BINDINGS section below.
border_widthSet window border thickness in pixels. Disable all borders by setting to 0.
clock_enabledEnable 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_focusBorder color of the currently focussed window.
color_unfocusBorder color of unfocussed windows.
dialog_ratioSome 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_borderRemove border when bar is disabled and there is only one window on the screen.
focus_modeUsing a value of follow_cursor will make the window manager focus the window under the mouse when switching workspaces and creating windows.
keyboard_mappingClear 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.
layoutSelect 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, horizontal 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.
modkeyChange 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.
regionAllocates 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.
stack_enabledEnable or disable displaying the current stacking algorithm in the status bar.
term_widthSet 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_enabledEnable or disable displaying the window class in the status bar. Enable by setting to 1.
title_name_enabledEnable or disable displaying the window title in the status bar. Enable by setting to 1.
urgent_enabledEnable 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.urgentOnBell: true to .Xdefaults.
verbose_layoutEnable or disable displaying the current master and stack values in the status bar. Enable by setting to 1.
window_name_enabledEnable or disable displaying the window name in the status bar. Enable by setting to 1.
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.
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:
termxterm
screenshot_allscreenshot.sh full
screenshot_windscreenshot.sh window
lockxlock
initscrinitscreen.sh
menudmenu_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_unfocusExample:
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] =
spectrwm provides many functions (or actions) accessed via key or mouse bindings.
The current mouse bindings are described below:
M1Focus window
M-M1Move window
M-M3Resize window
M-S-M3Resize window while maintaining it centered
The default key bindings are described below:
Return⟩term
M-pmenu
M-S-qquit
M-qrestart
Space⟩cycle_layout
flip_layout
Space⟩stack_reset
M-hmaster_shrink
M-lmaster_grow
master_add
master_del
stack_inc
stack_dec
Return⟩swap_main
M-j, M-⟨TAB⟩ focus_next
M-k, M-S-⟨TAB⟩ focus_prev
M-mfocus_main
M-S-jswap_next
M-S-kswap_prev
M-bbar_toggle
M-xwind_del
M-S-xwind_kill
ws_n
mvws_n
Right⟩ws_next
Left⟩ws_prev
Up⟩ws_next_all
Down⟩ws_prev_all
M-aws_prior
Right⟩screen_next
Left⟩screen_prev
M-sscreenshot_all
M-S-sscreenshot_wind
M-S-vversion
M-tfloat_toggle
Delete⟩lock
M-S-iinitscr
M-wiconify
M-S-wuniconify
M-S-ralways_raise
M-vbutton2
width_shrink
width_grow
height_shrink
height_grow
move_left
move_right
move_up
move_down
name_workspace
search_workspace
M-fsearch_win
The action names and descriptions are listed below:
termSpawn a new terminal (see PROGRAMS above).
menuMenu (see PROGRAMS above).
quitQuit spectrwm.
restartRestart spectrwm.
cycle_layoutCycle layout.
flip_layoutSwap the master and stacking areas.
stack_resetReset layout.
master_shrinkShrink master area.
master_growGrow master area.
master_addAdd windows to master area.
master_delRemove windows from master area.
stack_incAdd columns/rows to stacking area.
stack_decRemove columns/rows from stacking area.
swap_mainMove current window to master area.
focus_nextFocus next window in workspace.
focus_prevFocus previous window in workspace.
focus_mainFocus on main window in workspace.
swap_nextSwap with next window in workspace.
swap_prevSwap with previous window in workspace.
bar_toggleToggle status bar in all workspaces.
wind_delDelete current window in workspace.
wind_killDestroy current window in workspace.
ws_nSwitch to workspace n, where n is 1 through 10.
mvws_nMove current window to workspace n, where n is 1 through 10.
ws_nextSwitch to next workspace with a window in it.
ws_prevSwitch to previous workspace with a window in it.
ws_next_allSwitch to next workspace.
ws_prev_allSwitch to previous workspace.
ws_priorSwitch to last visited workspace.
screen_nextMove pointer to next region.
screen_prevMove pointer to previous region.
screenshot_allTake screenshot of entire screen (if enabled) (see PROGRAMS above).
screenshot_windTake screenshot of selected window (if enabled) (see PROGRAMS above).
versionToggle version in status bar.
float_toggleToggle focused window between tiled and floating.
lockLock screen (see PROGRAMS above).
initscrReinitialize physical screens (see PROGRAMS above).
iconifyMinimize (unmap) currently focused window.
uniconifyMaximize (map) window returned by dmenu selection.
always_raiseWhen set tiled windows are allowed to obscure floating windows.
button2Fake a middle mouse button click (mouse button 2).
width_shrinkShrink the width of a floating window.
width_growGrow the width of a floating window.
height_shrinkShrink the height of a floating window.
height_growGrow the height of a floating window.
move_leftMove a floating window a step to the left.
move_rightMove a floating window a step to the right.
move_upMove a floating window a step upwards.
move_downMove a floating window a step downwards.
name_workspaceName the current workspace.
search_workspaceSearch for a workspace.
search_winSearch 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.
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.confCzech Republic keyboard layout
spectrwm_es.confSpanish keyboard layout
spectrwm_fr.confFrench keyboard layout
spectrwm_fr_ch.confSwiss French keyboard layout
spectrwm_se.confSwedish keyboard layout
spectrwm_us.confUnited States keyboard layout
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:
TRANSSZ
FLOAT
FLOAT + ANYWHERE
FLOAT + FULLSCREEN + FOCUSPREV
FLOAT
FLOAT
FLOAT
FLOAT + ANYWHERE
FLOAT + ANYWHERE
FULLSCREEN + FLOAT
FLOAT + ANYWHERE
FLOAT + ANYWHERE
XTERM_FONTADJ
The quirks themselves are described below:
This window should not be tiled, but allowed to float freely.
Adjusts size on transient windows that are too small using dialog_ratio (see CONFIGURATION FILES).
Allow window to position itself, uncentered.
Adjust xterm fonts when resizing.
Remove border to allow window to use full screen size.
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:
FLOAT + ANYWHERE
FLOAT + ANYWHERE
FLOAT + ANYWHERE
FLOAT
FLOAT
In all other cases, no automatic quirks are assigned to the window. Quirks specified in the configuration file override the automatic quirks.
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.
Sending spectrwm a HUP signal will restart it.
~/.spectrwm.conf
spectrwm user specific settings.
/etc/spectrwm.conf
spectrwm global settings.