JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
document EWMH usage
[spectrwm.git] / scrotwm.1
index 9ddf6fd..8499bb4 100644 (file)
--- a/scrotwm.1
+++ b/scrotwm.1
@@ -78,7 +78,11 @@ Enabling or disabling an option is done by using 1 or 0 respectively.
 .Pp
 The file supports the following keywords:
 .Pp
 .Pp
 The file supports the following keywords:
 .Pp
-.Bl -tag -width "screenshot_enabledXXX" -offset indent -compact
+.Bl -tag -width "title_class_enabledXXX" -offset indent -compact
+.It Cm 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 and
+xterm in workspace 2
 .It Cm color_focus
 Border color of the currently focussed window.
 .It Cm color_unfocus
 .It Cm color_focus
 Border color of the currently focussed window.
 .It Cm color_unfocus
@@ -87,6 +91,9 @@ Border color of unfocussed windows.
 Enable or disable status bar.
 .It Cm bar_border Ns Bq Ar x
 Color of the status bar border in screen
 Enable or disable status bar.
 .It Cm bar_border Ns Bq Ar x
 Color of the status bar border in screen
+.It Cm bar_border_width
+Set status bar border thickness in pixels.
+Disable border by setting to 0
 .Ar x .
 .It Cm bar_color Ns Bq Ar x
 Color of the status bar window in screen
 .Ar x .
 .It Cm bar_color Ns Bq Ar x
 Color of the status bar window in screen
@@ -101,30 +108,52 @@ External script that populates additional information in the status bar,
 such as battery life.
 .It Cm bar_delay
 Update frequency, in seconds, of external script that populates the status bar.
 such as battery life.
 .It Cm bar_delay
 Update frequency, in seconds, of external script that populates the status bar.
+.It Cm bar_at_bottom
+Place the statusbar at the bottom of each region instead of the top.
+.It Cm stack_enabled
+Enable or disable displaying the current stacking algorithm in the status bar.
 .It Cm 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.
 .It Cm 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.
-.It Cm spawn_term
-External application that gets spawned when
-.Cm M-S- Ns Aq Cm Return
-is used.
 .It Cm dialog_ratio
 Some applications have dialogue windows that are too small to be useful.
 This ratio is the screen size to what they will be resized.
 For example, 0.6 is 60% of the physical screen size.
 .It Cm dialog_ratio
 Some applications have dialogue windows that are too small to be useful.
 This ratio is the screen size to what they will be resized.
 For example, 0.6 is 60% of the physical screen size.
+.It Cm layout
+select layout to use at start-of-day.
+Defined in the format
+ws[idx]:master_grow:master_add:stack_inc:layout:always_raise:stack_mode, e.g.
+ws[2]:-4:0:1:0:horizontal sets worskspace 2 to the horizontal stack mode and
+shrinks the master area by 4 ticks and adds one window to the stack, while
+maintaining default floating window behavior.
+Possible stack_mode values are
+.Pa vertical ,
+.Pa horizontal
+and
+.Pa fullscreen .
+.Pp
+See
+.Pa master_grow ,
+.Pa master_shrink ,
+.Pa master_add ,
+.Pa master_del ,
+.Pa stack_inc ,
+.Pa stack_del ,
+and
+.Pa 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
+.Pa layout
+option.
+.Pp
+This setting is not retained at restart.
 .It Cm region
 Allocates a custom region, removing any autodetected regions which occupy the same
 space on the screen.
 Defined in the format screen[<idx>]:WIDTHxHEIGHT+X+Y,
 e.g.\& screen[1]:800x1200+0+0.
 .It Cm region
 Allocates a custom region, removing any autodetected regions which occupy the same
 space on the screen.
 Defined in the format screen[<idx>]:WIDTHxHEIGHT+X+Y,
 e.g.\& screen[1]:800x1200+0+0.
-.It Cm screenshot_enabled
-Enable or disable screenshot capability.
-.It Cm screenshot_app
-Set to the script that will take screenshots.
-It will be called with "full" or "window" as parameter 1 to indicate what
-screenshot action is expected.
-The script shall handle those cases accordingly.
 .It Cm term_width
 Set a preferred minimum width for the terminal
 If this value is greater than 0,
 .It Cm term_width
 Set a preferred minimum width for the terminal
 If this value is greater than 0,
@@ -137,7 +166,9 @@ is currently supported.
 The
 .Xr xterm 1
 binary must not be setuid or setgid, which it is by default on most systems.
 The
 .Xr xterm 1
 binary must not be setuid or setgid, which it is by default on most systems.
-Users may need to set spawn term to use an alternate copy of the
+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 Cm title_class_enabled
 .Xr xterm 1
 binary without the setgid bit set.
 .It Cm title_class_enabled
