Change validation behavior for default 'optional' applications.
Overriding the binding will no longer cause validation.
Validation will only occur when the program call is overridden.
Add details in spectrwm.conf on how to disable the default programs.
Improve man page PROGRAMS section.
Added details on default program validation and how to disable/override.
.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>]]
+.Dl program[<action>] = <progpath> [<arg> [... <arg>]]
.Pp
-.Aq name
+.Aq action
is any identifier that does not conflict with a built-in action or keyword,
.Aq progpath
is the desired program, and
Example:
.Bd -literal -offset indent
program[ff] = /usr/local/bin/firefox http://spectrwm.org/
-bind[ff] = Mod+Shift+b # Now Mod+Shift+B launches firefox
+bind[ff] = Mod+Shift+b # Now M-S-b launches firefox
.Ed
.Pp
-To undo the previous:
+To cancel the previous, unbind it:
.Bd -literal -offset indent
bind[] = Mod+Shift+b
-program[ff] =
+.Ed
+.Pp
+Default programs:
+.Bl -tag -width "screenshot_wind" -offset indent -compact
+.It Cm lock
+xlock
+.It Cm menu
+dmenu_run \-fn $bar_font \-nb $bar_color \-nf $bar_font_color \-sb
+$bar_border \-sf $bar_color
+.It Cm term
+xterm
+.It Cm initscr
+initscreen.sh # optional
+.It Cm screenshot_all
+screenshot.sh full # optional
+.It Cm screenshot_wind
+screenshot.sh window # optional
+.El
+.Pp
+Note that optional default programs will not be validated unless overridden.
+If a default program fails validation, you can resolve the exception
+by installing the program, modifying the program call or disabling the program
+by freeing the respective key binding.
+.Pp
+For example, to override
+.Ic lock :
+.Bd -literal -offset indent
+program[lock] = xscreensaver-command --lock
+.Ed
+.Pp
+To unbind
+.Ic lock
+and prevent it from being validated:
+.Bd -literal -offset indent
+bind[] = MOD+Shift+Delete
.Ed
.Sh BINDINGS
.Nm
.Dl bind[<action>] = <keys>
.Pp
.Aq action
-is one of the actions listed above (or empty) and
+is one of the actions listed above (or empty to unbind) and
.Aq keys
is in the form of zero or more modifier keys
(MOD, Mod1, Shift, etc.) and one or more normal keys
(b, space, etc.), separated by "+".
-For example:
+.Pp
+Example:
.Bd -literal -offset indent
bind[reset] = Mod4+q # bind Windows-key + q to reset
bind[] = Mod1+q # unbind Alt + q
for (kfid = 0; kfid < KF_INVALID; (kfid)++) {
if (strncasecmp(selector, keyfuncs[kfid].name,
SWM_FUNCNAME_LEN) == 0) {
- DNPRINTF(SWM_D_KEY, "setconfbinding: %s: match\n",
- selector);
+ DNPRINTF(SWM_D_KEY, "setconfbinding: %s: match "
+ "keyfunc\n", selector);
if (parsekeys(value, mod_key, &mod, &ks) == 0) {
setkeybinding(mod, ks, kfid, NULL);
return (0);
/* search by custom spawn name */
TAILQ_FOREACH(sp, &spawns, entry) {
if (strcasecmp(selector, sp->name) == 0) {
- DNPRINTF(SWM_D_KEY, "setconfbinding: %s: match\n",
- selector);
+ DNPRINTF(SWM_D_KEY, "setconfbinding: %s: match "
+ "spawn\n", selector);
if (parsekeys(value, mod_key, &mod, &ks) == 0) {
setkeybinding(mod, ks, KF_SPAWN_CUSTOM,
sp->name);
- /* Custom binding; validate spawn. */
- sp->flags ^= SWM_SPAWN_OPTIONAL;
return (0);
} else
return (1);
int
setkeymapping(char *selector, char *value, int flags)
{
- char keymapping_file[PATH_MAX];
+ char *keymapping_file;
/* suppress unused warnings since vars are needed */
(void)selector;
(void)flags;
DNPRINTF(SWM_D_KEY, "setkeymapping: enter\n");
- if (value[0] == '~')
- snprintf(keymapping_file, sizeof keymapping_file, "%s/%s",
- pwd->pw_dir, &value[1]);
- else
- strlcpy(keymapping_file, value, sizeof keymapping_file);
+
+ keymapping_file = expand_tilde(value);
+
clear_keys();
/* load new key bindings; if it fails, revert to default bindings */
if (conf_load(keymapping_file, SWM_CONF_KEYMAPPING)) {
clear_keys();
setup_keys();
}
+
+ free(keymapping_file);
+
DNPRINTF(SWM_D_KEY, "setkeymapping: leave\n");
return (0);
}
warnx("conf_load: no filename");
return (1);
}
+
+ DNPRINTF(SWM_D_CONF, "conf_load: open %s\n", filename);
+
if ((config = fopen(filename, "r")) == NULL) {
warn("conf_load: fopen: %s", filename);
return (1);
# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE!
# http://opensource.conformal.com/cgi-bin/man-cgi?spectrwm
-# NOTE: all colors in this file are in hex! see XQueryColor for examples
+# NOTE: all rgb color values in this file are in hex! see XQueryColor for examples
# workspace_limit = 22
# focus_mode = default
# focus_default = last
# spawn_position = next
-# window decoration
+# Window Decoration
# border_width = 1
# color_focus = red
# color_unfocus = rgb:88/88/88
# Remove window border when bar is disabled and there is only one window in workspace
# disable_border = 1
-# bar settings
+# Bar Settings
# bar_enabled = 1
# bar_border_width = 1
# bar_border[1] = rgb:00/80/80
# Spawn Applications
# spawn_position = last
-# program[term] = xterm
-# program[screenshot_all] = screenshot.sh full
-# program[screenshot_wind] = screenshot.sh window
-# program[lock] = xlock
-# program[initscr] = initscreen.sh
-# program[menu] = dmenu_run -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_border -sf $bar_color
-# dialog box size ratio .3 >= r < 1
+# Dialog box size ratio when using TRANSSZ quirk; 0.3 < dialog_ratio <= 1.0
# dialog_ratio = 0.6
-# Split a non-Xrandr dual head setup into one region per monitor
+# Split a non-RandR dual head setup into one region per monitor
# (non-standard driver-based multihead is not seen by spectrwm)
# region = screen[1]:1280x1024+0+0
# region = screen[1]:1280x1024+1280+0
# autorun = ws[1]:xterm
# autorun = ws[2]:xombrero http://www.openbsd.org
-# workspace layout
+# Customize workspace layout at start
# layout = ws[1]:4:0:0:0:vertical
# layout = ws[2]:0:0:0:0:horizontal
# layout = ws[3]:0:0:0:0:fullscreen
# layout = ws[4]:4:0:0:0:vertical_flip
# layout = ws[5]:0:0:0:0:horizontal_flip
-# mod key, (windows key is Mod4) (apple key on OSX is Mod2)
+# Mod key, (Windows key is Mod4) (Apple key on OSX is Mod2)
# modkey = Mod1
-# Clear key bindings and load new key bindings from the specified file.
-# This allows you to load pre-defined key bindings for your keyboard layout.
+# This allows you to include pre-defined key bindings for your keyboard layout.
# keyboard_mapping = ~/.spectrwm_us.conf
-# quirks
-# remove with: quirk[class:name] = NONE
+# PROGRAMS
+
+# Validated default programs:
+# program[lock] = xlock
+# program[term] = xterm
+# program[menu] = dmenu_run -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_border -sf $bar_color
+
+# To disable validation of the above, free the respective binding(s):
+# bind[] = MOD+Shift+Delete # disable lock
+# bind[] = MOD+Shift+Enter # disable term
+# bind[] = MOD+p # disable menu
+
+# Optional default programs that will only be validated if you override:
+# program[screenshot_all] = screenshot.sh full # optional
+# program[screenshot_wind] = screenshot.sh window # optional
+# program[initscr] = initscreen.sh # optional
+
+# EXAMPLE: Define 'firefox' action and bind to key.
+# program[firefox] = firefox http://spectrwm.org/
+# bind[firefox] = MOD+Shift+b
+
+# QUIRKS
+# Default quirks, remove with: quirk[class:name] = NONE
# quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV
# quirk[OpenOffice.org 2.4:VCLSalFrame] = FLOAT
# quirk[OpenOffice.org 3.0:VCLSalFrame] = FLOAT
# quirk[Xitk:Xine Window] = FLOAT + ANYWHERE
# quirk[xine:xine Video Fullscreen Window] = FULLSCREEN + FLOAT
# quirk[pcb:pcb] = FLOAT
-
-# EXAMPLE: define firefox program and bind to key
-# program[firefox] = firefox http://spectrwm.org/
-# bind[firefox] = MOD+Shift+b