---
name: "spectrwm"
section: "1"
platform: "linux"
package: "spectrwm"
version: "3.6.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/spectrwm"
---

# spectrwm(1)

window manager for X11

## NAME

**spectrwm** – window manager for X11

## SYNOPSIS

**spectrwm** \[**-c** *file*\] \[**-v**\]

## OPTIONS

- **-c** *file*

  Specify a configuration file to load instead of scanning for one.

- **-d**

  Enable debug mode and logging to stderr.

- **-v**

  Print version and exit.

## DESCRIPTION

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

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

The following notation is used throughout this page:

- **M**

  Meta

- **S**

  Shift

- ⟨**Name**⟩

  Named key or button

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

## CONFIGURATION FILES

**spectrwm** looks for the user-configuration file in the following order:

1. *$XDG\_CONFIG\_HOME/spectrwm/spectrwm.conf*

2. *~/.config/spectrwm/spectrwm.conf* (if *$XDG\_CONFIG\_HOME* is either not set or empty)

3. *~/.spectrwm.conf*.

If the user-configuration file is not found, **spectrwm** then looks for the global configuration file in the following order:

1. *$XDG\_CONFIG\_DIRS/spectrwm/spectrwm.conf* (each colon-separated directory in *$XDG\_CONFIG\_DIRS*)

2. */etc/xdg/spectrwm/spectrwm.conf* (if *$XDG\_CONFIG\_DIRS* is either not set or empty)

3. */etc/spectrwm.conf*

The format of the file is

```
keyword = setting
```

Where ‘=’ may be replaced with ‘+=’ or ‘-=’, if supported by the option.

For example:

```
color_focus = red
```

```
quirk[XTerm] += FLOAT
```

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