@@ -146,9 +177,26 @@ Enable by setting to 1
 .It Cm title_name_enabled
 Enable or disable displaying the window title in the status bar.
 Enable by setting to 1
 .It Cm title_name_enabled
 Enable or disable displaying the window title in the status bar.
 Enable by setting to 1
+.It Cm window_name_enabled
+Enable or disable displaying the window name in the status bar.
+Enable by setting to 1
 .It Cm modkey
 Change mod key.
 Mod1 is generally the ALT key and Mod4 is the windows key on a PC.
 .It Cm modkey
 Change mod key.
 Mod1 is generally the ALT key and Mod4 is the windows key on a PC.
+.It Cm focus_mode
+Using a value of follow_cursor will make the window manager focus the window
+under the mouse when switching workspaces and creating windows.
+.It Cm disable_border
+Remove border when bar is disabled and there is only one window on the screen.
+.It Cm border_width
+Set window border thickness in pixels.
+Disable all borders by setting to 0
+.It Cm program Ns Bq Ar p
+Define new action to spawn a program
+.Ar p .
+See the
+.Sx PROGRAMS
+section below.
 .It Cm bind Ns Bq Ar x
 Bind key combo to action
 .Ar x .
 .It Cm bind Ns Bq Ar x
 Bind key combo to action
 .Ar x .
@@ -170,6 +218,82 @@ Colors need to be specified per the
 specification and fonts need to be specified per the
 .Xr XQueryFont 3
 specification.
 specification and fonts need to be specified per the
 .Xr XQueryFont 3
 specification.
+.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 you to show the X Logical Font Description ("XLFD") used
+as setting in the keyword bar_font.
+.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
+The default programs are described below:
+.Pp
+.Bl -tag -width "screenshot_wind" -offset indent -compact
+.It Cm term
+xterm
+.It Cm screenshot_all
+screenshot.sh full
+.It Cm screenshot_wind
+screenshot.sh window
+.It Cm lock
+xlock
+.It Cm initscr
+initscreen.sh
+.It Cm menu
+dmenu_run \-fn $bar_font \-nb $bar_color \-nf $bar_font_color \-sb $bar_border \-sf $bar_color
+.El
+.Pp
+Custom programs in the configuration file are specified as follows:
+.Pp
+.Dl program[<name>] = <progpath> [<arg> [... <arg>]]
+.Pp
+.Aq name
+is any identifier that does not conflict with a built-in action or keyword,
+.Aq progpath
+is the desired program, and
+.Aq arg
+is zero or more arguments to the program.
+.Pp
+The following variables represent settable values in
+.Nm
+(see the
+.Sx CONFIGURATION FILES
+section above),
+and may be used in the
+.Aq arg
+fields and will be substituted for 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_font
+.It Cm $bar_font_color
+.It Cm $color_focus
+.It Cm $color_unfocus
+.El
+.Pp
+Example:
+.Bd -literal -offset indent
+program[ff] = /usr/local/bin/firefox http://scrotwm.org/
+bind[ff] = Mod+f # Now Mod+F launched firefox
+.Ed
+.Pp
+To undo the previous:
+.Bd -literal -offset indent
+bind[] = Mod+f
+program[ff] =
+.Ed
+.Pp
 .Sh BINDINGS
 .Nm
 provides many functions (or actions) accessed via key or mouse bindings.
 .Sh BINDINGS
 .Nm
 provides many functions (or actions) accessed via key or mouse bindings.
@@ -191,9 +315,9 @@ The default key bindings are described below:
 .Pp
 .Bl -tag -width "M-j, M-<TAB>XXX" -offset indent -compact
 .It Cm M-S- Ns Aq Cm Return
 .Pp
 .Bl -tag -width "M-j, M-<TAB>XXX" -offset indent -compact
 .It Cm M-S- Ns Aq Cm Return
-spawn_term
+term
 .It Cm M-p
 .It Cm M-p
-spawn_menu
+menu
 .It Cm M-S-q
 quit
 .It Cm M-q
 .It Cm M-S-q
 quit
 .It Cm M-q
@@ -247,6 +371,8 @@ wind_kill
 ws_next
 .It Cm M- Ns Aq Cm Left
 ws_prev
 ws_next
 .It Cm M- Ns Aq Cm Left
 ws_prev
+.It Cm M-a
+ws_prior
 .It Cm M-S- Ns Aq Cm Right
 screen_next
 .It Cm M-S- Ns Aq Cm Left
 .It Cm M-S- Ns Aq Cm Right
 screen_next
 .It Cm M-S- Ns Aq Cm Left
@@ -259,19 +385,31 @@ screenshot_wind
 version
 .It Cm M-t
 float_toggle
 version
 .It Cm M-t
 float_toggle
