|SPECTRWM(1)||General Commands Manual||SPECTRWM(1)|
window manager for X11
The following notation is used throughout this page:
BINDINGS section below for
defaults and customizations.
Example:To cancel the previous, unbind it:Default programs:Note that optional default programs will not be validated unless overridden. If a default program fails validation, you can resolve the exception by installing the program, modifying the program call or disabling the program by freeing the respective binding. For example, to override lock:To unbind lock and prevent it from being validated:The action names and descriptions are listed below:Custom bindings in the configuration file are specified as follows:MOD example:ANYMOD example:In the above example, M-⟨Button3⟩ initiates move and ⟨Button3⟩ pressed with any other combination of modifiers sets focus to the window/region under the pointer. REPLAY example:In the above example, when ⟨Button3⟩ is pressed without any modifier(s), focus is set to the window under the pointer and the button press is passed to the window. To bind non-latin characters such as å or π you must enter the xkb character name instead of the character itself. Run xev(1), focus the window and press the specific key and in the terminal output read the symbol name. In the following example for å:The xkb name is aring. In other words, in spectrwm.conf add:The quirks themselves are described below:Custom quirks in the configuration file are specified as follows:You can obtain class, instance and name by running xprop(1) and then clicking on the desired window. In the following example the main window of Firefox was clicked:Note that xprop(1) displays WM_CLASS as:In the example above the quirk entry would be:spectrwm also automatically assigns quirks to windows based on the value of the window's _NET_WM_WINDOW_TYPE property as follows:In all other cases, no automatic quirks are assigned to the window. Quirks specified in the configuration file override the automatic quirks. 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):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):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):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 to be floated or un-floated):Windows can also be iconified and un-iconified by substituting _NET_WM_STATE_HIDDEN for _NET_WM_STATE_ABOVE in the previous example: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):This moves the window to (100,50) and resizes it to 640x480. Any _NET_MOVERESIZE_WINDOW events received for stacked windows are ignored.
Enabling or disabling an option is done by using 1 or 0 respectively. Colors need to be specified per the XQueryColor(3) specification. Comments begin with a #. When a literal ‘
color_focus = red
#’ is desired in an option, then it must be escaped with a backslash, i.e. \# The file supports the following keywords:
- Launch an application in a specified workspace at
start-of-day. Defined in the format
ws[idx]:application, e.g. ws:xterm launches an xterm(1) in workspace 2. Note that workspace mapping is handled via libswmhack.so. When autorun spawns windows via a daemon, ensure the daemon is started with the correct LD_PRELOAD in its environment. For example, starting urxvtd(1) via xinit(1):
LD_PRELOAD=/usr/lib/libswmhack.so.0.0 urxvtd -q -o -f
- External script that populates additional information in the status bar, such as battery life.
- Place the statusbar at the bottom of each region instead of the top.
- Border color of the status bar(s) in screen x.
- Border color of the status bar(s) on unfocused region(s) in screen x.
- Set status bar border thickness in pixels. Disable border by setting to 0.
- Background color of the status bar(s) in screen x.
- Background color for selections on the status bar(s) in screen x. Defaults to the value of bar_border.
- Set default bar_toggle state; default is 1.
- Set default bar_toggle_ws state on workspace x; default is 1.
- Font used in the status bar. Either Xft or X Logical Font
Description (XLFD) may be used to specify fonts. Fallback fonts may be
specified by separating each font with a comma. If all entries are in XLFD
syntax, font set will be used. If at least one entry is Xft, Xft will be
used. Note that if Xft is in use, only the first font that successfully
loads will be used regardless of missing glyphs. The default is to use
font set. Also note that
does not support Xft fonts.
bar_font = Terminus:style=Regular:pixelsize=14:antialias=true bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,Terminus:pixelsize=14,-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-* bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*,-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
- Foreground color of the status bar(s) in screen x.
- Foreground color for selections on the status bar(s) in screen x. Defaults to the value of bar_color.
- Set the bar format string, overriding
clock_format and all of the
enabled options. The format is passed through
before being used. It may contain the following character sequences:
Character sequence Replaced with
Pad with a space
Output of the external script
Window class (from WM_CLASS)
Number of iconic (minimized) windows in workspace
Window class and instance separated by a colon
Window instance (from WM_CLASS)
Window name (from _NET_WM_NAME/WM_NAME)
A literal ‘
- 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 key or button combo to action x. See the BINDINGS section below.
- Set window border thickness in pixels. Disable all borders by setting to 0.
- Set region containment boundary width in pixels. This is how far a window must be dragged/resized (with the pointer) beyond the region edge before it is allowed outside the region. Disable the window containment effect by setting to 0.
- 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.
- Display the number of iconic (minimized) windows in the status bar. Enable by setting to 1.
- Border color of the currently focused window. Default is red.
- Border color of the currently focused, maximized window. Defaults to the value of color_focus.
- Border color of unfocused windows, default is rgb:88/88/88.
- Border color of unfocused, maximized windows. Defaults to the value of color_unfocus.
- 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.
- Remove border when bar is disabled and there is only one window on the region.
- 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.
- 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.
- Window to put focus when no window has been focused. Possible values are first and last (default).
- Window focus behavior with respect to the pointer. Possible
- Set window focus on border crossings caused by cursor motion and window interaction.
- Set window focus on all cursor border crossings, including workspace switches and changes to layout.
- Set window focus on window interaction only.
- When set to 1, maximize_toggle will also hide/restore the bar visibility of the affected workspace. Defaults to 0.
- Clear all key bindings (not button bindings) and load new 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.
- Select layout to use at start-of-day. Defined in the format
ws[idx]:master_grow:master_add:stack_inc:always_raise:stack_mode, e.g. ws:-4:0:1:0:horizontal sets worskspace 2 to the horizontal stack mode, 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, stack_balance, 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.
- Change mod key. Mod1 is generally the ALT key and Mod4 is the windows key on a PC.
- Set the name of a workspace at start-of-day. Defined in the
ws[idx]:name, e.g. ws:Console sets the name of workspace 1 to “Console”.
- Define new action to spawn a program p. See the PROGRAMS section below.
- Add "quirk" for windows with class c, instance i and name n. See the QUIRKS section below.
- 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:800x1200+0+0. To make a region span multiple monitors, create a region big enough to cover them all, e.g. screen:2048x768+0+0 makes the region span two monitors with 1024x768 resolution sitting one next to the other.
- Pixel width of empty space within region borders. Disable by setting to 0.
- 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.
- Enable or disable displaying the current stacking algorithm in the status bar.
- 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.
- Pixel width of empty space between tiled windows. Negative values cause overlap. Set this to the opposite of border_width to collapse the border between tiles. Disable by setting to 0.
- Minimizes the space consumed by the urgency hint indicator by removing the placeholders for non-urgent workspaces, the trailing space when there are urgent windows and the default leading space. Enable by setting to 1.
- Enable or disable the urgency hint indicator in the status
bar. Note that many terminal emulators require an explicit setting for the
bell character to trigger urgency on the window. In
for example, one needs to add the following line to
- Enable or disable displaying the current master window count and stack column/row count in the status bar. Enable by setting to 1. See master_add, master_del, stack_inc and stack_dec for more information.
- Prevents workspaces from being swapped when attempting to switch to a workspace that is mapped to another region. Use warp_focus if you want to focus on the region containing the workspace and warp_pointer if you want to also send the pointer. Enable by setting to 1.
- Enable or disable displaying the window class name (from WM_CLASS) in the status bar. Enable by setting to 1.
- Enable or disable displaying the window instance name (from WM_CLASS) in the status bar. Enable by setting to 1.
- Enable or disable displaying the window display name (from _NET_WM_NAME/WM_NAME) in the status bar. Enable by setting to 1. To prevent excessively large window names from pushing the remaining text off the bar, it's limited to 64 characters, by default. See the bar_format option for more details.
- Focus on the target window/workspace/region when clamped. For example, when attempting to switch to a workspace that is mapped on another region and workspace_clamp is enabled, focus on the region with the target workspace. Enable by setting to 1.
- Centers the pointer on the focused window when using bindings to change focus, switch workspaces, change regions, etc. Enable by setting to 1.
- Set the total number of workspaces available. Minimum is 1, maximum is 22, default is 10.
action 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. Remember that when using ‘
program[action] = progpath [arg [arg ...]]
#’ in your program call, it must be escaped with a backslash, i.e. \# The following argument variables will be substituted for values at the time the program is spawned:
program[ff] = /usr/local/bin/firefox http://spectrwm.org/ bind[ff] = MOD+Shift+b # Now M-S-b launches firefox
bind = MOD+Shift+b
- dmenu_run $dmenu_bottom -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected
- dmenu $dmenu_bottom -i -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected
- dmenu $dmenu_bottom -p Workspace -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected
- initscreen.sh # optional
- screenshot.sh full # optional
- screenshot.sh window # optional
program[lock] = xscreensaver-command -lock
bind = MOD+Shift+Delete
- M-j, M-⟨TAB⟩
- M-k, M-S-⟨TAB⟩
- M-⟨Keypad 1-9⟩
- M-S-⟨Keypad 1-9⟩
- Focus window/region under pointer.
- Move window with pointer while binding is pressed.
- Resize window with pointer while binding is pressed.
- Same as resize but keep window centered.
- Spawn a new terminal (see PROGRAMS above).
- Menu (see PROGRAMS above).
- Quit spectrwm.
- Restart spectrwm.
- Cycle layout.
- Swap the master and stacking areas.
- Reset layout.
- Balance master/stacking area.
- Shrink master area.
- Grow master area.
- Add windows to master area.
- Remove windows from master area.
- Add columns/rows to stacking area.
- Remove columns/rows from stacking area.
- Move current window to master area.
- Focus next window in workspace.
- Focus previous window in workspace.
- Focus on main window in workspace.
- Focus on next window with the urgency hint flag set. The workspace is switched if needed.
- Swap with next window in workspace.
- Swap with previous window in workspace.
- Toggle overall visibility of status bars.
- Toggle status bar on current workspace.
- Delete current window in workspace.
- Destroy current window in workspace.
- Switch to workspace n, where n is 1 through workspace_limit.
- Move current window to workspace n, where n is 1 through workspace_limit.
- Focus on region n, where n is 1 through 9.
- Move current window to region n, where n is 1 through 9.
- Move current window to workspace in next region.
- Move current window to workspace in previous region.
- Switch to the first empty workspace.
- Switch to next workspace with a window in it.
- Switch to previous workspace with a window in it.
- Switch to next workspace.
- Switch to previous workspace.
- Switch to next workspace with the current window.
- Switch to previous workspace with the current window.
- Switch to last visited workspace.
- Switch to next region.
- Switch to previous region.
- Switch region to next screen.
- Switch region to previous screen.
- Take screenshot of entire screen (if enabled) (see PROGRAMS above).
- Take screenshot of selected window (if enabled) (see PROGRAMS above).
- Toggle version in status bar.
- Toggle focused window between tiled and floating.
- Lock screen (see PROGRAMS above).
- Reinitialize physical screens (see PROGRAMS above).
- Minimize (unmap) currently focused window.
- Restore (map) window returned by dmenu(1) selection.
- Toggle maximization of focused window.
- Toggle fullscreen state of focused window.
- Raise the current window.
- When set tiled windows are allowed to obscure floating windows.
- Fake a middle mouse button click (Button2).
- Shrink the width of a floating window.
- Grow the width of a floating window.
- Shrink the height of a floating window.
- Grow the height of a floating window.
- Move a floating window a step to the left.
- Move a floating window a step to the right.
- Move a floating window a step upwards.
- Move a floating window a step downwards.
- Name the current workspace.
- Search for a workspace.
- Search the windows in the current workspace.
action is one of the actions listed above (or empty to unbind) and combo is in the form of zero or more modifier keys and/or special arguments (Mod1, Shift, MOD, etc.) and a normal key (b, Space, etc.) or a button (Button1 .. Button255), separated by ‘
bind[action] = combo
+’. Multiple key/button combinations may be bound to the same action. Special arguments:
bind[reset] = Mod4+q # bind Windows-key + q to reset bind = Mod1+q # unbind Alt + q bind[move] = MOD+Button3 # Bind move to M-Button3 bind = MOD+Button1 # Unbind default move binding.
bind[focus] = ANYMOD+Button3 bind[move] = MOD+Button3
bind[focus] = REPLAY+Button3
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
bind[program] = MOD+aring
- FLOAT + ANYWHERE
- FLOAT + FULLSCREEN + FOCUSPREV
- OpenOffice.org 2.4:VCLSalFrame
- OpenOffice.org 3.1:VCLSalFrame
- 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
- Allow window to position itself, uncentered.
- This window should not be tiled, but allowed to float freely.
- When the window first appears on the screen, change focus to the window if there are no other windows on the workspace with the same WM_CLASS class/instance value. Has no effect when focus_mode is set to follow.
- On exit force focus on previously focused application not previous application in the stack.
- Remove border to allow window to use full region size.
- Ignore the PID when determining the initial workspace for a new window. Especially useful for terminal windows that share a process.
- Ignore the spawn workspace when determining the initial workspace for a new window.
- Remove border when window is unfocused and floating.
- Remove from normal focus cycle (focus_prev or focus_next). The window can still be focused using search_win.
- Don't change focus to the window when it first appears on the screen. Has no effect when focus_mode is set to follow.
- When an application requests focus on the window via a _NET_ACTIVE_WINDOW client message (source indication of 1), comply with the request. Note that a source indication of 0 (unspecified) or 2 (pager) are always obeyed.
- Adjusts size on transient windows that are too small using dialog_ratio (see CONFIGURATION FILES).
- Force a new window to appear on workspace n.
- Adjust xterm(1) fonts when resizing.
class, instance (optional) and name (optional) are patterns used to determine which window(s) the quirk(s) apply to and quirk is one of the quirks from the list above. Note that patterns are interpreted as POSIX Extended Regular Expressions. Any ':', '[' or ']' must be escaped with '\'. See regex(7) for more information on POSIX Extended Regular Expressions. For example:
quirk[class[:instance[:name]]] = quirk [+ quirk ...]
quirk[MPlayer] = FLOAT + FULLSCREEN + FOCUSPREV # Float all windows having a class of 'MPlayer' quirk[.*] = FLOAT # Float all windows by default. quirk[.*:.*:.*] = FLOAT # Same as above. quirk[Firefox:Navigator] = FLOAT # Float all Firefox browser windows. quirk[::Console] = FLOAT # Float windows with WM_CLASS not set and a window name of 'Console'. quirk[\[0-9\].*:.*:\[\[\:alnum\:\]\]*] = FLOAT # Float windows with WM_CLASS class beginning with a number, any WM_CLASS instance and a _NET_WM_NAME/WM_NAME either blank or containing alphanumeric characters without spaces. quirk[pcb:pcb] = NONE # remove existing quirk
$ xprop | grep -E "^(WM_CLASS|_NET_WM_NAME|WM_NAME)" WM_CLASS(STRING) = "Navigator", "Firefox" WM_NAME(STRING) = "spectrwm - ConformalOpenSource" _NET_WM_NAME(UTF8_STRING) = "spectrwm - ConformalOpenSource"
WM_CLASS(STRING) = "<instance>", "<class>"
quirk[Firefox:Navigator] = FLOAT
- FLOAT + ANYWHERE
- FLOAT + ANYWHERE
- FLOAT + ANYWHERE
$ WINDOWID=`xprop -root _NET_ACTIVE_WINDOW | grep -o "0x.*"` $ xprop -id $WINDOWID _NET_WM_NAME | grep -o "\".*\""
$ wmctrl -i -a 0x4a0000b
$ wmctrl -i -c 0x4a0000b
$ wmctrl -i -r 0x4a0000b -b toggle,_NET_WM_STATE_ABOVE
$ wmctrl -i -r 0x4a0000b -b toggle,_NET_WM_STATE_HIDDEN
$ wmctrl -i -r 0x4a0000b -e 0,100,50,640,480
- spectrwm user specific settings.
- spectrwm global settings.
- Marco Peereboom ⟨email@example.com⟩
- Ryan Thomas McBride ⟨firstname.lastname@example.org⟩
- Darrin Chandler ⟨email@example.com⟩
- Pierre-Yves Ritschard ⟨firstname.lastname@example.org⟩
- Tuukka Kataja ⟨email@example.com⟩
- Jason L. Wright ⟨firstname.lastname@example.org⟩
- Reginald Kennedy ⟨email@example.com⟩
- Lawrence Teo ⟨firstname.lastname@example.org⟩
- Tiago Cunha ⟨email@example.com⟩
- David Hill ⟨firstname.lastname@example.org⟩
|February 15, 2012||Linux 4.13.4-1-ARCH|