Colors need to be specified per the [XQueryColor(3)](/XQueryColor/3.md) specification. In addition, alpha transparency may be specified via the format rbga:*red*/*green*/*blue*/*alpha* (8-bit hex values) For example, to specify a 50% transparent blue status bar background:

```
bar_color = rgba:00/00/ff/7f
```

Note that a compositing manager is required for alpha transparency.

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 ‘\\’, when needed.

Comments begin with a #. When a literal ‘#’ is desired in an option, then it must be escaped with a backslash, i.e. \\#

The file supports the following keywords:

- **autorun**

  Launch an application in a specified workspace at start-of-day. Defined in the format ws\[*idx*\]:*application*, e.g. ws\[2\]:xterm launches an [xterm(1)](/xterm/1.md) in workspace 2. Specify ‘ws\[-1\]’ to launch applications such as desktop managers and panels in free mode to keep them always mapped.

  Note that *libswmhack.so* is required for "spawn-in-workspace" behavior. See the SWMHACK section below for more information, tips, and workarounds if a program fails to spawn in the specified workspace.

- **bar\_action**

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

- **bar\_action\_expand**

  Process **bar\_format** character sequences in **bar\_action** output; default is 0.

- **bar\_at\_bottom**

  Place the statusbar at the bottom of each region instead of the top. Default is 0.

- **bar\_border**\[*x*\]

  Border color of status bar(s) on screen number *x*. Default is rgb:00/80/80.

- **bar\_border\_free**\[*x*\]

  Border color of a status bar for a focused region on screen number *x* when a workspace-free window is focused. Default is rgb:80/80/00.

- **bar\_border\_unfocus**\[*x*\]

  Border color of status bar(s) for unfocused region(s) on screen number *x*. Default is rgb:00/40/40.

- **bar\_border\_width**

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

- **bar\_color**\[*x*\]

  Background color of status bar(s) on screen number *x*.

  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 **+@bg=n;** where n is the color index counting from 0.

- **bar\_color\_free**\[*x*\]

  Background color of a status bar for a focused region on screen number *x* when a workspace-free window is focused.

  A comma-separated list of multiple colors can be specified, with the same syntax and behavior as **bar\_color**. Default is rgb:40/40/00.

  Note that **bar\_color** defines the background color indices that can be used in **bar\_format** markup sequences and is the fallback for colors that are left unspecified in this option.

- **bar\_color\_selected**\[*x*\]

  Background color for selected **menu** items on screen number *x*. Defaults to the value of **bar\_border**.

- **bar\_color\_unfocus**\[*x*\]

  Background color of status bar(s) for unfocused region(s) on screen number *x*.

  A comma-separated list of multiple colors can be specified, with the same syntax and behavior as **bar\_color** for unfocused bar(s). Defaults to the value of **bar\_color**.

  Note that **bar\_color** defines the background color indices that can be used in **bar\_format** markup sequences and is the fallback for colors that are left unspecified in this option.

- **bar\_enabled**

  Set default **bar\_toggle** state; default is 1.

- **bar\_enabled\_ws**\[*x*\]

  Set default **bar\_toggle\_ws** state on workspace *x*; default is 1.

- **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.

  The default is to use font set.

  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 **+@fn=n;** where n is the font index counting from 0.

  Also note that [dmenu(1)](/dmenu/1.md) prior to 4.6 does not support Xft fonts.

  Xft examples:

  ```
  bar_font = Terminus:style=Regular:pixelsize=14:antialias=true
  bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,Terminus:pixelsize=14,-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
  ```

  Font set examples:

  ```
  bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*
  bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*,-*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
  ```

  To list the available fonts in your system see [fc-list(1)](/fc-list/1.md) or [xlsfonts(1)](/xlsfonts/1.md) manpages. The [xfontsel(1)](/xfontsel/1.md) application can help with the XLFD setting.

- **bar\_font\_color**\[*x*\]

  Foreground color of the status bar(s) on screen number *x*.

  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 **+@fg=n;** where n is the color index counting from 0.

- **bar\_font\_color\_free**\[*x*\]

  Foreground color of a status bar for a focused region on screen number *x* when a workspace-free window is focused.

  A comma-separated list of multiple colors can be specified, with the same syntax and behavior as **bar\_font\_color**. Default is rgb:ff/ff/ff.

  Note that **bar\_font\_color** defines the foreground color indices that can be used in **bar\_format** markup sequences and is the fallback for colors that are left unspecified in this option.

- **bar\_font\_color\_unfocus**\[*x*\]

  Foreground color of status bar(s) for unfocused region(s) on screen number *x*.

  A comma-separated list of multiple colors can be specified, with the same syntax and behavior as **bar\_font\_color** for unfocused bar(s). Defaults to the value of **bar\_font\_color**.

  Note that **bar\_font\_color** defines the foreground color indices that can be used in **bar\_format** markup sequences and is the fallback for colors that are left unspecified in this option.

- **bar\_font\_color\_selected**\[*x*\]

  Foreground color for selected **menu** items on screen number *x*. Defaults to the value of **bar\_color**.

- **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.

- **bar\_format**

  Set the bar format string, overriding **clock\_format** and all of the **enabled** options. The format is passed through [strftime(3)](/strftime/3.md) before being used. It may contain the following character sequences:

  | | |
  | --- | --- |
  | **Character sequence** | **Replaced with** |
  | +\< | Pad with a space |
  | +A | Output of the external script |
  | +C | Window class (from WM\_CLASS) |
  | +D | Workspace name |
  | +F | Focus status indicator |
  | +I | Workspace index |
  | +L | Workspace list indicator |
  | +M | Number of iconic (minimized) windows in workspace |
  | +N | Screen number |
  | +P | Window class and instance separated by a colon |
  | +R | Region index |
  | +S | Stacking algorithm |
  | +T | Window instance (from WM\_CLASS) |
  | +U | Urgency hint |
  | +V | Program version |
  | +w | Number of windows in workspace |
  | +W | Window name (from \_NET\_WM\_NAME/WM\_NAME) |
  | +\|\[weight\]\[justify\] | Begin new section and reset markup |
  | ++ | A literal ‘+’ |
  | +@ | Prefix for text markup sequences |

- **bar\_justify**

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

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

- **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).

- **bind**\[*x*\]

  Bind key or button combo to action *x*. See the BINDINGS section below.

- **border\_width**

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

- **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.

- **cancelkey**

  Change the key used as an alternative means of terminating move/resize operations. Default is Escape.

  See the BINDINGS section below for details on how to find key names.

- **click\_to\_raise**

  Enable or disable raising stacking priority when clicking on a window. Default is 1.

- **clock\_enabled**

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

- **color\_focus\_free**

  Border color of the currently focused window that is in free mode. Default is yellow.

- **color\_focus\_maximized\_free**

  Border color of the currently focused maximized window that is in free mode. Defaults to the value of **color\_focus\_free**.

- **color\_unfocus\_free**

  Border color of unfocused windows that are in free mode, default is rgb:88/88/00.

- **color\_unfocus\_maximized\_free**

  Border color of unfocused maximized windows that are in free mode. Defaults to the value of **color\_unfocus\_free**.

- **color\_urgent\_free**

  Border color of urgent windows that are in free mode. Defaults to the value of **color\_unfocus\_free**.

- **color\_urgent\_maximized\_free**

  Border color of urgent maximized windows that are in free mode. Defaults to the value of **color\_urgent\_free**.

- **color\_focus**

  Border color of the currently focused window. Default is red.

- **color\_focus\_maximized**

  Border color of the currently focused, maximized window. Defaults to the value of **color\_focus**.

- **color\_unfocus**

  Border color of unfocused windows, default is rgb:88/88/88.

- **color\_unfocus\_maximized**

  Border color of unfocused, maximized windows. Defaults to the value of **color\_unfocus**.

- **color\_urgent**

  Border color of urgent windows. Defaults to the value of **color\_unfocus**.

- **color\_urgent\_maximized**

  Border color of urgent, maximized windows. Defaults to the value of **color\_urgent**.

- **cycle\_visible**

  Include workspaces that are mapped when switching with **ws\_next**, **ws\_prev**, **ws\_next\_all**, **ws\_prev\_all**, **ws\_next\_move**, or **ws\_prev\_move**. Enable by setting to 1.

  Note that mapped workspaces will be swapped unless **workspace\_clamp** is enabled. If **warp\_focus** is also enabled, focus will go to the region where the workspace is mapped.

- **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.

- **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 *always* removes the border regardless of the bar being enabled/disabled. Defaults to 0.

- **focus\_close**

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

- **focus\_close\_wrap**

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

- **focus\_default**

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

- **focus\_mark\_none**

  Set the **bar\_format** focus status indicator (+F) string to substitute when no window is focused. Default is ''.

- **focus\_mark\_normal**

  Set the **bar\_format** focus status indicator (+F) string to substitute when a normal (not floating, maximized or free) window is focused. Default is ''.

- **focus\_mark\_floating**

  Set the **bar\_format** focus status indicator (+F) string to substitute when a floating window is focused. Default is '(f)'.

- **focus\_mark\_free**

  Set the **bar\_format** focus status indicator (+F) string to substitute when a window that is in free mode is focused. Default is '(\*)'.

- **focus\_mark\_maximized**

  Set the **bar\_format** focus status indicator (+F) string to substitute when a maximized window is focused. Default is '(m)'.

- **focus\_mode**\[*t*\]

  Set window focus behavior with respect to the pointer. Possible values:

  - *default*

    Set window focus on border crossings caused by cursor motion and window interaction.

  - *follow*

    Prioritize the pointer location. Set window focus on all cursor border crossings, including workspace switches and changes to layout.

  - *manual*

    Ignore the pointer location. Set window focus on window interaction only.

    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 *t*:

    - *border*

      Pointer enters a window. Default is *follow*.

    - *configure*

      Window position/size changed by the client/EWMH. Default is *manual*.

    - *iconify*

      Window iconified. Default is *manual*.

    - *layout*

      Workspace layout changed. Default is *manual*.

    - *map*

      Window maps. Default is *manual*.

    - *move*

      Window moved to another workspace. Default is *manual*.

    - *startup*

      **spectrwm** (re)started. Default is *manual*.

    - *uniconify*

      Window uniconified. Default is *manual*.

    - *unmap*

      Window unmaps. Default is *manual*.

    - *workspace*

      Workspace switched. Default is *manual*.

      Note that when *t* is omitted, the specified setting is applied to all focus situations. Example:

      ```
      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.
      ```

- **fullscreen\_hide\_other**

  When a fullscreen window is focused and not in **below** state, hide unrelated windows in the same workspace. Useful for transparent windows. Defaults to 0.

- **fullscreen\_unfocus**

  Set handling when a fullscreen window loses focus. Possible values:

  - *none*

    Leave window fullscreen. (default)

  - *restore*

    Exit fullscreen.

  - *iconify*

    Minimize/hide the window.

  - *float*

    Exit fullscreen and float window.

  - *below*

    Set **below** state on the window.

  - *quick\_below*

    Set **below** state on the window, unset when refocused.

    Note that this option is ignored in max layout.

- **iconic\_enabled**

  Display the number of iconic (minimized) windows in the status bar. Enable by setting to 1.

- **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 KEYBOARD MAPPING FILES section below for a list of keyboard mapping files that have been provided for several keyboard layouts.

  Note that */dev/null* can be specified if you only want to clear bindings.

