1 .\" Copyright (c) 2009-2012 Marco Peereboom <marco@peereboom.us>
2 .\" Copyright (c) 2009 Darrin Chandler <dwchandler@stilyagin.com>
3 .\" Copyright (c) 2011-2013 Reginald Kennedy <rk@rejii.com>
4 .\" Copyright (c) 2011-2012 Lawrence Teo <lteo@lteo.net>
5 .\" Copyright (c) 2011-2012 Tiago Cunha <tcunha@gmx.com>
6 .\" Copyright (c) 2012 David Hill <dhill@mindcry.org>
8 .\" Permission to use, copy, modify, and distribute this software for any
9 .\" purpose with or without fee is hereby granted, provided that the above
10 .\" copyright notice and this permission notice appear in all copies.
12 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 .Dd $Mdocdate: February 15 2012 $
25 .Nd window manager for X11
30 is a minimalistic window manager that tries to stay out of the way so that
31 valuable screen real estate can be used for much more important stuff.
32 It has sane defaults and does not require one to learn a language to do any
34 It was written by hackers for hackers and it strives to be small, compact and
39 starts up, it reads settings from its configuration file,
42 .Sx CONFIGURATION FILES
45 The following notation is used throughout this page:
47 .Bl -tag -width Ds -offset indent -compact
61 is very simple in its use.
62 Most of the actions are initiated via key or mouse bindings.
65 section below for defaults and customizations.
66 .Sh CONFIGURATION FILES
68 first tries to open the user specific file,
69 .Pa ~/.spectrwm.conf .
70 If that file is unavailable,
71 it then tries to open the global configuration file
72 .Pa /etc/spectrwm.conf .
74 The format of the file is \*(Ltkeyword\*(Gt = \*(Ltsetting\*(Gt.
79 Enabling or disabling an option is done by using 1 or 0 respectively.
81 Colors need to be specified per the
85 Comments begin with a #. When a literal '#' is desired in an option, then it
86 must be escaped with a backslash. i.e. \e#
88 The file supports the following keywords:
91 Launch an application in a specified workspace at start-of-day.
92 Defined in the format ws[<idx>]:application, e.g. ws[2]:xterm launches an
95 External script that populates additional information in the status bar,
98 Place the statusbar at the bottom of each region instead of the top.
99 .It Ic bar_border Ns Bq Ar x
100 Border color of the status bar(s) in screen
102 .It Ic bar_border_unfocus Ns Bq Ar x
103 Border color of the status bar(s) on unfocused region(s) in screen
105 .It Ic bar_border_width
106 Set status bar border thickness in pixels.
107 Disable border by setting to 0.
108 .It Ic bar_color Ns Bq Ar x
109 Background color of the status bar(s) in screen
115 .It Ic bar_enabled_ws Ns Bq Ar x
122 Font used in the status bar. Either Xft or X Logical Font Description (XLFD)
123 may be used to specify fonts. Fallback fonts may be specified by separating
124 each font with a comma. If all entries are XLFD syntax, font set will be
125 used. If at least one entry is Xft, Xft will be used. Note that if Xft is in
126 use, only the first font that successfully loads will be used regardless of
127 missing glyphs. The default is to use font set. Also note that dmenu does
128 not support Xft fonts.
131 .Bd -literal -offset indent
132 bar_font = Terminus:style=Regular:pixelsize=14:antialias=true
134 bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,Terminus:pixelsize=14,\
135 -*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
139 .Bd -literal -offset indent
140 bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*
142 bar_font = -*-profont-medium-*-*-*-11-*-*-*-*-*-*-*,\
143 -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*,\
144 -*-clean-medium-*-*-*-12-*-*-*-*-*-*-*
147 To list the available fonts in your system see
154 application can help with the XLFD setting.
156 .It Ic bar_font_color Ns Bq Ar x
157 Color of the font in status bar in screen
160 Set the bar_format string and overrides
165 The format is passed through
168 It may contain the following character sequences:
169 .Bl -column "Character sequence" "Replaced with" -offset indent
170 .It Sy "Character sequence" Ta Sy "Replaced with"
171 .It Li "+<" Ta "Pad with a space"
172 .It Li "+A" Ta "Output of the external script"
173 .It Li "+C" Ta "Window class"
174 .It Li "+D" Ta "Workspace name"
175 .It Li "+F" Ta "Floating indicator"
176 .It Li "+I" Ta "Workspace index"
177 .It Li "+N" Ta "Screen number"
178 .It Li "+P" Ta "Window class and title separated by a colon"
179 .It Li "+S" Ta "Stacking algorithm"
180 .It Li "+T" Ta "Window title"
181 .It Li "+U" Ta "Urgency hint"
182 .It Li "+V" Ta "Program version"
183 .It Li "+W" Ta "Window name"
184 .It Li "++" Ta "A literal" Ql +
187 All character sequences may limit its output to a specific length, for
188 example +64A. Any characters that don't match the specification are copied
191 Justify the status bar text. Possible values are
197 Note that if the output is not
199 justified, it may not be properly aligned in some circumstances, due to the
200 white-spaces in the default static format.
203 option for more details.
204 .It Ic bind Ns Bq Ar x
205 Bind key combo to action
211 Set window border thickness in pixels.
212 Disable all borders by setting to 0.
213 .It Ic boundary_width
214 Set region containment boundary width in pixels. This is how far a window
215 must be dragged/resized beyond the region edge before it is allowed outside
216 the region. This has no effect when manipulating the window with key
217 bindings. Disable the window containment effect by setting to 0.
219 Enable or disable displaying the clock in the status bar.
220 Disable by setting to 0
221 so a custom clock could be used in the
225 Border color of the currently focussed window.
227 Border color of unfocussed windows.
229 Some applications have dialogue windows that are too small to be useful.
230 This ratio is the screen size to what they will be resized.
231 For example, 0.6 is 60% of the physical screen size.
232 .It Ic disable_border
233 Remove border when bar is disabled and there is only one window on the
236 Window to put focus when the focused window is closed.
246 are relative to the window that is closed.
247 .It Ic focus_close_wrap
248 Whether to allow the focus to jump to the last window when the first window
249 is closed or vice versa. Disable by setting to 0.
251 Window to put focus when no window has been focused. Possible values are
257 Window focus behavior with respect to the mouse cursor. Possible values:
259 .Bl -tag -width "default" -offset indent -compact
261 Set window focus on border crossings caused by cursor motion and
264 Set window focus on all cursor border crossings, including workspace switches
265 and changes to layout.
267 Set window focus on window interaction only.
269 .It Ic keyboard_mapping
270 Clear all key bindings and load new key bindings from the specified file.
271 This allows you to load pre-defined key bindings for your keyboard layout.
273 .Sx KEYBOARD MAPPING FILES
274 section below for a list of keyboard mapping files that have been provided
275 for several keyboard layouts.
277 Select layout to use at start-of-day. Defined in the format
278 ws[idx]:master_grow:master_add:stack_inc:layout:always_raise:stack_mode, e.g.
279 ws[2]:-4:0:1:0:horizontal sets worskspace 2 to the horizontal stack mode and
280 shrinks the master area by 4 ticks and adds one window to the stack, while
281 maintaining default floating window behavior.
282 Possible stack_mode values are
299 for more information.
300 Note that the stacking options are complicated and have side-effects. One
301 should familiarize oneself with these commands before experimenting with the
305 This setting is not retained at restart.
308 Mod1 is generally the ALT key and Mod4 is the windows key on a PC.
309 .It Ic program Ns Bq Ar p
310 Define new action to spawn a program
315 .It Ic quirk Ns Bq Ar c:n
316 Add "quirk" for windows with class
324 Allocates a custom region, removing any autodetected regions which occupy the
325 same space on the screen.
326 Defined in the format screen[<idx>]:WIDTHxHEIGHT+X+Y,
327 e.g.\& screen[1]:800x1200+0+0.
329 To make a region span multiple monitors, create a region big enough to cover
330 them all, e.g. screen[1]:2048x768+0+0 makes the region span two monitors with
331 1024x768 resolution sitting one next to the other.
332 .It Ic region_padding
333 Pixel width of empty space within region borders.
334 Disable by setting to 0.
335 .It Ic spawn_position
336 Position in stack to place newly spawned windows.
347 are relative to the focused window.
349 Enable or disable displaying the current stacking algorithm in the status
352 Set a preferred minimum width for the terminal.
353 If this value is greater than 0,
355 will attempt to adjust the font sizes in the terminal to keep the terminal
356 width above this number as the window is resized.
359 is currently supported.
362 binary must not be setuid or setgid, which it is by default on most systems.
363 Users may need to set program[term] (see the
365 section) to use an alternate copy of the
367 binary without the setgid bit set.
369 Pixel width of empty space between tiled windows.
370 Disable by setting to 0.
371 .It Ic title_class_enabled
372 Enable or disable displaying the window class in the status bar.
373 Enable by setting to 1.
374 .It Ic title_name_enabled
375 Enable or disable displaying the window title in the status bar.
376 Enable by setting to 1.
377 .It Ic urgent_enabled
378 Enable or disable the urgency hint.
379 Note that many terminal emulators require this to be enabled for it to
381 In xterm, for example, one needs to add the following line
382 .Pa xterm.bellIsUrgent: true
385 .It Ic verbose_layout
386 Enable or disable displaying the current master window count and stack column/row
387 count in the status bar.
388 Enable by setting to 1.
395 for more information.
396 .It Ic window_name_enabled
397 Enable or disable displaying the window name in the status bar.
398 Enable by setting to 1.
400 To prevent excessively large window names from pushing the remaining text off
401 the bar, it's limited to 64 characters, by default.
404 option for more details.
405 .It Ic workspace_limit
406 Set the total number of workspaces available. Minimum is 1, maximum is 22,
411 allows you to define custom actions to launch programs of your choice and
412 then bind them the same as with built-in actions.
417 Custom programs in the configuration file are specified as follows:
419 .Dl program[<action>] = <progpath> [<arg> [... <arg>]]
422 is any identifier that does not conflict with a built-in action or keyword,
424 is the desired program, and
426 is zero or more arguments to the program.
428 Remember that when using # in your program call, it must be escaped with a
431 The following argument variables will be substituted for values at the time the program
434 .Bl -tag -width "$bar_font_color" -offset indent -compact
438 .It Cm $bar_font_color
440 .It Cm $color_unfocus
442 .It Cm $workspace_index
446 .Bd -literal -offset indent
447 program[ff] = /usr/local/bin/firefox http://spectrwm.org/
448 bind[ff] = Mod+Shift+b # Now M-S-b launches firefox
451 To cancel the previous, unbind it:
452 .Bd -literal -offset indent
457 .Bl -tag -width "screenshot_wind" -offset indent -compact
461 dmenu_run \-fn $bar_font \-nb $bar_color \-nf $bar_font_color \-sb
462 $bar_border \-sf $bar_color
466 initscreen.sh # optional
467 .It Cm screenshot_all
468 screenshot.sh full # optional
469 .It Cm screenshot_wind
470 screenshot.sh window # optional
473 Note that optional default programs will not be validated unless overridden.
474 If a default program fails validation, you can resolve the exception
475 by installing the program, modifying the program call or disabling the program
476 by freeing the respective key binding.
478 For example, to override
480 .Bd -literal -offset indent
481 program[lock] = xscreensaver-command --lock
486 and prevent it from being validated:
487 .Bd -literal -offset indent
488 bind[] = MOD+Shift+Delete
492 provides many functions (or actions) accessed via key or mouse bindings.
494 The current mouse bindings are described below:
496 .Bl -tag -width "M-j, M-<TAB>XXX" -offset indent -compact
504 Resize window while maintaining it centered
507 The default key bindings are described below:
509 .Bl -tag -width "M-j, M-<TAB>XXXXXX" -offset indent -compact
510 .It Cm M-S- Ns Aq Cm Return
518 .It Cm M- Ns Aq Cm Space
520 .It Cm M-S- Ns Aq Cm \e
522 .It Cm M-S- Ns Aq Cm Space
536 .It Cm M- Ns Aq Cm Return
545 .Cm M-S- Ns Aq Cm TAB
562 .It Cm M- Ns Aq Ar 1-9,0,F1-F12
564 .It Cm M-S- Ns Aq Ar 1-9,0,F1-F12
565 .Pf mvws_ Ns Aq Ar 1-22
566 .It Cm M- Ns Aq Ar Keypad 1-9
568 .It Cm M-S- Ns Aq Ar Keypad 1-9
570 .It Cm M- Ns Aq Cm Right
572 .It Cm M- Ns Aq Cm Left
574 .It Cm M- Ns Aq Cm Up
576 .It Cm M- Ns Aq Cm Down
580 .It Cm M-S- Ns Aq Cm Left
582 .It Cm M-S- Ns Aq Cm Up
584 .It Cm M-S- Ns Aq Cm Right
586 .It Cm M-S- Ns Aq Cm Left
596 .It Cm M-S- Ns Aq Cm Delete
632 The action names and descriptions are listed below:
634 .Bl -tag -width "M-j, M-<TAB>XXXX" -offset indent -compact
654 Swap the master and stacking areas.
662 Add windows to master area.
664 Remove windows from master area.
666 Add columns/rows to stacking area.
668 Remove columns/rows from stacking area.
670 Move current window to master area.
672 Focus next window in workspace.
674 Focus previous window in workspace.
676 Focus on main window in workspace.
678 Swap with next window in workspace.
680 Swap with previous window in workspace.
682 Toggle overall visibility of status bars.
684 Toggle status bar on current workspace.
686 Delete current window in workspace.
688 Destroy current window in workspace.
694 is 1 through workspace_limit.
696 Move current window to workspace
700 is 1 through workspace_limit.
708 Move current window to region
714 Switch to next workspace with a window in it.
716 Switch to previous workspace with a window in it.
718 Switch to next workspace.
720 Switch to previous workspace.
722 Switch to next workspace with the current window.
724 Switch to previous workspace with the current window.
726 Switch to last visited workspace.
728 Switch to next region.
730 Switch to previous region.
731 .It Cm screenshot_all
732 Take screenshot of entire screen (if enabled)
736 .It Cm screenshot_wind
737 Take screenshot of selected window (if enabled)
742 Toggle version in status bar.
744 Toggle focused window between tiled and floating.
751 Reinitialize physical screens
756 Minimize (unmap) currently focused window.
758 Maximize (map) window returned by dmenu selection.
760 When set tiled windows are allowed to obscure floating windows.
762 Fake a middle mouse button click (mouse button 2).
764 Shrink the width of a floating window.
766 Grow the width of a floating window.
768 Shrink the height of a floating window.
770 Grow the height of a floating window.
772 Move a floating window a step to the left.
774 Move a floating window a step to the right.
776 Move a floating window a step upwards.
778 Move a floating window a step downwards.
779 .It Cm name_workspace
780 Name the current workspace.
781 .It Cm search_workspace
782 Search for a workspace.
784 Search the windows in the current workspace.
787 Custom bindings in the configuration file are specified as follows:
789 .Dl bind[<action>] = <keys>
792 is one of the actions listed above (or empty to unbind) and
794 is in the form of zero or more modifier keys
795 (MOD, Mod1, Shift, etc.) and one or more normal keys
796 (b, space, etc.), separated by "+".
799 .Bd -literal -offset indent
800 bind[reset] = Mod4+q # bind Windows-key + q to reset
801 bind[] = Mod1+q # unbind Alt + q
804 To use the currently defined
806 specify MOD as the modifier key.
808 Multiple key combinations may be bound to the same action.
810 To bind non-latin characters such as å or π you must enter the xkb
811 character name instead of the character itself. Run xev, focus the window
812 and press the specific key and in the terminal output read the symbol name.
813 In the fallowing example for å:
814 .Bd -literal -offset indent
815 KeyPress event, serial 41, synthetic NO, window 0x2600001,
816 root 0x15a, subw 0x0, time 106213808, (11,5), root:(359,823),
817 state 0x0, keycode 24 (keysym 0xe5, aring), same_screen YES,
818 XLookupString gives 2 bytes: (c3 a5) "å"
819 XmbLookupString gives 2 bytes: (c3 a5) "å"
820 XFilterEvent returns: False
823 The xkb name is aring. In other words, in .spectrwm.conf add:
824 .Bd -literal -offset indent
825 bind[program] = MOD+aring
827 .Sh KEYBOARD MAPPING FILES
828 Keyboard mapping files for several keyboard layouts are listed
830 These files can be used with the
832 setting to load pre-defined key bindings for the specified
835 .Bl -tag -width "spectrwm_XX.confXXX" -offset indent -compact
836 .It Cm spectrwm_cz.conf
837 Czech Republic keyboard layout
838 .It Cm spectrwm_es.conf
839 Spanish keyboard layout
840 .It Cm spectrwm_fr.conf
841 French keyboard layout
842 .It Cm spectrwm_fr_ch.conf
843 Swiss French keyboard layout
844 .It Cm spectrwm_se.conf
845 Swedish keyboard layout
846 .It Cm spectrwm_us.conf
847 United States keyboard layout
851 provides "quirks" which handle windows that must be treated specially
852 in a tiling window manager, such as some dialogs and fullscreen apps.
854 The default quirks are described below:
856 .Bl -tag -width "OpenOffice.org N.M:VCLSalFrame<TAB>XXX" -offset indent \
858 .It Firefox\-bin:firefox\-bin
865 FLOAT + FULLSCREEN + FOCUSPREV
866 .It OpenOffice.org 2.4:VCLSalFrame
868 .It OpenOffice.org 3.1:VCLSalFrame
876 .It xine:xine Video Fullscreen Window
886 The quirks themselves are described below:
888 .Bl -tag -width "XTERM_FONTADJ<TAB>XXX" -offset indent -compact
890 This window should not be tiled, but allowed to float freely.
892 Adjusts size on transient windows that are too small using dialog_ratio
894 .Sx CONFIGURATION FILES ) .
896 Allow window to position itself, uncentered.
898 Adjust xterm fonts when resizing.
900 Remove border to allow window to use full region size.
902 On exit force focus on previously focused application not previous
903 application in the stack.
905 Don't change focus to the window when it first appears on the screen.
909 .It FOCUSONMAP_SINGLE
910 When the window first appears on the screen, change focus to the window
911 if there are no other windows on the workspace with the same class/name.
917 Custom quirks in the configuration file are specified as follows:
919 .Dl quirk[<class>:<name>] = <quirk> [ + <quirk> ... ]
924 specify the window to which the quirk(s) apply, and
926 is one of the quirks from the list above.
928 .Bd -literal -offset indent
929 quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV
930 quirk[pcb:pcb] = NONE # remove existing quirk
939 and then clicking on the desired window.
940 In the following example the main window of Firefox was clicked:
941 .Bd -literal -offset indent
942 $ xprop | grep WM_CLASS
943 WM_CLASS(STRING) = "Navigator", "Firefox"
946 Note that grepping for WM_CLASS flips class and name.
947 In the example above the quirk entry would be:
948 .Bd -literal -offset indent
949 quirk[Firefox:Navigator] = FLOAT
953 also automatically assigns quirks to windows based on the value
954 of the window's _NET_WM_WINDOW_TYPE property as follows:
956 .Bl -tag -width "_NET_WM_WINDOW_TYPE_TOOLBAR<TAB>XXX" -offset indent -compact
957 .It _NET_WM_WINDOW_TYPE_DOCK
959 .It _NET_WM_WINDOW_TYPE_TOOLBAR
961 .It _NET_WM_WINDOW_TYPE_UTILITY
963 .It _NET_WM_WINDOW_TYPE_SPLASH
965 .It _NET_WM_WINDOW_TYPE_DIALOG
969 In all other cases, no automatic quirks are assigned to the window.
970 Quirks specified in the configuration file override the automatic quirks.
973 partially implements the Extended Window Manager Hints (EWMH) specification.
974 This enables controlling windows as well as
976 itself from external scripts and programs.
979 responding to certain ClientMessage events.
980 From the terminal these events
981 can be conveniently sent using tools such as
986 actual format of these ClientMessage events, see the EWMH specification.
988 The id of the currently focused window is stored in the _NET_ACTIVE_WINDOW
989 property of the root window.
990 This can be used for example to retrieve the
991 title of the currently active window with
995 .Bd -literal -offset indent
996 $ WINDOWID=`xprop \-root _NET_ACTIVE_WINDOW | grep \-o "0x.*"`
997 $ xprop \-id $WINDOWID WM_NAME | grep \-o "\\".*\\""
1000 A window can be focused by sending a _NET_ACTIVE_WINDOW client message
1005 (assuming 0x4a0000b is the id of the window to be focused):
1006 .Bd -literal -offset indent
1007 $ wmctrl \-i \-a 0x4a0000b
1010 Windows can be closed by sending a _NET_CLOSE_WINDOW client message
1015 (assuming 0x4a0000b is the id of the window to be closed):
1016 .Bd -literal -offset indent
1017 $ wmctrl \-i \-c 0x4a0000b
1020 Windows can be floated and un-floated by adding or removing the
1021 _NET_WM_STATE_ABOVE atom from the _NET_WM_STATE property of the window.
1022 This can be achieved by sending a _NET_WM_STATE client message to the
1024 For example, the following toggles the floating state of
1027 to send the message (assuming 0x4a0000b is the id of the window floated
1029 .Bd -literal -offset indent
1030 $ wmctrl \-i \-r 0x4a0000b \-b toggle,_NET_WM_STATE_ABOVE
1033 Floating windows can also be resized and moved by sending a
1034 _NET_MOVERESIZE_WINDOW client message to the root window.
1038 to send the message (assuming 0x4a0000b is the id of
1039 the window to be resize/moved):
1040 .Bd -literal -offset indent
1041 $ wmctrl \-i \-r 0x4a0000b \-e 0,100,50,640,480
1044 This moves the window to (100,50) and resizes it to 640x480.
1046 Any _NET_MOVERESIZE_WINDOW events received for stacked windows are ignored.
1050 a HUP signal will restart it.
1052 .Bl -tag -width "/etc/spectrwm.confXXX" -compact
1053 .It Pa ~/.spectrwm.conf
1055 user specific settings.
1056 .It Pa /etc/spectrwm.conf
1062 was inspired by xmonad & dwm.
1068 .Bl -tag -width "Ryan Thomas McBride Aq mcbride@countersiege.com " -offset \
1070 .It Cm Marco Peereboom Aq marco@peereboom.us
1071 .It Cm Ryan Thomas McBride Aq mcbride@countersiege.com
1072 .It Cm Darrin Chandler Aq dwchandler@stilyagin.com
1073 .It Cm Pierre-Yves Ritschard Aq pyr@spootnik.org
1074 .It Cm Tuukka Kataja Aq stuge@xor.fi
1075 .It Cm Jason L. Wright Aq jason@thought.net
1076 .It Cm Reginald Kennedy Aq rk@rejii.com
1077 .It Cm Lawrence Teo Aq lteo@lteo.net
1078 .It Cm Tiago Cunha Aq tcunha@gmx.com
1079 .It Cm David Hill Aq dhill@mindcry.org