.\" Copyright (c) 2009-2012 Marco Peereboom <marco@peereboom.us>
.\" Copyright (c) 2009 Darrin Chandler <dwchandler@stilyagin.com>
.\" Copyright (c) 2011-2024 Reginald Kennedy <rk@rejii.com>
.\" Copyright (c) 2011-2012 Lawrence Teo <lteo@lteo.net>
.\" Copyright (c) 2011-2012 Tiago Cunha <tcunha@gmx.com>
.\" Copyright (c) 2012 David Hill <dhill@mindcry.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 10 2024 $
.Dt SPECTRWM 1
.Os
.Sh NAME
.Nm spectrwm
.Nd window manager for X11
.Sh SYNOPSIS
.Nm spectrwm
.Op Fl c Ar file
.Op Fl v
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl c Ar file
Specify a configuration file to load instead of scanning for one.
.It Fl d
Enable debug mode and logging to stderr.
.It Fl v
Print version and exit.
.El
.Sh DESCRIPTION
.Nm
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.
.Pp
When
.Nm
starts up, it reads settings from its configuration file,
.Pa spectrwm.conf .
See the
.Sx CONFIGURATION FILES
section below.
.Pp
The following notation is used throughout this page:
.Pp
.Bl -tag -width Ds -offset indent -compact
.It Cm M
Meta
.It Cm S
Shift
.It Aq Cm Name
Named key or button
.El
.Pp
.Nm
is very simple in its use.
Most of the actions are initiated via key or pointer button bindings.
See the
.Sx BINDINGS
section below for defaults and customizations.
.Sh CONFIGURATION FILES
.Nm
looks for the user-configuration file in the following order:
.Pp
.Bl -enum -offset indent -compact
.It
.Pa $XDG_CONFIG_HOME/spectrwm/spectrwm.conf
.It
.Pa ~/.config/spectrwm/spectrwm.conf
(if
.Pa $XDG_CONFIG_HOME
is either not set or empty)
.It
.Pa ~/.spectrwm.conf .
.El
.Pp
If the user-configuration file is not found,
.Nm
then looks for the global configuration file in the following order:
.Pp
.Bl -enum -offset indent -compact
.It
.Pa $XDG_CONFIG_DIRS/spectrwm/spectrwm.conf
(each colon-separated directory in
.Pa $XDG_CONFIG_DIRS )
.It
.Pa /etc/xdg/spectrwm/spectrwm.conf
(if
.Pa $XDG_CONFIG_DIRS
is either not set or empty)
.It
.Pa /etc/spectrwm.conf
.El
.Pp
The format of the file is
.Pp
.Dl Ar keyword Li = Ar setting
.Pp
Where
.Ql =
may be replaced with
.Ql +=
or
.Ql -= ,
if supported by the option.
.Pp
For example:
.Pp
.Dl color_focus = red
.Dl quirk[XTerm] += FLOAT
.Pp
Enabling or disabling an option is done by using 1 or 0 respectively.
.Pp
Colors need to be specified per the
.Xr XQueryColor 3
specification.
In addition, alpha transparency may be specified via the format
.Li rbga : Ns Ar red Ns / Ns Ar green Ns / Ns Ar blue Ns / Ns Ar alpha
(8-bit hex values)
For example, to specify a 50% transparent blue status bar background:
.Pp
.Dl bar_color = rgba:00/00/ff/7f
.Pp
Note that a compositing manager is required for alpha transparency.
.Pp
Mark option values may be wrapped in single/double quotes to prevent
whitespace trimming, specify empty strings, etc.
Literal quote/backslash characters can be escaped with a backslash
.Sq \e ,
when needed.
.Pp
Comments begin with a #.
When a literal
.Ql #
is desired in an option, then it must be escaped with a backslash, i.e. \e#
.Pp
The file supports the following keywords:
.Bl -tag -width 2m
.It Ic autorun
Launch an application in a specified workspace at start-of-day.
Defined in the format
.Li ws Ns Bo Ar idx Bc : Ns Ar application ,
e.g. ws[2]:xterm launches an
.Xr xterm 1
in workspace 2.
Specify
.Sq ws[-1]
to launch applications such as desktop managers and panels in free mode to keep
them always mapped.
.Pp
Note that
.Pa libswmhack.so
is required for "spawn-in-workspace" behavior.
See the
.Sx SWMHACK
section below for more information, tips, and workarounds if a program fails to
spawn in the specified workspace.
.It Ic bar_action
External script that populates additional information in the status bar,
such as battery life.
.It Ic bar_action_expand
Process
.Ic bar_format
character sequences in
.Ic bar_action
output; default is 0.
.It Ic bar_at_bottom
Place the statusbar at the bottom of each region instead of the top.
Default is 0.
.It Ic bar_border Ns Bq Ar x
Border color of status bar(s) on screen number
.Ar x .
Default is rgb:00/80/80.
.It Ic bar_border_free Ns Bq Ar x
Border color of a status bar for a focused region on screen number
.Ar x
when a workspace-free window is focused.
Default is rgb:80/80/00.
.It Ic bar_border_unfocus Ns Bq Ar x
Border color of status bar(s) for unfocused region(s) on screen number
.Ar x .
Default is rgb:00/40/40.
.It Ic bar_border_width
Set status bar border thickness in pixels.
Disable border by setting to 0.
.It Ic bar_color Ns Bq Ar x
Background color of status bar(s) on screen number
.Ar x .
.Pp
A comma-separated list of multiple colors can be specified.
The first value is used as the default background color.
Any of these colors can then be selected as a background color in the status
bar through the use of the markup sequence
.Ic +@bg=n;\&
where n is the color index counting from 0.
.It Ic bar_color_free Ns Bq Ar x
Background color of a status bar for a focused region on screen number
.Ar x
when a workspace-free window is focused.
.Pp
A comma-separated list of multiple colors can be specified, with the same
syntax and behavior as
.Ic bar_color .
Default is rgb:40/40/00.
.Pp
Note that
.Ic bar_color
defines the background color indices that can be used in
.Ic bar_format
markup sequences and is the fallback for colors that are left unspecified in
this option.
.It Ic bar_color_selected Ns Bq Ar x
Background color for selected
.Cm menu
items on screen number
.Ar x .
Defaults to the value of
.Ic bar_border .
.It Ic bar_color_unfocus Ns Bq Ar x
Background color of status bar(s) for unfocused region(s) on screen number
.Ar x .
.Pp
A comma-separated list of multiple colors can be specified, with the same
syntax and behavior as
.Ic bar_color
for unfocused bar(s).
Defaults to the value of
.Ic bar_color .
.Pp
Note that
.Ic bar_color
defines the background color indices that can be used in
.Ic bar_format
markup sequences and is the fallback for colors that are left unspecified in
this option.
.It Ic bar_enabled
Set default
.Ic bar_toggle
state; default is 1.
.It Ic bar_enabled_ws Ns Bq Ar x
Set default
.Ic bar_toggle_ws
state on workspace
.Ar x ;
default is 1.
.It Ic bar_font
Fonts 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.
.Pp
The default is to use font set.
.Pp
If Xft is used, a comma-separated list of multiple fonts can be specified.
The first entry is the default font.
Any font defined here can then be selected in the status bar through the use of
the markup sequence
.Ic +@fn=n;\&
where n is the font index counting from 0.
.Pp
Also note that
.Xr dmenu 1
prior to 4.6 does not support Xft fonts.
.Pp
Xft examples:
.Bd -literal -offset indent
bar_font = Terminus:style=Regular:pixelsize=14:antialias=true

bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,Terminus:pixelsize=14,\
-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
.Ed
.Pp
Font set examples:
.Bd -literal -offset indent
bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*

bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,\
-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*,\
-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
.Ed
.Pp
To list the available fonts in your system see
.Xr fc-list 1
or
.Xr xlsfonts 1
manpages.
The
.Xr xfontsel 1
application can help with the XLFD setting.
.It Ic bar_font_color Ns Bq Ar x
Foreground color of the status bar(s) on screen number
.Ar x .
.Pp
A comma-separated list of multiple colors can be specified.
The first value is used as the default foreground color.
Any of these colors can then be selected as a foreground color in the status
bar through the use of the markup sequence
.Ic +@fg=n;\&
where n is the color index counting from 0.
.It Ic bar_font_color_free Ns Bq Ar x
Foreground color of a status bar for a focused region on screen number
.Ar x
when a workspace-free window is focused.
.Pp
A comma-separated list of multiple colors can be specified, with the same
syntax and behavior as
.Ic bar_font_color .
Default is rgb:ff/ff/ff.
.Pp
Note that
.Ic bar_font_color
defines the foreground color indices that can be used in
.Ic bar_format
markup sequences and is the fallback for colors that are left unspecified in
this option.
.It Ic bar_font_color_unfocus Ns Bq Ar x
Foreground color of status bar(s) for unfocused region(s) on screen number
.Ar x .
.Pp
A comma-separated list of multiple colors can be specified, with the same
syntax and behavior as
.Ic bar_font_color
for unfocused bar(s).
Defaults to the value of
.Ic bar_font_color .
.Pp
Note that
.Ic bar_font_color
defines the foreground color indices that can be used in
.Ic bar_format
markup sequences and is the fallback for colors that are left unspecified in
this option.
.It Ic bar_font_color_selected Ns Bq Ar x
Foreground color for selected
.Cm menu
items on screen number
.Ar x .
Defaults to the value of
.Ic bar_color .
.It Ic bar_font_pua
Specify a font to override the Unicode Private Use Area code points
(U+E000 -> U+F8FF, U+F0000 -> U+FFFFD, U+100000 -> U+10FFFD).
Some fonts use these code points to provide special icon glyphs.
Available only with Xft fonts.
.It Ic bar_format
Set the bar format string, overriding
.Ic clock_format
and all of the
.Ic enabled
options.
The format is passed through
.Xr strftime 3
before being used.
It may contain the following character sequences:
.Bl -column "Character sequence" "Replaced with" -offset indent
.It Sy "Character sequence" Ta Sy "Replaced with"
.It Li "+<" Ta "Pad with a space"
.It Li "+A" Ta "Output of the external script"
.It Li "+C" Ta "Window class (from WM_CLASS)"
.It Li "+D" Ta "Workspace name"
.It Li "+F" Ta "Focus status indicator"
.It Li "+I" Ta "Workspace index"
.It Li "+L" Ta "Workspace list indicator"
.It Li "+M" Ta "Number of iconic (minimized) windows in workspace"
.It Li "+N" Ta "Screen number"
.It Li "+P" Ta "Window class and instance separated by a colon"
.It Li "+R" Ta "Region index"
.It Li "+S" Ta "Stacking algorithm"
.It Li "+T" Ta "Window instance (from WM_CLASS)"
.It Li "+U" Ta "Urgency hint"
.It Li "+V" Ta "Program version"
.It Li "+w" Ta "Number of windows in workspace"
.It Li "+W" Ta "Window name (from _NET_WM_NAME/WM_NAME)"
.It Li "+|[weight][justify]" Ta Begin new section and reset markup
sequence effects.
.Pp
.Ic weight
is a positive integer used to allocate horizontal space between 'L', 'C'
and 'R' sections (see justify).
The default weight is 1.
.Pp
.Ic justify
can have the value L, C, R or T. L, C, R are for left, center and right
justified sections respectively.
A 'T' section will limit its space usage to fit to the text.
If no value is specified for a given section, the setting from
.Ic bar_justify
is used.
.It Li "++" Ta "A literal" Ql +
.It Li "+@" Ta "Prefix for text markup sequences"
.El
.Pp
The currently recognized text markup sequences are:
.Bl -column "Character sequence" "Action" -offset indent
.It Sy "Character sequence" Ta Sy "Action"
.It Li "+@fn=n;\&" Ta Selects font n (starting at 0) from
.Ic bar_font .
.It Li "+@fg=n;\&" Ta Selects foreground color n (starting at 0) from
.Ic bar_font_color .
.It Li "+@bg=n;\&" Ta Selects background color n (starting at 0) from
.Ic bar_color .
.It Li "+@stp;\&" Ta Stops the interpretation of markup sequences.
Any markup sequence found after +@stp will appear as normal characters in the
status bar.
.El
.Pp
Note that markup sequences in
.Ic bar_action
script output will only be processed if
.Ic bar_action_expand
is enabled.
.Pp
All character sequences may limit its output to a specific length, for
example +64A.
By default, no padding/alignment is done in case the length of the replaced
string is less than the specified length (64 in the example).
The padding/alignment can be enabled using a '_' character in the sequence.
For example: +_64W, +64_W and +_64_W enable padding before (right alignment),
after (left alignment), and both before and after (center alignment) window
name, respectively.
Any characters that do not match the specification are copied as-is.
.It Ic bar_justify
Justify the status bar text.
Possible values are
.Ar left ,
.Ar center ,
and
.Ar right .
.Pp
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
.Ic bar_format
option for more details.
.It Ic bar_workspace_limit
Set the maximum workspace index (counting from 1) to list in the status bar
workspace (+L) and urgency hint (+U) indicators.
Workspaces beyond this value will not be shown.
Default is 0 (disabled).
.It Ic bind Ns Bq Ar x
Bind key or button combo to action
.Ar x .
See the
.Sx BINDINGS
section below.
.It Ic border_width
Set window border thickness in pixels.
Disable all borders by setting to 0.
.It Ic boundary_width
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.
.It Ic cancelkey
Change the key used as an alternative means of terminating move/resize
operations.
Default is Escape.
.Pp
See the
.Sx BINDINGS
section below for details on how to find key names.
.It Ic click_to_raise
Enable or disable raising stacking priority when clicking on a window.
Default is 1.
.It Ic 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
.Ic bar_action
script.
.It Ic color_focus_free
Border color of the currently focused window that is in free mode.
Default is yellow.
.It Ic color_focus_maximized_free
Border color of the currently focused maximized window that is in free mode.
Defaults to the value of
.Ic color_focus_free .
.It Ic color_unfocus_free
Border color of unfocused windows that are in free mode, default is
rgb:88/88/00.
.It Ic color_unfocus_maximized_free
Border color of unfocused maximized windows that are in free mode.
Defaults to the value of
.Ic color_unfocus_free .
.It Ic color_urgent_free
Border color of urgent windows that are in free mode.
Defaults to the value of
.Ic color_unfocus_free .
.It Ic color_urgent_maximized_free
Border color of urgent maximized windows that are in free mode.
Defaults to the value of
.Ic color_urgent_free .
.It Ic color_focus
Border color of the currently focused window.
Default is red.
.It Ic color_focus_maximized
Border color of the currently focused, maximized window.
Defaults to the value of
.Ic color_focus .
.It Ic color_unfocus
Border color of unfocused windows, default is rgb:88/88/88.
.It Ic color_unfocus_maximized
Border color of unfocused, maximized windows.
Defaults to the value of
.Ic color_unfocus .
.It Ic color_urgent
Border color of urgent windows.
Defaults to the value of
.Ic color_unfocus .
.It Ic color_urgent_maximized
Border color of urgent, maximized windows.
Defaults to the value of
.Ic color_urgent .
.It Ic cycle_visible
Include workspaces that are mapped when switching with
.Ic ws_next ,
.Ic ws_prev ,
.Ic ws_next_all ,
.Ic ws_prev_all ,
.Ic ws_next_move ,
or
.Ic ws_prev_move .
Enable by setting to 1.
.Pp
Note that mapped workspaces will be swapped unless
.Ic workspace_clamp
is enabled.
If
.Ic warp_focus
is also enabled, focus will go to the region where the workspace is mapped.
.It Ic dialog_ratio
Some applications have dialogue windows that are too small to be useful.
This ratio adjusts the window/region size ratio for transient windows
having the TRANSSZ quirk.
For example, 0.6 is 60% of the the monitor size if the current region spans
the monitor.
.It Ic disable_border
Remove border when bar is disabled and there is only one window on the region.
Enable by setting to 1.
Setting this to
.Ar always
removes the border regardless of the bar being enabled/disabled.
Defaults to 0.
.It Ic focus_close
Window to put focus when the focused window is closed.
Possible values are
.Ar first ,
.Ar next ,
.Ar previous
(default),
.Ar last
and
.Ar prior .
.Ar next
and
.Ar previous
are relative to the window that is closed.
.Ar prior
is the last focused window in the workspace.
.It Ic 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.
.It Ic focus_default
Window to put focus when no window has been focused.
Possible values are
.Ar first
and
.Ar last
(default).
.It Ic focus_mark_none
Set the
.Ic bar_format
focus status indicator (+F) string to substitute when no window is focused.
Default is ''.
.It Ic focus_mark_normal
Set the
.Ic bar_format
focus status indicator (+F) string to substitute when a normal (not floating,
maximized or free) window is focused.
Default is ''.
.It Ic focus_mark_floating
Set the
.Ic bar_format
focus status indicator (+F) string to substitute when a floating window is
focused.
Default is '(f)'.
.It Ic focus_mark_free
Set the
.Ic bar_format
focus status indicator (+F) string to substitute when a window that is in
free mode is focused.
Default is '(*)'.
.It Ic focus_mark_maximized
Set the
.Ic bar_format
focus status indicator (+F) string to substitute when a maximized window is
focused.
Default is '(m)'.
.It Ic focus_mode Ns Bq Ar t
Set window focus behavior with respect to the pointer.
Possible values:
.Pp
.Bl -tag -width "default" -offset indent -compact
.It Ar default
Set window focus on border crossings caused by cursor motion and
window interaction.
.It Ar follow
Prioritize the pointer location.
Set window focus on all cursor border crossings, including workspace switches
and changes to layout.
.It Ar manual
Ignore the pointer location.
Set window focus on window interaction only.
.El
.Pp
Optionally, it is possible to adjust the focus mode for specific focus
situations.
A comma-separated list of the following situations can be specified for
.Ar t :
.Pp
.Bl -tag -width "uniconify" -offset indent -compact
.It Ar border
Pointer enters a window.
Default is
.Ar follow .
.It Ar configure
Window position/size changed by the client/EWMH.
Default is
.Ar manual .
.It Ar iconify
Window iconified.
Default is
.Ar manual .
.It Ar layout
Workspace layout changed.
Default is
.Ar manual .
.It Ar map
Window maps.
Default is
.Ar manual .
.It Ar move
Window moved to another workspace.
Default is
.Ar manual .
.It Ar startup
.Nm
(re)started.
Default is
.Ar manual .
.It Ar uniconify
Window uniconified.
Default is
.Ar manual .
.It Ar unmap
Window unmaps.
Default is
.Ar manual .
.It Ar workspace
Workspace switched.
Default is
.Ar manual .
.El
.Pp
Note that when
.Ar t
is omitted, the specified setting is applied to all focus situations.
Example:
.Bd -literal -offset indent
focus_mode = follow # Set all focus situations to 'follow'.
focus_mode[map,unmap] = manual # Change only map and unmap to 'manual'.
focus_mode = default # Reset all focus situations to respective default values.
.Ed
.It Ic fullscreen_hide_other
When a fullscreen window is focused and not in
.Ic below
state, hide unrelated windows in the same workspace.
Useful for transparent windows.
Defaults to 0.
.It Ic fullscreen_unfocus
Set handling when a fullscreen window loses focus.
Possible values:
.Pp
.Bl -tag -width "quick_belowXXX" -offset indent -compact
.It Ar none
Leave window fullscreen.
(default)
.It Ar restore
Exit fullscreen.
.It Ar iconify
Minimize/hide the window.
.It Ar float
Exit fullscreen and float window.
.It Ar below
Set
.Ic below
state on the window.
.It Ar quick_below
Set
.Ic below
state on the window, unset when refocused.
.El
.Pp
Note that this option is ignored in max layout.
.It Ic iconic_enabled
Display the number of iconic (minimized) windows in the status bar.
Enable by setting to 1.
.It Ic keyboard_mapping
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
.Sx KEYBOARD MAPPING FILES
section below for a list of keyboard mapping files that have been provided
for several keyboard layouts.
.Pp
Note that
.Pa /dev/null
can be specified if you only want to clear bindings.
.It Ic layout
Select layout to use at start-of-day.
Defined in the format
.Li ws Ns Bo Ar idx Bc : Ns Ar master_grow : Ns Ar master_add : Ns Ar \
stack_inc : Ns Ar always_raise : Ns Ar stack_mode ,
e.g. ws[2]:-4:0:1:0:horizontal sets workspace 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
.Ar stack_mode
values are
.Ar vertical ,
.Ar vertical_flip ,
.Ar horizontal ,
.Ar horizontal_flip ,
.Ar max
and
.Ar floating .
.Pp
See
.Ic master_grow ,
.Ic master_shrink ,
.Ic master_add ,
.Ic master_del ,
.Ic stack_inc ,
.Ic stack_dec ,
.Ic stack_balance ,
and
.Ic 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
.Ic layout
option.
.Pp
This setting is not retained at restart.
.It Ic layout_order
Define the layout sequence used by the
.Ic cycle_layout
action.
Possible values are
.Ar vertical ,
.Ar horizontal ,
.Ar max
and
.Ar floating .
At least one value must be specified, without duplicates.
The default is
.Ar vertical , Ns Ar horizontal , Ns Ar max , Ns Ar floating .
.It Ic max_layout_maximize
Automatically maximize windows in max layout.
Note that automatic maximize behavior is disabled for windows that are
unmaximized in max layout.
Maximizing the window or resetting the layout with
.Ic stack_reset
enables it again.
Enabled by default.
Disable by setting to 0.
.It Ic maximize_hide_bar
When set to 1,
.Ic maximize_toggle
will also hide/restore the bar visibility of the affected workspace.
Defaults to 0.
.It Ic maximize_hide_other
When a maximized window is focused and not in
.Ic below
state, hide unrelated windows in the same workspace.
Useful for transparent windows.
Defaults to 0.
.It Ic maximized_unfocus
Set handling when a maximized window loses focus.
Possible values:
.Pp
.Bl -tag -width "quick_belowXXX" -offset indent -compact
.It Ar none
Leave window maximized.
.It Ar restore
Unmaximize window.
(default)
.It Ar iconify
Minimize/hide the window.
.It Ar float
Unmaximize and float window.
.It Ar below
Set
.Ic below
state on the window.
.It Ar quick_below
Set
.Ic below
state on the window, unset when refocused.
.El
.Pp
Note that this option is ignored in max layout.
.It Ic modkey
Change the current modifier value of
.Ic MOD
in
.Ic bind
entries that come later in the configuration file.
For existing bindings, the new value is substituted for the previous value.
Possible values are
.Ar Mod1
(default),
.Ar Mod2 ,
.Ar Mod3 ,
.Ar Mod4
and
.Ar Mod5 .
.Pp
.Ar Mod1
is generally the Alt key,
.Ar Mod2
is the Command key on macOS and
.Ar Mod4
is the Windows key on a PC.
The current modifier key mapping can be found by running xmodmap(1).
.It Ic name
Set the name of a workspace at start-of-day.
Defined in the format
.Li ws Ns Bo Ar idx Bc : Ns Ar name ,
e.g. ws[1]:Console sets the name of workspace 1 to
.Dq Console .
.It Ic program Ns Bq Ar p
Define new action to spawn a program
.Ar p .
See the
.Sx PROGRAMS
section below.
.It Ic quirk Ns Bq Ar c Ns Bq : Ns Ar i Ns Bq : Ns Ar n Ns Bq : Ns Ar t
Add "quirk" for windows with class
.Ar c ,
instance
.Ar i
(optional), name
.Ar n
(optional), and type
.Ar t
(optional.)
See the
.Sx QUIRKS
section below.
.It Ic region
Allocates a custom region, removing any autodetected regions that occupy the
same space on the specified logical X screen number.
Defined in the format
.Li screen Ns Bo Ar idx Ns Bc : Ns Ar width Ns x Ns Ar height Ns + Ns Ar x Ns \
+ Ns Ar y Ns Bo , Ns Ar rotation Bc ,
e.g. screen[1]:800x1200+0+0 or screen[1]:800x1200+0+0,inverted (with optional
rotation).
.Pp
To make a region span multiple monitors, create a region big enough to cover
them all, e.g. screen[1]:2048x768+0+0 makes the region span two monitors with
1024x768 resolution sitting one next to the other.
.Pp
Possible values for the optional rotation argument are
.Ar normal
(default),
.Ar left ,
.Ar inverted
and
.Ar right .
Note that rotation is used by
.Ic workspace_autorotate .
.It Ic region_padding
Pixel width of empty space within region borders.
Disable by setting to 0.
.It Ic snap_range
Set the distance in pixels a tiled/maximized window must be moved (with the
pointer) to unsnap and float freely.
Set to 0 to unsnap immediately.
Default is 25.
.It Ic spawn_flags Ns Bq Ar p
If search pattern
.Ar p
is specified, change the spawn flags of existing program entries.
If
.Ar p
is omitted, change the default spawn flags for any
.Ic program
or
.Ic autorun
entries that come later in the configuration file.
Note that
.Ar p
is interpreted as a POSIX Extended Regular Expression.
.Pp
One or more of the following flags may be specified in a comma-separated list:
.Pp
.Bl -tag -width "markcurrentXXX" -offset indent -compact
.It Ar nospawnws
When the program is spawned, do not associate the spawn workspace with the
program's windows.
.It Ar xterm_fontadj
Enables automatic font size adjustments when resizing
.Xr xterm 1
windows.
Note that this works in conjunction with the
.Ic term_width
option and the
.Ic XTERM_FONTADJ
quirk.
See the
.Ic term_width
option and
.Sx QUIRKS
section for more information.
.It Ar optional
Disable program validation.
.It Ar none
No flags specified.
.El
.Pp
The default is
.Ar none .
.Pp
In addition to the
.Ql =
operator, this option also supports
.Ql +=
and
.Ql -=
to add/remove flags instead of replacing them.
.Pp
Note that the default of associating windows with the spawn workspace and the
.Ar xterm_fontadj
flag both rely on
.Pa libswmhack.so .
See the
.Sx SWMHACK
section below for more information.
.It Ic spawn_position
Position in stack to place newly spawned windows.
Possible values are
.Ar first ,
.Ar next ,
.Ar previous
and
.Ar last
(default).
.Ar next
and
.Ar previous
are relative to the focused window.
.It Ic stack_enabled
Enable or disable displaying the current stacking algorithm in the status bar.
.It Ic stack_mark_floating
Set the
.Ar floating
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[~]'.
.It Ic stack_mark_horizontal
Set the
.Ar horizontal
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[-]'.
.It Ic stack_mark_horizontal_flip
Set the
.Ar horizontal_flip
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[v]'.
.It Ic stack_mark_max
Set the
.Ar max
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[ ]'.
.It Ic stack_mark_vertical
Set the
.Ar vertical
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[|]'.
.It Ic stack_mark_vertical_flip
Set the
.Ar vertical_flip
layout mark for the
.Ic bar_format
stacking indicator (+S).
Default is '[>]'.
.It Ic term_width
Set a preferred minimum width for the terminal.
If this value is greater than 0,
.Nm
will attempt to adjust the font sizes in the terminal to keep the terminal
width above this number as the window is resized.
.Pp
Note that only
.Xr xterm 1
is currently supported.
The terminal process must be spawned with the
.Ar xterm_fontadj
spawn flag and the
.Ar XTERM_FONTADJ
quirk must be set on its window.
See the
.Ic spawn_flags
option and the
.Sx QUIRKS
section for more information.
In addition, the
.Xr 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
.Sx PROGRAMS
section) to use an alternate copy of the
.Xr xterm 1
binary without the setgid bit set.
.It Ic tile_gap
Pixel width of empty space between tiled windows.
Negative values cause overlap.
Set this to the opposite of
.Ic border_width
to collapse the border between tiles.
Disable by setting to 0.
.It Ic urgent_collapse
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.
.It Ic urgent_enabled
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
.Xr xterm 1 ,
for example, one needs to add the following line to
.Pa .Xdefaults :
.Bd -literal -offset indent
xterm.bellIsUrgent: true
.Ed
.It Ic verbose_layout
Enable or disable displaying the current master window count and stack
column/row count in the status bar.
Enable by setting to 1.
See
.Ar master_add ,
.Ar master_del ,
.Ar stack_inc
and
.Ar stack_dec
for more information.
.It Ic warp_focus
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
.Ar workspace_clamp
is enabled, focus on the region with the target workspace.
Enable by setting to 1.
.It Ic warp_pointer
Centers the pointer on the focused window when using bindings to change focus,
switch workspaces, change regions, etc.
Enable by setting to 1.
Note that this option is ignored in
.Ic focus_mode
situations set to
.Ar follow .
.It Ic window_class_enabled
Enable or disable displaying the window class name (from WM_CLASS) in the
status bar.
Enable by setting to 1.
.It Ic window_instance_enabled
Enable or disable displaying the window instance name (from WM_CLASS) in the
status bar.
Enable by setting to 1.
.It Ic window_name_enabled
Enable or disable displaying the window display name
(from _NET_WM_NAME/WM_NAME) in the status bar.
Enable by setting to 1.
.Pp
To prevent excessively large window names from pushing the remaining text off
the bar, it is limited to 64 characters, by default.
See the
.Ic bar_format
option for more details.
.It Ic workspace_autorotate
When moving workspaces across regions, auto-rotate vertical/horizontal layouts
based on rotation data from
.Xr xrandr 1 .
Enable by setting to 1.
.It Ic workspace_clamp
Prevents workspaces from being swapped when attempting to switch to a workspace
that is mapped to another region.
Use
.Ar warp_focus
if you want to focus on the region containing the workspace and
.Ar warp_pointer
if you want to also send the pointer.
Enable by setting to 1.
.It Ic workspace_indicator
Configure the status bar workspace indicator.
One or more of the following options may be specified in a comma-separated
list:
.Pp
.Bl -tag -width "markcurrentXXX" -offset indent -compact
.It Ar listcurrent
Include the current workspace.
.It Ar listactive
Include workspaces with windows.
.It Ar listempty
Include empty workspaces.
.It Ar listnamed
Include named workspaces.
.It Ar listurgent
Include workspaces with urgent window(s).
.It Ar listall
Include all workspaces.
.It Ar hidecurrent
Always exclude the current workspace from the list.
.It Ar markcurrent
Indicate the current workspace if it is in the list.
.It Ar markactive
Indicate workspaces in the list that are active.
.It Ar markempty
Indicate workspaces in the list that are empty.
.It Ar markurgent
Indicate workspaces in the list that contain urgent window(s).
.It Ar printnames
Display the names of named workspaces in the list.
.It Ar noindexes
Hide the index of the workspaces.
.El
.Pp
The default is
.Ar listcurrent , Ns Ar listactive , Ns Ar markcurrent , Ns Ar printnames
.Pp
Note that markup sequences can be used to style the workspace indicator.
For example, to change the color of the current workspace:
.Bd -literal -offset indent
workspace_mark_current = '+@fg=1;'
workspace_mark_current_suffix = '+@fg=0;'
.Ed
.It Ic workspace_limit
Set the total number of workspaces available.
Minimum is 1, maximum is 22, default is 10.
.It Ic workspace_mark_active
Set the string inserted before active workspaces in the
.Ic workspace_indicator .
Default is '^'.
.It Ic workspace_mark_active_suffix
Set the string inserted after active workspaces in the
.Ic workspace_indicator .
Default is '' (empty string).
.It Ic workspace_mark_current
Set the string inserted before the current workspace in the
.Ic workspace_indicator .
Default is '*'.
.It Ic workspace_mark_current_suffix
Set the string inserted after the current workspace in the
.Ic workspace_indicator .
Default is '' (empty string).
.It Ic workspace_mark_empty
Set the string inserted before empty workspaces in the
.Ic workspace_indicator .
Default is '-'.
.It Ic workspace_mark_empty_suffix
Set the string inserted after empty workspaces in the
.Ic workspace_indicator .
Default is '' (empty string).
.It Ic workspace_mark_urgent
Set the string inserted before urgent workspaces in the
.Ic workspace_indicator .
Default is '!'.
.It Ic workspace_mark_urgent_suffix
Set the string inserted after urgent workspaces in the
.Ic workspace_indicator .
Default is '' (empty string).
.El
.Sh STACK MODES
.Bl -tag -width "horizontal flipped"
.It Ic vertical
Master area is on the left and stack area is on the right.
Additional windows are vertically tiled in stack area.
.It Ic vertical flipped
Same as above but stack and master areas are swapped.
.It Ic horizontal
Master area is on the top and stack area is on the bottom.
Additional windows are horizontally tiled in stack area.
.It Ic horizontal flipped
Same as above but stack and master areas are swapped.
.It Ic max
The focused window occupies the whole region, except for the bar (if enabled).
.It Ic floating
Windows are untiled and can be resized and positioned.
.El
.Sh WINDOW STATES
These can be set/unset by the corresponding
.Ic toggle
actions listed in the
.Sx BINDINGS
section below.
.Bl -tag -width "fullscreen"
.It Ic floating
The window is stacked above others and is not in a tile;
it may be freely resized and positioned.
.It Ic below
The window is floating, but stacked below others.
.It Ic maximized
The window occupies the work area of the region (area that excludes space
reserved by the bar, docks/panels, etc.)
By default, focusing another window removes the maximized state of the window.
See
.Ic maximized_unfocus
to configure unfocused behavior.
.It Ic fullscreen
The window occupies the whole region.
By default, focusing another window does not remove the fullscreen state of the
window.
See
.Ic fullscreen_unfocus
to configure unfocused behavior.
.It Ic free
The window is floating, but not bound by regions, workspaces or their layouts.
It is always mapped, unless iconified, and may be resized and positioned
anywhere.
.El
.Sh PROGRAMS
.Nm
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
.Sx BINDINGS
section below.
.Pp
Custom programs in the configuration file are specified as follows:
.Pp
.Dl program Ns Bo Ar action Bc = Ar progpath Op Ar arg Op Ar arg ...
.Pp
.Ar action
is any identifier that does not conflict with a built-in action or keyword,
.Ar progpath
is the desired program, and
.Ar arg
is zero or more arguments to the program.
.Pp
With the exception of '~' expansion, program calls are executed as-is without
any interpretation.
A shell can be called to execute shell commands.
(e.g. sh -c 'command string').
.Pp
Remember that when using
.Ql #
in your program call, it must be escaped with a backslash, i.e. \e#
.Pp
The following argument variables are replaced with values at the time the
program is spawned:
.Pp
.Bl -tag -width "$bar_font_color" -offset indent -compact
.It Cm $bar_border
.It Cm $bar_color
.It Cm $bar_color_selected
.It Cm $bar_font
.It Cm $bar_font_color
.It Cm $bar_font_color_selected
.It Cm $color_focus
.It Cm $color_unfocus
.It Cm $color_urgent
.It Cm $dmenu_bottom
\-b if
.Ic bar_at_bottom
is enabled, otherwise '' (empty string.)
.It Cm $region_index
.It Cm $workspace_index
.El
.Pp
Example:
.Bd -literal -offset indent
program[ff] = /usr/local/bin/firefox http://spectrwm.org/
bind[ff] = MOD+Shift+b # Now M-S-b launches firefox
.Ed
.Pp
To cancel the previous, unbind it:
.Bd -literal -offset indent
bind[] = MOD+Shift+b
.Ed
.Pp
A number of built-in actions spawn a program as part of their implementation.
The respective default program entries are as follows:
.Pp
.Bl -tag -width "screenshot_wind" -offset indent -compact
.It Cm term
xterm
.It Cm lock
xlock
.It Cm menu
dmenu_run $dmenu_bottom \-fn $bar_font \-nb $bar_color \-nf $bar_font_color
\-sb $bar_color_selected \-sf $bar_font_color_selected
.It Cm search
dmenu $dmenu_bottom \-i \-fn $bar_font \-nb $bar_color \-nf $bar_font_color
\-sb $bar_color_selected \-sf $bar_font_color_selected
.It Cm name_workspace
dmenu $dmenu_bottom \-p Workspace \-fn $bar_font \-nb $bar_color \-nf
$bar_font_color \-sb $bar_color_selected \-sf $bar_font_color_selected
.It Cm initscr
initscreen.sh        # optional
.It Cm screenshot_all
screenshot.sh full   # optional
.It Cm screenshot_wind
screenshot.sh window # optional
.El
.Pp
Note that
.Cm search
is required by the
.Cm search_win ,
.Ic search_workspace ,
and
.Ic uniconify
actions and does not have a direct binding.
.Pp
With the exception of the default entries marked
.Dq optional ,
validation is performed to ensure the program exists.
If validation fails, the exception can be resolved by installing the program,
adding the
.Ar optional
flag to the program entry's spawn flags, or by disabling the program entry by
freeing the respective binding.
.Pp
For example, to add the
.Ic optional
flag to
.Ic lock :
.Bd -literal -offset indent
spawn_flags[lock] += optional
.Ed
.Pp
To unbind
.Ic lock
and prevent it from being validated:
.Bd -literal -offset indent
bind[] = MOD+Shift+Delete
.Ed
.Pp
Note that when a program is spawned,
.Nm
aims to place its windows in its spawn workspace.
See the
.Sx SWMHACK
section below for more information, tips, and workarounds if a program fails to
spawn in the correct workspace.
.Sh BINDINGS
.Nm
provides many functions (or actions) accessed via key or pointer button
bindings.
.Pp
The default bindings are listed below:
.Pp
.Bl -tag -width "M-j, M-<TAB>XXXXXX" -offset indent -compact
.It Aq Cm Button1
focus
.It Cm M- Ns Aq Cm Button1
move
.It Cm M- Ns Aq Cm Button3
resize
.It Cm M-S- Ns Aq Cm Button3
resize_centered
.It Cm M-S- Ns Aq Cm Return
term
.It Cm M-p
menu
.It Cm M-S-q
quit
.It Cm M-q
restart
.It Aq Ar unbound
restart_of_day
.It Cm M- Ns Aq Cm Space
cycle_layout
.It Cm M-S-\e
flip_layout
.It Aq Ar unbound
prior_layout
.It Aq Ar unbound
layout_vertical
.It Aq Ar unbound
layout_horizontal
.It Aq Ar unbound
layout_max
.It Aq Ar unbound
layout_floating
.It Cm M-S- Ns Aq Cm Space
stack_reset
.It Aq Ar unbound
stack_balance
.It Cm M-h
master_shrink
.It Cm M-l
master_grow
.It Cm M-,\&
master_add
.It Cm M-.\&
master_del
.It Cm M-S-,\&
stack_inc
.It Cm M-S-.\&
stack_dec
.It Cm M- Ns Aq Cm Return
swap_main
.It Xo
.Cm M-j ,
.Cm M- Ns Aq Cm TAB
.Xc
focus_next
.It Xo
.Cm M-k ,
.Cm M-S- Ns Aq Cm TAB
.Xc
focus_prev
.It Cm M-m
focus_main
.It Cm M-\(ga
focus_free
.It Cm M-S-a
focus_prior
.It Cm M-u
focus_urgent
.It Cm M-S-j
swap_next
.It Cm M-S-k
swap_prev
.It Cm M-b
bar_toggle
.It Cm M-S-b
bar_toggle_ws
.It Cm M-x
wind_del
.It Cm M-S-x
wind_kill
.It Cm M- Ns Aq Ar 1-9,0,F1-F12
.Pf ws_ Aq Ar 1-22
.It Cm M-S- Ns Aq Ar 1-9,0,F1-F12
.Pf mvws_ Ns Aq Ar 1-22
.It Cm M- Ns Aq Ar Keypad 1-9
.Pf rg_ Aq Ar 1-9
.It Cm M-S- Ns Aq Ar Keypad 1-9
.Pf mvrg_ Aq Ar 1-9
.It Aq Ar unbound
mvrg_next
.It Aq Ar unbound
mvrg_prev
.It Aq Ar unbound
ws_empty
.It Aq Ar unbound
ws_empty_move
.It Cm M- Ns Aq Cm Right
ws_next
.It Cm M- Ns Aq Cm Left
ws_prev
.It Cm M- Ns Aq Cm Up
ws_next_all
.It Cm M- Ns Aq Cm Down
ws_prev_all
.It Cm M-a
ws_prior
.It Cm M-S- Ns Aq Cm Down
ws_prev_move
.It Cm M-S- Ns Aq Cm Up
ws_next_move
.It Cm M-S- Ns Aq Cm Right
rg_next
.It Cm M-S- Ns Aq Cm Left
rg_prev
.It Aq Ar unbound
rg_move_next
.It Aq Ar unbound
rg_move_prev
.It Cm M-s
screenshot_all
.It Cm M-S-s
screenshot_wind
.It Cm M-S-v
version
.It Cm M-t
float_toggle
.It Cm M-S-t
below_toggle
.It Cm M-S-\(ga
free_toggle
.It Cm M-S- Ns Aq Cm Delete
lock
.It Cm M-S-i
initscr
.It Cm M-w
iconify
.It Cm M-S-w
uniconify
.It Cm M-e
maximize_toggle
.It Cm M-S-e
fullscreen_toggle
.It Cm M-r
raise
.It Cm M-S-r
always_raise
.It Cm M-v
button2
.It Cm M--
width_shrink
.It Cm M-=
width_grow
.It Cm M-S--
height_shrink
.It Cm M-S-=
height_grow
.It Cm M-[
move_left
.It Cm M-]\&
move_right
.It Cm M-S-[
move_up
.It Cm M-S-]\&
move_down
.It Cm M-S-/
name_workspace
.It Cm M-/
search_workspace
.It Cm M-f
search_win
.It Cm M-d
debug_toggle (debug mode only)
.It Cm M-S-d
dumpwins (debug mode only)
.El
.Pp
The action names and descriptions are listed below:
.Pp
.Bl -tag -width "layout_horizontalX" -offset indent -compact
.It Cm focus
Focus window/region under pointer.
.It Cm move
Move window with pointer while binding is pressed.
.It Cm resize
Resize window with pointer while binding is pressed.
.It Cm resize_centered
Same as
.Ic resize
but keep window centered.
.It Cm term
Spawn a new terminal (see
.Sx PROGRAMS
above).
.It Cm menu
Menu (see
.Sx PROGRAMS
above).
.It Cm quit
Quit
.Nm .
.It Cm restart
Restart
.Nm .
.It Cm restart_of_day
Same as
.Ic restart
but configuration file is loaded in full.
.It Cm cycle_layout
Switch to the next layout.
.It Cm flip_layout
Swap the master and stacking areas.
.It Cm prior_layout
Switch to the last used layout.
.It Cm layout_vertical
Switch to vertical layout.
.It Cm layout_horizontal
Switch to horizontal layout.
.It Cm layout_max
Switch to max layout.
.It Cm layout_floating
Switch to floating layout.
.It Cm stack_reset
Reset layout.
.It Cm stack_balance
Balance master/stacking area.
.It Cm master_shrink
Shrink master area.
.It Cm master_grow
Grow master area.
.It Cm master_add
Add windows to master area.
.It Cm master_del
Remove windows from master area.
.It Cm stack_inc
Add columns/rows to stacking area.
.It Cm stack_dec
Remove columns/rows from stacking area.
.It Cm swap_main
Move current window to master area.
.It Cm focus_next
Focus next window in workspace.
.It Cm focus_prev
Focus previous window in workspace.
.It Cm focus_main
Focus on main window in workspace.
.It Cm focus_prior
Focus last focused window in workspace.
.It Cm focus_free
Focus on a window in free mode, if any.
.It Cm focus_urgent
Focus on next window with the urgency hint flag set.
The workspace is switched if needed.
.It Cm swap_next
Swap with next window in workspace.
.It Cm swap_prev
Swap with previous window in workspace.
.It Cm bar_toggle
Toggle overall visibility of status bars.
.It Cm bar_toggle_ws
Toggle status bar on current workspace.
.It Cm wind_del
Delete current window.
.It Cm wind_kill
Kill the program that created the current window.
.It Cm ws_ Ns Ar n
Switch to workspace
.Ar n ,
where
.Ar n
is 1 through
.Ic workspace_limit .
.It Cm mvws_ Ns Ar n
Move current window to workspace
.Ar n ,
where
.Ar n
is 1 through
.Ic workspace_limit .
.It Cm rg_ Ns Ar n
Focus on region
.Ar n ,
where
.Ar n
is 1 through 9.
.It Cm mvrg_ Ns Ar n
Move current window to region
.Ar n ,
where
.Ar n
is 1 through 9.
.It Cm mvrg_next
Move current window to workspace in next region.
.It Cm mvrg_prev
Move current window to workspace in previous region.
.It Cm ws_empty
Switch to the first empty workspace.
.It Cm ws_empty_move
Switch to the first empty workspace and move current window.
.It Cm ws_next
Switch to next workspace with a window in it.
.It Cm ws_prev
Switch to previous workspace with a window in it.
.It Cm ws_next_all
Switch to next workspace.
.It Cm ws_prev_all
Switch to previous workspace.
.It Cm ws_next_move
Switch to next workspace with the current window.
.It Cm ws_prev_move
Switch to previous workspace with the current window.
.It Cm ws_prior
Switch to last visited workspace.
.It Cm rg_next
Switch to next region.
.It Cm rg_prev
Switch to previous region.
.It Cm rg_move_next
Switch to next region and move current workspace.
.It Cm rg_move_prev
Switch to previous region and move current workspace.
.It Cm screenshot_all
Take screenshot of entire screen (if enabled) (see
.Sx PROGRAMS
above).
.It Cm screenshot_wind
Take screenshot of selected window (if enabled) (see
.Sx PROGRAMS
above).
.It Cm version
Toggle version in status bar.
.It Cm float_toggle
Toggle focused window between tiled and floating.
.It Cm below_toggle
Toggle
.Ic below
state on current window.
.It Cm free_toggle
Toggle focused window between workspace mode and free mode.
.It Cm lock
Lock screen (see
.Sx PROGRAMS
above).
.It Cm initscr
Reinitialize physical screens (see
.Sx PROGRAMS
above).
.It Cm iconify
Minimize (unmap) currently focused window.
.It Cm uniconify
Restore (map) window returned by
.Xr dmenu 1
selection.
.It Cm maximize_toggle
Toggle maximization of focused window.
.It Cm fullscreen_toggle
Toggle fullscreen state of focused window.
.It Cm raise
Raise the current window.
.It Cm always_raise
When set tiled windows are allowed to obscure floating windows.
.It Cm button2
Fake a middle mouse button click (Button2).
.It Cm width_shrink
Shrink the width of a floating window.
.It Cm width_grow
Grow the width of a floating window.
.It Cm height_shrink
Shrink the height of a floating window.
.It Cm height_grow
Grow the height of a floating window.
.It Cm move_left
Move a floating window a step to the left.
.It Cm move_right
Move a floating window a step to the right.
.It Cm move_up
Move a floating window a step upwards.
.It Cm move_down
Move a floating window a step downwards.
.It Cm name_workspace
Name the current workspace.
.It Cm search_workspace
Search for a workspace.
.It Cm search_win
Search the windows in the current workspace.
.It Cm debug_toggle
Toggles debug overlay.
(debug mode only)
.It Cm dumpwins
Dump current window/focus/stacking state to debug log.
(debug mode only)
.El
.Pp
Custom bindings in the configuration file are specified as follows:
.Pp
.Dl bind Ns Bo Ar action Bc = Ar combo
.Pp
.Ar action
is one of the actions listed above (or empty to unbind) and
.Ar combo
is in the form of zero or more modifier keys and/or special arguments
(Mod1, Shift, Control, MOD, etc.) and a normal key (b, Space, etc)
or a button (Button1 .. Button255), separated by
.Ql + .
Multiple key/button combinations may be bound to the same action.
.Pp
Special arguments:
.Pp
.Bl -tag -width "anymodxxxx" -offset indent -compact
.It Cm MOD
Substituted for the currently defined
.Ic modkey .
.It Cm ANYMOD
Select all modifier combinations not handled by another binding.
.It Cm REPLAY
Reprocess binding press/release events for other programs to handle.
Unavailable for
.Ic move ,
.Ic resize
and
.Ic resize_centered .
.El
.Pp
.Cm MOD
example:
.Bd -literal -offset indent
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.
.Ed
.Pp
.Cm ANYMOD
example:
.Bd -literal -offset indent
bind[focus] = ANYMOD+Button3
bind[move] = MOD+Button3
.Ed
.Pp
In the above example,
.Cm M- Ns Aq Cm Button3
initiates
.Ic move
and
.Aq Cm Button3
pressed with any other combination of modifiers sets focus to the window/region
under the pointer.
.Pp
.Cm REPLAY
example:
.Bd -literal -offset indent
bind[focus] = REPLAY+Button3
.Ed
.Pp
In the above example, when
.Aq Cm 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.
.Pp
To bind non-latin characters such as \[oa] or \[*p] you must enter the xkb
character name instead of the character itself.
Run
.Xr xev 1 ,
focus the window and press the specific key and in the terminal output read
the symbol name.
In the following example for \[oa]:
.Bd -literal -offset indent
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) "\[oa]"
    XmbLookupString gives 2 bytes: (c3 a5) "\[oa]"
    XFilterEvent returns: False
.Ed
.Pp
The xkb name is aring.
In other words, in
.Pa spectrwm.conf
add:
.Bd -literal -offset indent
bind[program] = MOD+aring
.Ed
.Pp
To clear all default keyboard bindings and specify your own, see the
.Ic keyboard_mapping
option.
.Sh KEYBOARD MAPPING FILES
Keyboard mapping files for several keyboard layouts are listed below.
These files can be used with the
.Ic keyboard_mapping
setting to load pre-defined key bindings for the specified keyboard layout.
.Pp
.Bl -tag -width "spectrwm_XX.confXXX" -offset indent -compact
.It Cm spectrwm_cz.conf
Czech Republic keyboard layout
.It Cm spectrwm_es.conf
Spanish keyboard layout
.It Cm spectrwm_fr.conf
French keyboard layout
.It Cm spectrwm_fr_ch.conf
Swiss French keyboard layout
.It Cm spectrwm_se.conf
Swedish keyboard layout
.It Cm spectrwm_us.conf
United States keyboard layout
.El
.Sh QUIRKS
.Nm
provides "quirks" which handle windows that must be treated specially in a
tiling window manager, such as some dialogs and fullscreen apps.
.Pp
The default quirks are described below:
.Pp
.Bl -tag -width "OpenOffice.org N.M:VCLSalFrame<TAB>XXX" -offset indent \
-compact
.It .*:.*:.*:splash,dialog
FLOAT
.It .*:.*:.*:toolbar,utility
FLOAT + ANYWHERE
.It .*:.*:.*:notification
FLOAT + ANYWHERE + MINIMALBORDER + NOFOCUSONMAP
.It Firefox\-bin:firefox\-bin
TRANSSZ
.It Firefox:Dialog
FLOAT
.It Gimp:gimp
FLOAT + ANYWHERE
.It MPlayer:xv
FLOAT + FULLSCREEN + FOCUSPREV
.It OpenOffice.org 2.4:VCLSalFrame
FLOAT
.It OpenOffice.org 3.1:VCLSalFrame
FLOAT
.It pcb:pcb
FLOAT
.It xine:Xine Window
FLOAT + ANYWHERE
.It xine:xine Panel
FLOAT + ANYWHERE
.It xine:xine Video Fullscreen Window
FULLSCREEN + FLOAT
.It Xitk:Xitk Combo
FLOAT + ANYWHERE
.It Xitk:Xine Window
FLOAT + ANYWHERE
.It XTerm:xterm
XTERM_FONTADJ
.El
.Pp
The quirks themselves are described below:
.Pp
.Bl -tag -width "XTERM_FONTADJ<TAB>XXX" -offset indent -compact
.It ANYWHERE
Allow window to position itself, uncentered.
.It BELOW
Put the window into below state upon being managed.
.It FLOAT
This window should not be tiled, but allowed to float freely.
.It FOCUSONMAP_SINGLE
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
.Ic focus_mode
is set to
.Ar follow .
.It FOCUSPREV
On exit force focus on previously focused application not previous application
in the stack.
.It FULLSCREEN
Remove border to allow window to use full region size.
.It ICONIFY
Hide/minimize the window upon being managed.
.It IGNOREPID
Ignore the PID when determining the initial workspace for a new window.
Especially useful for terminal windows that share a process.
.It IGNORESPAWNWS
Ignore the spawn workspace when determining the initial workspace for a new
window.
.It MAXIMIZE
Put the window into maximized state upon being managed.
.It MINIMALBORDER
Remove border when window is unfocused and floating.
.It NOFOCUSCYCLE
Remove from normal focus cycle (focus_prev or focus_next). The window can still
be focused using search_win.
.It NOFOCUSONMAP
Do not change focus to the window when it first appears on the screen.
Has no effect when
.Ic focus_mode
is set to
.Ar follow .
.It OBEYAPPFOCUSREQ
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.
.It TRANSSZ
Adjusts size on transient windows that are too small using
.Ic dialog_ratio
(see
.Sx CONFIGURATION FILES ) .
.It WS Ns Bq Ar n
Force a new window to appear on workspace
.Ar n .
Specify -1 to put the window into free mode so that it is mapped independent
of workspaces and regions.
.It XTERM_FONTADJ
Adjust
.Xr xterm 1
fonts when resizing.
Note that this requires the
.Ar xterm_fontadj
spawn flag to be set on the autorun/program entry when the program is spawned.
See the
.Ic spawn_flags
option for information on how to enable it.
.El
.Pp
Custom quirks in the configuration file are specified as follows:
.Pp
.Dl quirk Ns Bo Ar class Ns Bo : Ns Ar instance Ns Bo : Ns Ar name Ns Bo : Ns \
Ar type Bc Bc Bc Bc {=|+=|-=} Ar quirk Op + Ar quirk ...
.Pp
.Ar class ,
.Ar instance
(optional),
.Ar name
(optional), and
.Ar type
(optional) are used to determine which window(s) the quirk(s) apply to.
.Ar class
and
.Ar instance
are regex search patterns for the respective fields of the WM_CLASS window
property.
.Ar name
is a regex search pattern for the window name (WM_NAME/_NET_WM_NAME.)
.Ar type
is a comma-separated list of zero or more of the following window types
(_NET_WM_WINDOW_TYPE):
.Ic desktop ,
.Ic dock ,
.Ic toolbar ,
.Ic menu ,
.Ic utility ,
.Ic splash ,
.Ic dialog ,
.Ic dropdown_menu ,
.Ic popup_menu ,
.Ic tooltip ,
.Ic notification ,
.Ic combo ,
.Ic dnd ,
and
.Ic normal .
Leave this field blank to match any window type.
.Ar quirk
is one of the quirks from the list above.
.Pp
When a window is managed, quirk entries are applied in the order specified in
the configuration file.
The assignment operator determines how the quirks are applied.
When assigning quirks with
.Ql = ,
quirks are replaced on matching windows.
To add or remove quirks, assign them with
.Ql +=
or
.Ql -=
instead.
.Pp
Note that patterns are interpreted as POSIX Extended Regular Expressions.
Any ':', '[' or ']' must be escaped with '\e'.
See
.Xr regex 7
for more information on POSIX Extended Regular Expressions.
.Pp
For example:
.Bd -literal -offset indent
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[\e[0-9\e].*:.*:\e[\e[\e:alnum\e:\e]\e]*] = 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 the default quirk entry.
quirk[.*:ws10] += WS[10] # Force windows with a WM_CLASS name of 'ws10' to \
workspace 10 without removing existing quirks.
quirk[.*:.*:.*:splash,dialog] = FLOAT + ANYWHERE # Override default quirk entry.
.Ed
.Pp
You can obtain
.Ar class ,
.Ar instance
and
.Ar name
by running
.Xr xprop 1
and then clicking on the desired window.
In the following example the main window of Firefox was clicked:
.Bd -literal -offset indent
$ 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"
.Ed
.Pp
Note that
.Xr xprop 1
displays WM_CLASS as:
.Bd -literal -offset indent
WM_CLASS(STRING) = "<instance>", "<class>"
.Ed
.Pp
In the example above the quirk entry would be:
.Bd -literal -offset indent
quirk[Firefox:Navigator] = FLOAT
.Ed
.Pp
.Nm
also automatically assigns quirks to windows based on the value of the window's
_NET_WM_WINDOW_TYPE property as follows:
.Pp
.Bl -tag -width "_NET_WM_WINDOW_TYPE_TOOLBAR<TAB>XXX" -offset indent -compact
.It _NET_WM_WINDOW_TYPE_TOOLBAR
FLOAT + ANYWHERE
.It _NET_WM_WINDOW_TYPE_UTILITY
FLOAT + ANYWHERE
.It _NET_WM_WINDOW_TYPE_SPLASH
FLOAT
.It _NET_WM_WINDOW_TYPE_DIALOG
FLOAT
.El
.Pp
In all other cases, no automatic quirks are assigned to the window.
Quirks specified in the configuration file override the automatic quirks.
.Sh EWMH
.Nm
partially implements the Extended Window Manager Hints (EWMH) specification.
This enables controlling windows as well as
.Nm
itself from external scripts and programs.
This is achieved by
.Nm
responding to certain ClientMessage events.
From the terminal these events can be conveniently sent using tools such as
.Xr wmctrl 1
and
.Xr xdotool 1 .
For the actual format of these ClientMessage events, see the EWMH
specification.
.Pp
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
.Xr xprop 1
and
.Xr grep 1 :
.Bd -literal -offset indent
$ WINDOWID=`xprop \-root _NET_ACTIVE_WINDOW | grep \-o "0x.*"`
$ xprop \-id $WINDOWID _NET_WM_NAME | grep \-o "\e".*\e""
.Ed
.Pp
A window can be focused by sending a _NET_ACTIVE_WINDOW client message to the
root window.
For example, using
.Xr wmctrl 1
to send the message
(assuming 0x4a0000b is the id of the window to be focused):
.Bd -literal -offset indent
$ wmctrl \-i \-a 0x4a0000b
.Ed
.Pp
Windows can be closed by sending a _NET_CLOSE_WINDOW client message to the root
window.
For example, using
.Xr wmctrl 1
to send the message
(assuming 0x4a0000b is the id of the window to be closed):
.Bd -literal -offset indent
$ wmctrl \-i \-c 0x4a0000b
.Ed
.Pp
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
.Xr wmctrl 1
to send the message (assuming 0x4a0000b is the id of the window to be floated
or un-floated):
.Bd -literal -offset indent
$ wmctrl \-i \-r 0x4a0000b \-b toggle,above
.Ed
.Pp
Windows can also be iconified and un-iconified by substituting
_NET_WM_STATE_HIDDEN for _NET_WM_STATE_ABOVE in the previous example:
.Bd -literal -offset indent
$ wmctrl \-i \-r 0x4a0000b \-b toggle,hidden
.Ed
.Pp
Floating windows can also be resized and moved by sending a
_NET_MOVERESIZE_WINDOW client message to the root window.
For example, using
.Xr wmctrl 1
to send the message (assuming 0x4a0000b is the id of the window to be
resize/moved):
.Bd -literal -offset indent
$ wmctrl \-i \-r 0x4a0000b \-e 0,100,50,640,480
.Ed
.Pp
This moves the window to (100,50) and resizes it to 640x480.
.Pp
Note that if a window has been manually positioned via binding,
_NET_MOVERESIZE_WINDOW requests are ignored unless the window has the ANYWHERE
quirk, the workspace is in floating layout, or the window is workspace-free.
Requests are also ignored on maximized and fullscreen windows.
.Sh SWMHACK
When spawning a program via an
.Ic autorun
or
.Ic program
entry without the
.Ar nospawnws
flag,
.Nm
aims to place the program's windows (if any) in its spawn workspace.
To accomplish this "spawn-in-workspace" behavior,
.Nm
must determine the intended spawn workspace when managing a new window.
Since it cannot be done with X11 alone,
.Pa libswmhack.so
is included to make this feature possible.
.Pp
When a program is spawned,
.Nm
automatically sets
.Pa LD_PRELOAD
and
.Pa _SWM_WS
in the program's spawn environment to enable
.Pa libswmhack.so
when it is executed.
Note that
.Pa LD_PRELOAD
is the path to
.Pa libswmhack.so
and
.Pa _SWM_WS
is the spawn workspace for any windows created by the program.
.Pp
When running programs from terminals, scripts, etc, the inherited environment
may need to be configured.
It is possible to override the spawn workspace by setting
.Pa _SWM_WS
to a different value.
Alternatively,
.Pa _SWM_WS
can be
.Xr unset 1
or set to a blank value to disable
"spawn-in-workspace" behavior.
Note that workspaces are counted from 0.
.Sq -1
can be specified to put windows into workspace-free mode.
.Pp
For example, to play a video with
.Xr mpv 1
on workspace 10 without changing the spawn workspace in the environment:
.Bd -literal -offset indent
$ _SWM_WS=9 mpv video.mkv
.Ed
.Pp
Play the video in free mode so that it remains mapped when switching workspaces.
.Bd -literal -offset indent
$ _SWM_WS=-1 mpv video.mkv
.Ed
.Pp
Disable "spawn-in-workspace" in the environment so that new windows map on
whichever workspace happens to be focused.
.Bd -literal -offset indent
$ unset _SWM_WS
.Ed
.Pp
Change the environment to spawn programs in free mode.
.Bd -literal -offset indent
$ export _SWM_WS=-1
.Ed
.Pp
When spawning a program that creates windows via a daemon, ensure the daemon is
started with the correct
.Pa LD_PRELOAD
in its environment.
.Pp
For example, when starting
.Xr urxvtd 1
via
.Xr xinit 1 ,
.Pa LD_PRELOAD
must be specified.
.Bd -literal -offset indent
LD_PRELOAD=/usr/lib/libswmhack.so.0.0 urxvtd -q -o -f
.Ed
.Pp
Note that some operating systems may ignore
.Pa LD_PRELOAD
if certain conditions are not met.
It is advised to check the man page of
.Pa ld.so .
.Pp
In situations where
.Pa libswmhack.so
cannot be used, it is possible to use a quirk to spawn a program in a specific
workspace.
.Pp
e.g. launch an
.Xr xterm 1
in workspace 2 on startup:
.Bd -literal -offset indent
quirk[XTerm:ws2] += WS[2]
autorun = ws[2]:xterm -name ws2
.Ed
.Pp
Launch a
.Xr chromium 1
window in workspace 3 on startup:
.Bd -literal -offset indent
quirk[Chromium:chromium:ws3] += WS[3]
autorun = ws[3]:chromium --window-name="ws3" --new-window
.Ed
.Pp
If the "spawn-in-workspace" behavior is not desired, it is possible to disable
it before programs are spawned by setting the
.Ar nospawnws
spawn flag on spawn entries via the
.Ic spawn_flags
option:
.Bd -literal -offset indent
# Make 'nospawnws' the default for any autorun/program entries that are
# added/replaced below this line in the configuration file:
spawn_flags = nospawnws
program[pcmanfm] = pcmanfm -n  # 'nospawnws' is set
autorun = ws[1]:firefox        # ws[1] is ignored since 'nospawnws' is set
program[lock] = xlock          # the replaced default entry has 'nospawnws' set

# Add 'nospawnws' to an existing entry:
spawn_flags[term] += nospawnws
.Ed
.Pp
Alternatively, the
.Pa IGNORESPAWNWS
and
.Pa IGNOREPID
quirks can be applied to windows:
.Bd -literal -offset indent
# Disable spawn-in-workspace on PCManFM windows:
quirk[Pcmanfm] = IGNORESPAWNWS

# Disable spawn-in-workspace on all windows, including those spawned via \
autorun:
quirk[.*] += IGNORESPAWNWS + IGNOREPID
.Ed
.Pp
Note that XCB programs that roll their own X11 requests (e.g. Chromium) are
currently unsupported by
.Pa libswmhack.so .
.Sh SIGNALS
Sending
.Nm
a HUP signal will restart it.
.Sh FILES
.Bl -tag -width "/etc/spectrwm.confXXX" -compact
.It Pa ~/.spectrwm.conf
.Nm
user specific settings.
.It Pa /etc/spectrwm.conf
.Nm
global settings.
.El
.Sh HISTORY
.Nm
was inspired by xmonad & dwm.
.Sh AUTHORS
.An -nosplit
.Nm
was written by:
.Pp
.Bl -tag -width "Ryan Thomas McBride Aq mcbride@countersiege.com " -offset \
indent -compact
.It An Marco Peereboom Aq Mt marco@peereboom.us
.It An Ryan Thomas McBride Aq Mt mcbride@countersiege.com
.It An Darrin Chandler Aq Mt dwchandler@stilyagin.com
.It An Pierre-Yves Ritschard Aq Mt pyr@spootnik.org
.It An Tuukka Kataja Aq Mt stuge@xor.fi
.It An Jason L. Wright Aq Mt jason@thought.net
.It An Reginald Kennedy Aq Mt rk@rejii.com
.It An Lawrence Teo Aq Mt lteo@lteo.net
.It An Tiago Cunha Aq Mt tcunha@gmx.com
.It An David Hill Aq Mt dhill@mindcry.org
.El