- **layout**

  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\[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 *stack\_mode* values are *vertical*, *vertical\_flip*, *horizontal*, *horizontal\_flip*, *max* and *floating*.

  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.

- **layout\_order**

  Define the layout sequence used by the **cycle\_layout** action. Possible values are *vertical*, *horizontal*, *max* and *floating*. At least one value must be specified, without duplicates. The default is *vertical*,*horizontal*,*max*,*floating*.

- **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 **stack\_reset** enables it again. Enabled by default. Disable by setting to 0.

- **maximize\_hide\_bar**

  When set to 1, **maximize\_toggle** will also hide/restore the bar visibility of the affected workspace. Defaults to 0.

- **maximize\_hide\_other**

  When a maximized window is focused and not in **below** state, hide unrelated windows in the same workspace. Useful for transparent windows. Defaults to 0.

- **maximized\_unfocus**

  Set handling when a maximized window loses focus. Possible values:

  - *none*

    Leave window maximized.

  - *restore*

    Unmaximize window. (default)

  - *iconify*

    Minimize/hide the window.

  - *float*

    Unmaximize and float window.

  - *below*

    Set **below** state on the window.

  - *quick\_below*

    Set **below** state on the window, unset when refocused.

    Note that this option is ignored in max layout.

- **modkey**

  Change the current modifier value of **MOD** in **bind** entries that come later in the configuration file. For existing bindings, the new value is substituted for the previous value. Possible values are *Mod1* (default), *Mod2*, *Mod3*, *Mod4* and *Mod5*.

  *Mod1* is generally the Alt key, *Mod2* is the Command key on macOS and *Mod4* is the Windows key on a PC. The current modifier key mapping can be found by running [xmodmap(1)](/xmodmap/1.md).

- **name**

  Set the name of a workspace at start-of-day. Defined in the format ws\[*idx*\]:*name*, e.g. ws\[1\]:Console sets the name of workspace 1 to “Console”.

- **program**\[*p*\]

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

- **quirk**\[*c*\[:*i*\[:*n*\[:*t*\]\]\]\]

  Add "quirk" for windows with class *c*, instance *i* (optional), name *n* (optional), and type *t* (optional.) See the QUIRKS section below.

- **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 screen\[*idx*\]:*width*x*height*+*x*+*y*\[,*rotation*\], e.g. screen\[1\]:800x1200+0+0 or screen\[1\]:800x1200+0+0,inverted (with optional rotation).

  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.

  Possible values for the optional rotation argument are *normal* (default), *left*, *inverted* and *right*. Note that rotation is used by **workspace\_autorotate**.

- **region\_padding**

  Pixel width of empty space within region borders. Disable by setting to 0.

- **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.

- **spawn\_flags**\[*p*\]

  If search pattern *p* is specified, change the spawn flags of existing program entries. If *p* is omitted, change the default spawn flags for any **program** or **autorun** entries that come later in the configuration file. Note that *p* is interpreted as a POSIX Extended Regular Expression.

  One or more of the following flags may be specified in a comma-separated list:

  - *nospawnws*

    When the program is spawned, do not associate the spawn workspace with the program's windows.

  - *xterm\_fontadj*

    Enables automatic font size adjustments when resizing [xterm(1)](/xterm/1.md) windows. Note that this works in conjunction with the **term\_width** option and the **XTERM\_FONTADJ** quirk. See the **term\_width** option and QUIRKS section for more information.

  - *optional*

    Disable program validation.

  - *none*

    No flags specified.

    The default is *none*.

    In addition to the ‘=’ operator, this option also supports ‘+=’ and ‘-=’ to add/remove flags instead of replacing them.

    Note that the default of associating windows with the spawn workspace and the *xterm\_fontadj* flag both rely on *libswmhack.so*. See the SWMHACK section below for more information.

- **spawn\_position**

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

- **stack\_enabled**

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

- **stack\_mark\_floating**

  Set the *floating* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[~\]'.

- **stack\_mark\_horizontal**

  Set the *horizontal* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[-\]'.

- **stack\_mark\_horizontal\_flip**

  Set the *horizontal\_flip* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[v\]'.

- **stack\_mark\_max**

  Set the *max* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[ \]'.

- **stack\_mark\_vertical**

  Set the *vertical* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[\|\]'.

- **stack\_mark\_vertical\_flip**

  Set the *vertical\_flip* layout mark for the **bar\_format** stacking indicator (+S). Default is '\[\>\]'.

- **term\_width**

  Set a preferred minimum width for the terminal. If this value is greater than 0, **spectrwm** will attempt to adjust the font sizes in the terminal to keep the terminal width above this number as the window is resized.

  Note that only [xterm(1)](/xterm/1.md) is currently supported. The terminal process must be spawned with the *xterm\_fontadj* spawn flag and the *XTERM\_FONTADJ* quirk must be set on its window. See the **spawn\_flags** option and the QUIRKS section for more information. In addition, the [xterm(1)](/xterm/1.md) 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)](/xterm/1.md) binary without the setgid bit set.