-.It Cm M-S Aq Cm Delete
-spawn_lock
+.It Cm M-S- Ns Aq Cm Delete
+lock
 .It Cm M-S-i
 .It Cm M-S-i
-spawn_initscr
+initscr
+.It Cm M-w
+iconify
+.It Cm M-S-w
+uniconify
+.It Cm M-S-r
+toggle always_raised
 .El
 .Pp
 The action names and descriptions are listed below:
 .Pp
 .Bl -tag -width "M-j, M-<TAB>XXX" -offset indent -compact
 .El
 .Pp
 The action names and descriptions are listed below:
 .Pp
 .Bl -tag -width "M-j, M-<TAB>XXX" -offset indent -compact
-.It Cm spawn_term
+.It Cm term
 Spawn a new terminal
 Spawn a new terminal
-.It Cm spawn_menu
+(see
+.Sx PROGRAMS
+above)
+.It Cm menu
 Menu
 Menu
+(see
+.Sx PROGRAMS
+above)
 .It Cm quit
 Quit
 .Nm
 .It Cm quit
 Quit
 .Nm
@@ -328,22 +466,42 @@ is 1 through 10
 Switch to next workspace with a window in it
 .It Cm ws_prev
 Switch to previous workspace with a window in it
 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_prior
+Switch to last visited workspace
 .It Cm screen_next
 Move pointer to next region
 .It Cm screen_prev
 Move pointer to previous region
 .It Cm screenshot_all
 Take screenshot of entire screen (if enabled)
 .It Cm screen_next
 Move pointer to next region
 .It Cm screen_prev
 Move pointer to previous region
 .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)
 .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 version
 Toggle version in status bar
 .It Cm float_toggle
 Toggle focused window between tiled and floating
-.It Cm spawn_lock
+.It Cm lock
 Lock screen
 Lock screen
-.It Cm spawn_initscr
+(see
+.Sx PROGRAMS
+above)
+.It Cm initscr
 Reinitialize physical screens
 Reinitialize physical screens
+(see
+.Sx PROGRAMS
+above)
+.It Cm iconify
+Minimize (unmap) currently focused window.
+.It Cm uniconify
+Maximize (map) window returned by dmenu selection.
+.It Cm always_raise
+When set tiled windows are allowed to obscure floating windows.
 .El
 .Pp
 Custom bindings in the configuration file are specified as follows:
 .El
 .Pp
 Custom bindings in the configuration file are specified as follows:
@@ -371,14 +529,14 @@ in a tiling window manager, such as some dialogs and fullscreen apps.
 The default quirks are described below:
 .Pp
 .Bl -tag -width "OpenOffice.org N.M:VCLSalFrame<TAB>XXX" -offset indent -compact
 The default quirks are described below:
 .Pp
 .Bl -tag -width "OpenOffice.org N.M:VCLSalFrame<TAB>XXX" -offset indent -compact
-.It Firefox-bin:firefox-bin
+.It Firefox\-bin:firefox\-bin
 TRANSSZ
 .It Firefox:Dialog
 FLOAT
 .It Gimp:gimp
 TRANSSZ
 .It Firefox:Dialog
 FLOAT
 .It Gimp:gimp
-FLOAT | ANYWHERE
+FLOAT + ANYWHERE
 .It MPlayer:xv
 .It MPlayer:xv
-FLOAT | FULLSCREEN
+FLOAT + FULLSCREEN + FOCUSPREV
 .It OpenOffice.org 2.4:VCLSalFrame
 FLOAT
 .It OpenOffice.org 3.1:VCLSalFrame
 .It OpenOffice.org 2.4:VCLSalFrame
 FLOAT
 .It OpenOffice.org 3.1:VCLSalFrame
@@ -386,15 +544,15 @@ FLOAT
 .It pcb:pcb
 FLOAT
 .It xine:Xine Window
 .It pcb:pcb
 FLOAT
 .It xine:Xine Window
-FLOAT | ANYWHERE
+FLOAT + ANYWHERE
 .It xine:xine Panel
 .It xine:xine Panel
-FLOAT | ANYWHERE
+FLOAT + ANYWHERE
 .It xine:xine Video Fullscreen Window
 .It xine:xine Video Fullscreen Window
-FULLSCREEN | FLOAT
+FULLSCREEN + FLOAT
 .It Xitk:Xitk Combo
 .It Xitk:Xitk Combo
-FLOAT | ANYWHERE
+FLOAT + ANYWHERE
 .It Xitk:Xine Window
 .It Xitk:Xine Window
-FLOAT | ANYWHERE
+FLOAT + ANYWHERE
 .It XTerm:xterm
 XTERM_FONTADJ
 .El
 .It XTerm:xterm
 XTERM_FONTADJ
 .El