- **tile\_gap**

  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.

- **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.

- **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 [xterm(1)](/xterm/1.md), for example, one needs to add the following line to *.Xdefaults*:

  ```
  xterm.bellIsUrgent: true
  ```

- **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 *master\_add*, *master\_del*, *stack\_inc* and *stack\_dec* for more information.

- **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 *workspace\_clamp* is enabled, focus on the region with the target workspace. Enable by setting to 1.

- **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 **focus\_mode** situations set to *follow*.

- **window\_class\_enabled**

  Enable or disable displaying the window class name (from WM\_CLASS) in the status bar. Enable by setting to 1.

- **window\_instance\_enabled**

  Enable or disable displaying the window instance name (from WM\_CLASS) in the status bar. Enable by setting to 1.

- **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.

  To prevent excessively large window names from pushing the remaining text off the bar, it is limited to 64 characters, by default. See the **bar\_format** option for more details.

- **workspace\_autorotate**

  When moving workspaces across regions, auto-rotate vertical/horizontal layouts based on rotation data from [xrandr(1)](/xrandr/1.md). Enable by setting to 1.

- **workspace\_clamp**

  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.

- **workspace\_indicator**

  Configure the status bar workspace indicator. One or more of the following options may be specified in a comma-separated list:

  - *listcurrent*

    Include the current workspace.

  - *listactive*

    Include workspaces with windows.

  - *listempty*

    Include empty workspaces.

  - *listnamed*

    Include named workspaces.

  - *listurgent*

    Include workspaces with urgent window(s).

  - *listall*

    Include all workspaces.

  - *hidecurrent*

    Always exclude the current workspace from the list.

  - *markcurrent*

    Indicate the current workspace if it is in the list.

  - *markactive*

    Indicate workspaces in the list that are active.

  - *markempty*

    Indicate workspaces in the list that are empty.

  - *markurgent*

    Indicate workspaces in the list that contain urgent window(s).

  - *printnames*

    Display the names of named workspaces in the list.

  - *noindexes*

    Hide the index of the workspaces.

    The default is *listcurrent*,*listactive*,*markcurrent*,*printnames*

    Note that markup sequences can be used to style the workspace indicator. For example, to change the color of the current workspace:

    ```
    workspace_mark_current = '+@fg=1;'
    workspace_mark_current_suffix = '+@fg=0;'
    ```

- **workspace\_limit**

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

- **workspace\_mark\_active**

  Set the string inserted before active workspaces in the **workspace\_indicator**. Default is '^'.

- **workspace\_mark\_active\_suffix**

  Set the string inserted after active workspaces in the **workspace\_indicator**. Default is '' (empty string).

- **workspace\_mark\_current**

  Set the string inserted before the current workspace in the **workspace\_indicator**. Default is '\*'.

- **workspace\_mark\_current\_suffix**

  Set the string inserted after the current workspace in the **workspace\_indicator**. Default is '' (empty string).

- **workspace\_mark\_empty**

  Set the string inserted before empty workspaces in the **workspace\_indicator**. Default is '-'.

- **workspace\_mark\_empty\_suffix**

  Set the string inserted after empty workspaces in the **workspace\_indicator**. Default is '' (empty string).

- **workspace\_mark\_urgent**

  Set the string inserted before urgent workspaces in the **workspace\_indicator**. Default is '!'.

- **workspace\_mark\_urgent\_suffix**

  Set the string inserted after urgent workspaces in the **workspace\_indicator**. Default is '' (empty string).

## STACK MODES

- **vertical**

  Master area is on the left and stack area is on the right. Additional windows are vertically tiled in stack area.

- **vertical** **flipped**

  Same as above but stack and master areas are swapped.

- **horizontal**

  Master area is on the top and stack area is on the bottom. Additional windows are horizontally tiled in stack area.

- **horizontal** **flipped**

  Same as above but stack and master areas are swapped.

- **max**

  The focused window occupies the whole region, except for the bar (if enabled).

- **floating**

  Windows are untiled and can be resized and positioned.

## WINDOW STATES

These can be set/unset by the corresponding **toggle** actions listed in the BINDINGS section below.

- **floating**

  The window is stacked above others and is not in a tile; it may be freely resized and positioned.

- **below**

  The window is floating, but stacked below others.

- **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 **maximized\_unfocus** to configure unfocused behavior.

- **fullscreen**

  The window occupies the whole region. By default, focusing another window does not remove the fullscreen state of the window. See **fullscreen\_unfocus** to configure unfocused behavior.

- **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.

## PROGRAMS

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

Custom programs in the configuration file are specified as follows:

```
program[action] = progpath [arg [arg ...]]
```

*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.

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').

Remember that when using ‘#’ in your program call, it must be escaped with a backslash, i.e. \\#

The following argument variables are replaced with values at the time the program is spawned:

- **$bar\_border**

  - **$bar\_color**

  - **$bar\_color\_selected**

  - **$bar\_font**

  - **$bar\_font\_color**

  - **$bar\_font\_color\_selected**

  - **$color\_focus**

  - **$color\_unfocus**

  - **$color\_urgent**

  - **$dmenu\_bottom**

  \-b if **bar\_at\_bottom** is enabled, otherwise '' (empty string.)

- **$region\_index**

  - **$workspace\_index**

  Example:

```
program[ff] = /usr/local/bin/firefox http://spectrwm.org/
bind[ff] = MOD+Shift+b # Now M-S-b launches firefox
```

To cancel the previous, unbind it:

```
bind[] = MOD+Shift+b
```

A number of built-in actions spawn a program as part of their implementation. The respective default program entries are as follows:

- **term**

  x-terminal-emulator

- **lock**

  slock

- **menu**

  dmenu\_run $dmenu\_bottom -fn $bar\_font -nb $bar\_color -nf $bar\_font\_color -sb $bar\_color\_selected -sf $bar\_font\_color\_selected

- **search**

  dmenu $dmenu\_bottom -i -fn $bar\_font -nb $bar\_color -nf $bar\_font\_color -sb $bar\_color\_selected -sf $bar\_font\_color\_selected

- **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

- **initscr**

  initscreen.sh        # optional

- **screenshot\_all**

  screenshot.sh full   # optional

- **screenshot\_wind**

  screenshot.sh window # optional

Note that **search** is required by the **search\_win**, **search\_workspace**, and **uniconify** actions and does not have a direct binding.

With the exception of the default entries marked “optional”, validation is performed to ensure the program exists. If validation fails, the exception can be resolved by installing the program, adding the *optional* flag to the program entry's spawn flags, or by disabling the program entry by freeing the respective binding.

For example, to add the **optional** flag to **lock**:

```
spawn_flags[lock] += optional
```

To unbind **lock** and prevent it from being validated:

```
bind[] = MOD+Shift+Delete
```

Note that when a program is spawned, **spectrwm** aims to place its windows in its spawn workspace. See the SWMHACK section below for more information, tips, and workarounds if a program fails to spawn in the correct workspace.

## BINDINGS

**spectrwm** provides many functions (or actions) accessed via key or pointer button bindings.

The default bindings are listed below:

- ⟨**Button1**⟩

  focus

- **M-**⟨**Button1**⟩

  move

- **M-**⟨**Button3**⟩

  resize

- **M-S-**⟨**Button3**⟩

  resize\_centered

- **M-S-**⟨**Return**⟩

  term

- **M-p**

  menu

- **M-S-q**

  quit

- **M-q**

  restart

- ⟨*unbound*⟩

  restart\_of\_day

- **M-**⟨**Space**⟩

  cycle\_layout

- **M-S-\\**

  flip\_layout

- ⟨*unbound*⟩

  prior\_layout

- ⟨*unbound*⟩

  layout\_vertical

- ⟨*unbound*⟩

  layout\_horizontal

- ⟨*unbound*⟩

  layout\_max

- ⟨*unbound*⟩

  layout\_floating

- **M-S-**⟨**Space**⟩

  stack\_reset

- ⟨*unbound*⟩

  stack\_balance

- **M-h**

  master\_shrink

- **M-l**

  master\_grow

- **M-,**

  master\_add

- **M-.**

  master\_del

- **M-S-,**

  stack\_inc

- **M-S-.**

  stack\_dec

- **M-**⟨**Return**⟩

  swap\_main

-

  **M-j**, **M-**⟨**TAB**⟩ focus\_next

-

  **M-k**, **M-S-**⟨**TAB**⟩ focus\_prev

- **M-m**

  focus\_main

- **M-\`**

  focus\_free

- **M-S-a**

  focus\_prior

- **M-u**

  focus\_urgent

- **M-S-j**

  swap\_next

- **M-S-k**

  swap\_prev

- **M-b**

  bar\_toggle

- **M-S-b**

  bar\_toggle\_ws

- **M-x**

  wind\_del

- **M-S-x**

  wind\_kill

- **M-**⟨*1-9,0,F1-F12*⟩

  ws\_⟨*1-22*⟩

- **M-S-**⟨*1-9,0,F1-F12*⟩

  mvws\_⟨*1-22*⟩

- **M-**⟨*Keypad* *1-9*⟩

  rg\_⟨*1-9*⟩

- **M-S-**⟨*Keypad* *1-9*⟩

  mvrg\_⟨*1-9*⟩

- ⟨*unbound*⟩

  mvrg\_next

- ⟨*unbound*⟩

  mvrg\_prev

- ⟨*unbound*⟩

  ws\_empty

- ⟨*unbound*⟩

  ws\_empty\_move

- **M-**⟨**Right**⟩

  ws\_next

- **M-**⟨**Left**⟩

  ws\_prev

- **M-**⟨**Up**⟩

  ws\_next\_all

- **M-**⟨**Down**⟩

  ws\_prev\_all

- **M-a**

  ws\_prior

- **M-S-**⟨**Down**⟩

  ws\_prev\_move

- **M-S-**⟨**Up**⟩

  ws\_next\_move

- **M-S-**⟨**Right**⟩

  rg\_next

- **M-S-**⟨**Left**⟩

  rg\_prev

- ⟨*unbound*⟩

  rg\_move\_next

- ⟨*unbound*⟩

  rg\_move\_prev

- **M-s**

  screenshot\_all

- **M-S-s**

  screenshot\_wind

- **M-S-v**

  version

- **M-t**

  float\_toggle

- **M-S-t**

  below\_toggle

- **M-S-\`**

  free\_toggle

- **M-S-**⟨**Delete**⟩

  lock

- **M-S-i**

  initscr

- **M-w**

  iconify

- **M-S-w**

  uniconify

- **M-e**

  maximize\_toggle

- **M-S-e**

  fullscreen\_toggle

- **M-r**

  raise

- **M-S-r**

  always\_raise

- **M-v**

  button2

- **M--**

  width\_shrink

- **M-=**

  width\_grow

- **M-S--**

  height\_shrink

- **M-S-=**

  height\_grow

- **M-\[**

  move\_left

- **M-\]**

  move\_right

- **M-S-\[**

  move\_up

- **M-S-\]**

  move\_down

- **M-S-/**

  name\_workspace

- **M-/**

  search\_workspace

- **M-f**

  search\_win

- **M-d**

  debug\_toggle (debug mode only)

- **M-S-d**

  dumpwins (debug mode only)

The action names and descriptions are listed below:

- **focus**

  Focus window/region under pointer.

- **move**

  Move window with pointer while binding is pressed.

- **resize**

  Resize window with pointer while binding is pressed.

- **resize\_centered**

  Same as **resize** but keep window centered.

- **term**

  Spawn a new terminal (see PROGRAMS above).

- **menu**

  Menu (see PROGRAMS above).

- **quit**

  Quit **spectrwm**.

- **restart**

  Restart **spectrwm**.

- **restart\_of\_day**

  Same as **restart** but configuration file is loaded in full.

- **cycle\_layout**

  Switch to the next layout.

- **flip\_layout**

  Swap the master and stacking areas.

- **prior\_layout**

  Switch to the last used layout.

- **layout\_vertical**

  Switch to vertical layout.

- **layout\_horizontal**

  Switch to horizontal layout.

- **layout\_max**

  Switch to max layout.

- **layout\_floating**

  Switch to floating layout.

- **stack\_reset**

  Reset layout.

- **stack\_balance**

  Balance master/stacking area.

- **master\_shrink**

  Shrink master area.

- **master\_grow**

  Grow master area.

- **master\_add**

  Add windows to master area.

- **master\_del**

  Remove windows from master area.

- **stack\_inc**

  Add columns/rows to stacking area.

- **stack\_dec**

  Remove columns/rows from stacking area.

- **swap\_main**

  Move current window to master area.

- **focus\_next**

  Focus next window in workspace.

- **focus\_prev**

  Focus previous window in workspace.

- **focus\_main**

  Focus on main window in workspace.

- **focus\_prior**

  Focus last focused window in workspace.

- **focus\_free**

  Focus on a window in free mode, if any.

- **focus\_urgent**

  Focus on next window with the urgency hint flag set. The workspace is switched if needed.

- **swap\_next**

  Swap with next window in workspace.

- **swap\_prev**

  Swap with previous window in workspace.

- **bar\_toggle**

  Toggle overall visibility of status bars.

- **bar\_toggle\_ws**

  Toggle status bar on current workspace.

- **wind\_del**

  Delete current window.

- **wind\_kill**

  Kill the program that created the current window.

- **ws\_***n*

  Switch to workspace *n*, where *n* is 1 through **workspace\_limit**.

- **mvws\_***n*

  Move current window to workspace *n*, where *n* is 1 through **workspace\_limit**.

- **rg\_***n*

  Focus on region *n*, where *n* is 1 through 9.

- **mvrg\_***n*

  Move current window to region *n*, where *n* is 1 through 9.

- **mvrg\_next**

  Move current window to workspace in next region.

- **mvrg\_prev**

  Move current window to workspace in previous region.

- **ws\_empty**

  Switch to the first empty workspace.

- **ws\_empty\_move**

  Switch to the first empty workspace and move current window.

- **ws\_next**

  Switch to next workspace with a window in it.

- **ws\_prev**

  Switch to previous workspace with a window in it.

- **ws\_next\_all**

  Switch to next workspace.

- **ws\_prev\_all**

  Switch to previous workspace.

- **ws\_next\_move**

  Switch to next workspace with the current window.

- **ws\_prev\_move**

  Switch to previous workspace with the current window.

- **ws\_prior**

  Switch to last visited workspace.

- **rg\_next**

  Switch to next region.

- **rg\_prev**

  Switch to previous region.

- **rg\_move\_next**

  Switch to next region and move current workspace.

- **rg\_move\_prev**

  Switch to previous region and move current workspace.

- **screenshot\_all**

  Take screenshot of entire screen (if enabled) (see PROGRAMS above).

- **screenshot\_wind**

  Take screenshot of selected window (if enabled) (see PROGRAMS above).

- **version**

  Toggle version in status bar.

- **float\_toggle**

  Toggle focused window between tiled and floating.

- **below\_toggle**

  Toggle **below** state on current window.

- **free\_toggle**

  Toggle focused window between workspace mode and free mode.

- **lock**

  Lock screen (see PROGRAMS above).

- **initscr**

  Reinitialize physical screens (see PROGRAMS above).

- **iconify**

  Minimize (unmap) currently focused window.

- **uniconify**

  Restore (map) window returned by [dmenu(1)](/dmenu/1.md) selection.

- **maximize\_toggle**

  Toggle maximization of focused window.

- **fullscreen\_toggle**

  Toggle fullscreen state of focused window.

- **raise**

  Raise the current window.

- **always\_raise**

  When set tiled windows are allowed to obscure floating windows.

- **button2**

  Fake a middle mouse button click (Button2).

- **width\_shrink**

  Shrink the width of a floating window.

- **width\_grow**

  Grow the width of a floating window.

- **height\_shrink**

  Shrink the height of a floating window.

- **height\_grow**

  Grow the height of a floating window.

- **move\_left**

  Move a floating window a step to the left.

- **move\_right**

  Move a floating window a step to the right.

- **move\_up**

  Move a floating window a step upwards.

- **move\_down**

  Move a floating window a step downwards.

- **name\_workspace**

  Name the current workspace.

- **search\_workspace**

  Search for a workspace.

- **search\_win**

  Search the windows in the current workspace.

- **debug\_toggle**

  Toggles debug overlay. (debug mode only)

- **dumpwins**

  Dump current window/focus/stacking state to debug log. (debug mode only)

Custom bindings in the configuration file are specified as follows:

```
bind[action] = combo
```

*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, Control, MOD, etc.) and a normal key (b, Space, etc) or a button (Button1 .. Button255), separated by ‘+’. Multiple key/button combinations may be bound to the same action.

Special arguments:

- **MOD**

  Substituted for the currently defined **modkey**.

- **ANYMOD**

  Select all modifier combinations not handled by another binding.

- **REPLAY**

  Reprocess binding press/release events for other programs to handle. Unavailable for **move**, **resize** and **resize\_centered**.

**MOD** example:

```
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.
```

**ANYMOD** example:

```
bind[focus] = ANYMOD+Button3
bind[move] = MOD+Button3
```

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:

```
bind[focus] = REPLAY+Button3
```

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)](/xev/1.md), focus the window and press the specific key and in the terminal output read the symbol name. In the following example for å:

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

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

```
bind[program] = MOD+aring
```

To clear all default keyboard bindings and specify your own, see the **keyboard\_mapping** option.

## KEYBOARD MAPPING FILES

Keyboard mapping files for several keyboard layouts are listed below. These files can be used with the **keyboard\_mapping** setting to load pre-defined key bindings for the specified keyboard layout.

- **spectrwm\_cz.conf**

  Czech Republic keyboard layout

- **spectrwm\_es.conf**

  Spanish keyboard layout

- **spectrwm\_fr.conf**

  French keyboard layout

- **spectrwm\_fr\_ch.conf**

  Swiss French keyboard layout

- **spectrwm\_se.conf**

  Swedish keyboard layout

- **spectrwm\_us.conf**

  United States keyboard layout

## QUIRKS

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

The default quirks are described below:

- .\*:.\*:.\*:splash,dialog

  FLOAT

- .\*:.\*:.\*:toolbar,utility

  FLOAT + ANYWHERE

- .\*:.\*:.\*:notification

  FLOAT + ANYWHERE + MINIMALBORDER + NOFOCUSONMAP

- Firefox-bin:firefox-bin

  TRANSSZ

- Firefox:Dialog

  FLOAT

- Gimp:gimp

  FLOAT + ANYWHERE

- MPlayer:xv

  FLOAT + FULLSCREEN + FOCUSPREV

- OpenOffice.org 2.4:VCLSalFrame

  FLOAT

- OpenOffice.org 3.1:VCLSalFrame

  FLOAT

- pcb:pcb

  FLOAT

- xine:Xine Window

  FLOAT + ANYWHERE

- xine:xine Panel

  FLOAT + ANYWHERE

- xine:xine Video Fullscreen Window

  FULLSCREEN + FLOAT

- Xitk:Xitk Combo

  FLOAT + ANYWHERE

- Xitk:Xine Window

  FLOAT + ANYWHERE

- XTerm:xterm

  XTERM\_FONTADJ

The quirks themselves are described below:

- ANYWHERE

  Allow window to position itself, uncentered.

- BELOW

  Put the window into below state upon being managed.

- FLOAT

  This window should not be tiled, but allowed to float freely.

- 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 **focus\_mode** is set to *follow*.

- FOCUSPREV

  On exit force focus on previously focused application not previous application in the stack.

- FULLSCREEN

  Remove border to allow window to use full region size.

- ICONIFY

  Hide/minimize the window upon being managed.

- IGNOREPID

  Ignore the PID when determining the initial workspace for a new window. Especially useful for terminal windows that share a process.

- IGNORESPAWNWS

  Ignore the spawn workspace when determining the initial workspace for a new window.

- MAXIMIZE

  Put the window into maximized state upon being managed.

- MINIMALBORDER

  Remove border when window is unfocused and floating.

- NOFOCUSCYCLE

  Remove from normal focus cycle (focus\_prev or focus\_next). The window can still be focused using search\_win.

- NOFOCUSONMAP

  Do not change focus to the window when it first appears on the screen. Has no effect when **focus\_mode** is set to *follow*.

- 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.

- TRANSSZ

  Adjusts size on transient windows that are too small using **dialog\_ratio** (see CONFIGURATION FILES).

- WS\[*n*\]

  Force a new window to appear on workspace *n*. Specify -1 to put the window into free mode so that it is mapped independent of workspaces and regions.

- XTERM\_FONTADJ

  Adjust [xterm(1)](/xterm/1.md) fonts when resizing. Note that this requires the *xterm\_fontadj* spawn flag to be set on the autorun/program entry when the program is spawned. See the **spawn\_flags** option for information on how to enable it.

Custom quirks in the configuration file are specified as follows:

```
quirk[class[:instance[:name[:type]]]] {=|+=|-=} quirk [+ quirk ...]
```

*class*, *instance* (optional), *name* (optional), and *type* (optional) are used to determine which window(s) the quirk(s) apply to. *class* and *instance* are regex search patterns for the respective fields of the WM\_CLASS window property. *name* is a regex search pattern for the window name (WM\_NAME/\_NET\_WM\_NAME.) *type* is a comma-separated list of zero or more of the following window types (\_NET\_WM\_WINDOW\_TYPE): **desktop**, **dock**, **toolbar**, **menu**, **utility**, **splash**, **dialog**, **dropdown\_menu**, **popup\_menu**, **tooltip**, **notification**, **combo**, **dnd**, and **normal**. Leave this field blank to match any window type. *quirk* is one of the quirks from the list above.

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 ‘=’, quirks are replaced on matching windows. To add or remove quirks, assign them with ‘+=’ or ‘-=’ instead.

Note that patterns are interpreted as POSIX Extended Regular Expressions. Any ':', '\[' or '\]' must be escaped with '\\'. See [regex(7)](/regex/7.md) for more information on POSIX Extended Regular Expressions.

For example:

```
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 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.
```

You can obtain *class*, *instance* and *name* by running [xprop(1)](/xprop/1.md) and then clicking on the desired window. In the following example the main window of Firefox was clicked:

```
$ 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"
```

Note that [xprop(1)](/xprop/1.md) displays WM\_CLASS as:

```
WM_CLASS(STRING) = "<instance>", "<class>"
```

In the example above the quirk entry would be:

```
quirk[Firefox:Navigator] = FLOAT
```

**spectrwm** also automatically assigns quirks to windows based on the value of the window's \_NET\_WM\_WINDOW\_TYPE property as follows:

- \_NET\_WM\_WINDOW\_TYPE\_TOOLBAR

  FLOAT + ANYWHERE

- \_NET\_WM\_WINDOW\_TYPE\_UTILITY

  FLOAT + ANYWHERE

- \_NET\_WM\_WINDOW\_TYPE\_SPLASH

  FLOAT

- \_NET\_WM\_WINDOW\_TYPE\_DIALOG

  FLOAT

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

## EWMH

**spectrwm** partially implements the Extended Window Manager Hints (EWMH) specification. This enables controlling windows as well as **spectrwm** itself from external scripts and programs. This is achieved by **spectrwm** responding to certain ClientMessage events. From the terminal these events can be conveniently sent using tools such as [wmctrl(1)](/wmctrl/1.md) and [xdotool(1)](/xdotool/1.md). 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)](/xprop/1.md) and [grep(1)](/grep/1.md):

```
$ WINDOWID=`xprop -root _NET_ACTIVE_WINDOW | grep -o "0x.*"`
$ xprop -id $WINDOWID _NET_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)](/wmctrl/1.md) 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)](/wmctrl/1.md) 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)](/wmctrl/1.md) to send the message (assuming 0x4a0000b is the id of the window to be floated or un-floated):