@@ -414,11 +572,14 @@ Allow window to position itself, uncentered.
 Adjust xterm fonts when resizing.
 .It FULLSCREEN
 Remove border to allow window to use full screen size.
 Adjust xterm fonts when resizing.
 .It FULLSCREEN
 Remove border to allow window to use full screen size.
+.It FOCUSPREV
+On exit force focus on previously focused application not previous application
+in the stack.
 .El
 .Pp
 Custom quirks in the configuration file are specified as follows:
 .Pp
 .El
 .Pp
 Custom quirks in the configuration file are specified as follows:
 .Pp
-.Dl quirk[<class>:<name>] = <quirk> [ | <quirk> ... ]
+.Dl quirk[<class>:<name>] = <quirk> [ + <quirk> ... ]
 .Pp
 .Aq class
 and
 .Pp
 .Aq class
 and
@@ -428,20 +589,10 @@ specify the window to which the quirk(s) apply, and
 is one of the quirks from the list above.
 For example:
 .Bd -literal -offset indent
 is one of the quirks from the list above.
 For example:
 .Bd -literal -offset indent
-quirk[MPlayer:xv] = FLOAT | FULLSCREEN # let mplayer play
+quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV
 quirk[pcb:pcb] = NONE  # remove existing quirk
 .Ed
 .Pp
 quirk[pcb:pcb] = NONE  # remove existing quirk
 .Ed
 .Pp
-Note that spaces in
-.Aq class
-or
-.Aq name
-must be replaced by an underscore in the configuration.
-The config entry for "xine:Xine Panel" would be:
-.Bd -literal -offset indent
-quirk[xine:Xine_Panel] = FLOAT
-.Ed
-.Pp
 You can obtain
 .Aq class
 and
 You can obtain
 .Aq class
 and
@@ -452,6 +603,91 @@ In the following example the main window of Firefox was clicked:
 $ xprop | grep WM_CLASS
 WM_CLASS(STRING) = "Navigator", "Firefox"
 .Ed
 $ xprop | grep WM_CLASS
 WM_CLASS(STRING) = "Navigator", "Firefox"
 .Ed
+.Pp
+Note that grepping for WM_CLASS flips class and name.
+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_DOCK
+FLOAT + ANYWHERE
+.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 wmctrl and xdotool. 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 xprop(1) and grep(1):
+.Bd -literal -offset indent
+$ WINDOWID=`xprop -root _NET_ACTIVE_WINDOW | grep -o "0x.*"`
+$ xprop -id $WINDOWID WM_NAME | grep -o "\\".*\\""
+.Ed
+.Pp
+A window can be focused by sending a _NET_ACTIVE_WINDOW client message 
+to the root window. For example, using wmctrl 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 wmctrl 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 wmctrl to send the message (assuming 0x4a0000b is the 
+id of the window floated or un-floated):
+.Bd -literal -offset indent
+$ wmctrl -i -r 0x4a0000b -b toggle,_NET_WM_STATE_ABOVE
+.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 wmctrl 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
+Any _NET_MOVERESIZE_WINDOW events received for stacked windows are ignored.
+.Pp
+.Sh SIGNALS
+Sending
+.Nm
+a HUP signal will restart it.
 .Sh FILES
 .Bl -tag -width "/etc/scrotwm.confXXX" -compact
 .It Pa ~/.scrotwm.conf
 .Sh FILES
 .Bl -tag -width "/etc/scrotwm.confXXX" -compact
 .It Pa ~/.scrotwm.conf
@@ -466,13 +702,17 @@ global settings.
 was inspired by xmonad & dwm.
 .Sh AUTHORS
 .An -nosplit
 was inspired by xmonad & dwm.
 .Sh AUTHORS
 .An -nosplit
-.Pp
 .Nm
 .Nm
-was written by
-.An Marco Peereboom Aq marco@peereboom.us ,
-.An Ryan Thomas McBride Aq mcbride@countersiege.com
-and
-.An Darrin Chandler Aq dwchandler@stilyagin.com .
+was written by:
+.Pp
+.Bl -tag -width "Ryan Thomas McBride Aq mcbride@countersiege.com " -offset indent -compact
+.It Cm Marco Peereboom Aq marco@peereboom.us
+.It Cm Ryan Thomas McBride Aq mcbride@countersiege.com
+.It Cm Darrin Chandler Aq dwchandler@stilyagin.com
+.It Cm Pierre-Yves Ritschard Aq pyr@spootnik.org
+.It Cm Tuukka Kataja Aq stuge@xor.fi
+.It Cm Jason L. Wright Aq jason@thought.net
+.El
 .Sh BUGS
 Currently the menu, invoked with
 .Cm M-p ,
 .Sh BUGS
 Currently the menu, invoked with
 .Cm M-p ,