```
$ wmctrl -i -r 0x4a0000b -b toggle,above
```

Windows can also be iconified and un-iconified by substituting \_NET\_WM\_STATE\_HIDDEN for \_NET\_WM\_STATE\_ABOVE in the previous example:

```
$ wmctrl -i -r 0x4a0000b -b toggle,hidden
```

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)](/wmctrl/1.md) 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.

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.

## SWMHACK

When spawning a program via an **autorun** or **program** entry without the *nospawnws* flag, **spectrwm** aims to place the program's windows (if any) in its spawn workspace. To accomplish this "spawn-in-workspace" behavior, **spectrwm** must determine the intended spawn workspace when managing a new window. Since it cannot be done with X11 alone, *libswmhack.so* is included to make this feature possible.

When a program is spawned, **spectrwm** automatically sets *LD\_PRELOAD* and *\_SWM\_WS* in the program's spawn environment to enable *libswmhack.so* when it is executed. Note that *LD\_PRELOAD* is the path to *libswmhack.so* and *\_SWM\_WS* is the spawn workspace for any windows created by the program.

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 *\_SWM\_WS* to a different value. Alternatively, *\_SWM\_WS* can be [unset(1)](/unset/1.md) or set to a blank value to disable "spawn-in-workspace" behavior. Note that workspaces are counted from 0. ‘-1’ can be specified to put windows into workspace-free mode.

For example, to play a video with [mpv(1)](/mpv/1.md) on workspace 10 without changing the spawn workspace in the environment:

```
$ _SWM_WS=9 mpv video.mkv
```

Play the video in free mode so that it remains mapped when switching workspaces.

```
$ _SWM_WS=-1 mpv video.mkv
```

Disable "spawn-in-workspace" in the environment so that new windows map on whichever workspace happens to be focused.

```
$ unset _SWM_WS
```

Change the environment to spawn programs in free mode.

```
$ export _SWM_WS=-1
```

When spawning a program that creates windows via a daemon, ensure the daemon is started with the correct *LD\_PRELOAD* in its environment.

For example, when starting [urxvtd(1)](/urxvtd/1.md) via [xinit(1)](/xinit/1.md), *LD\_PRELOAD* must be specified.

```
LD_PRELOAD=/usr/lib/spectrwm/libswmhack.so.0.0 urxvtd -q -o -f
```

Note that some operating systems may ignore *LD\_PRELOAD* if certain conditions are not met. It is advised to check the man page of *ld.so*.

In situations where *libswmhack.so* cannot be used, it is possible to use a quirk to spawn a program in a specific workspace.

e.g. launch an [xterm(1)](/xterm/1.md) in workspace 2 on startup:

```
quirk[XTerm:ws2] += WS[2]
autorun = ws[2]:xterm -name ws2
```

Launch a [chromium(1)](/chromium/1.md) window in workspace 3 on startup:

```
quirk[Chromium:chromium:ws3] += WS[3]
autorun = ws[3]:chromium --window-name="ws3" --new-window
```

If the "spawn-in-workspace" behavior is not desired, it is possible to disable it before programs are spawned by setting the *nospawnws* spawn flag on spawn entries via the **spawn\_flags** option:

```
# 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
```

Alternatively, the *IGNORESPAWNWS* and *IGNOREPID* quirks can be applied to windows:

```
# 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
```

Note that XCB programs that roll their own X11 requests (e.g. Chromium) are currently unsupported by *libswmhack.so*.

## SIGNALS

Sending **spectrwm** a HUP signal will restart it.

## FILES

- *~/.spectrwm.conf*

  **spectrwm** user specific settings.

- */etc/spectrwm.conf*

  **spectrwm** global settings.

## HISTORY

**spectrwm** was inspired by xmonad & dwm.

## AUTHORS

**spectrwm** was written by:

- Marco Peereboom ⟨*marco@peereboom.us*⟩

  - Ryan Thomas McBride ⟨*mcbride@countersiege.com*⟩

  - Darrin Chandler ⟨*dwchandler@stilyagin.com*⟩

  - Pierre-Yves Ritschard ⟨*pyr@spootnik.org*⟩

  - Tuukka Kataja ⟨*stuge@xor.fi*⟩

  - Jason L. Wright ⟨*jason@thought.net*⟩

  - Reginald Kennedy ⟨*rk@rejii.com*⟩

  - Lawrence Teo ⟨*lteo@lteo.net*⟩

  - Tiago Cunha ⟨*tcunha@gmx.com*⟩

  - David Hill ⟨*dhill@mindcry.org*⟩
