sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit d1f8d07dc3dc23f205d19db3adaf7b82e4812884
parent 49918e7163d6c65a869a1ac5974d9f101f8405fc
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Tue,  7 Oct 2014 23:03:59 +0200

Add new modifier: any

Example:
    any + button8
	echo Will accept any modifier combination

Diffstat:
Mdoc/sxhkd.1 | 6+++---
Mdoc/sxhkd.1.txt | 2+-
Mgrab.c | 2++
Mparse.c | 3+++
Mtypes.c | 2+-
5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/sxhkd.1 b/doc/sxhkd.1 @@ -2,12 +2,12 @@ .\" Title: sxhkd .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 08/09/2014 +.\" Date: 10/07/2014 .\" Manual: Sxhkd Manual .\" Source: Sxhkd 0.5.4 .\" Language: English .\" -.TH "SXHKD" "1" "08/09/2014" "Sxhkd 0\&.5\&.4" "Sxhkd Manual" +.TH "SXHKD" "1" "10/07/2014" "Sxhkd 0\&.5\&.4" "Sxhkd Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -133,7 +133,7 @@ MODIFIER_i := MODIFIER_i1 + MODIFIER_i2 + \&... + MODIFIER_ik .RE .\} .sp -The valid modifier names are: \fIsuper\fR, \fIhyper\fR, \fImeta\fR, \fIalt\fR, \fIcontrol\fR, \fIctrl\fR, \fIshift\fR, \fImode_switch\fR, \fIlock\fR, \fImod1\fR, \fImod2\fR, \fImod3\fR, \fImod4\fR and \fImod5\fR\&. +The valid modifier names are: \fIsuper\fR, \fIhyper\fR, \fImeta\fR, \fIalt\fR, \fIcontrol\fR, \fIctrl\fR, \fIshift\fR, \fImode_switch\fR, \fIlock\fR, \fImod1\fR, \fImod2\fR, \fImod3\fR, \fImod4\fR, \fImod5\fR and \fIany\fR\&. .sp The keysym names are given by the output of \fBxev\fR\&. .sp diff --git a/doc/sxhkd.1.txt b/doc/sxhkd.1.txt @@ -68,7 +68,7 @@ CHORD_i := [MODIFIER_i][@|!|~]KEYSYM_i MODIFIER_i := MODIFIER_i1 + MODIFIER_i2 + … + MODIFIER_ik ---- -The valid modifier names are: _super_, _hyper_, _meta_, _alt_, _control_, _ctrl_, _shift_, _mode_switch_, _lock_, _mod1_, _mod2_, _mod3_, _mod4_ and _mod5_. +The valid modifier names are: _super_, _hyper_, _meta_, _alt_, _control_, _ctrl_, _shift_, _mode_switch_, _lock_, _mod1_, _mod2_, _mod3_, _mod4_, _mod5_ and _any_. The keysym names are given by the output of *xev*. diff --git a/grab.c b/grab.c @@ -55,6 +55,8 @@ void grab_chord(chord_t *chord) void grab_key_button(xcb_keycode_t keycode, xcb_button_t button, uint16_t modfield) { grab_key_button_checked(keycode, button, modfield); + if (modfield == XCB_MOD_MASK_ANY) + return; if (num_lock != 0) grab_key_button_checked(keycode, button, modfield | num_lock); if (caps_lock != 0) diff --git a/parse.c b/parse.c @@ -2755,6 +2755,9 @@ bool parse_modifier(char *name, uint16_t *modfield) } else if (strcmp(name, "lock") == 0) { *modfield |= XCB_MOD_MASK_LOCK; return true; + } else if (strcmp(name, "any") == 0) { + *modfield |= XCB_MOD_MASK_ANY; + return true; } return false; } diff --git a/types.c b/types.c @@ -105,7 +105,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel bool match_chord(chord_t *chord, uint8_t event_type, xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield) { for (chord_t *c = chord; c != NULL; c = c->more) - if (c->event_type == event_type && c->keysym == keysym && c->button == button && c->modfield == modfield) + if (c->event_type == event_type && c->keysym == keysym && c->button == button && (c->modfield == XCB_MOD_MASK_ANY || c->modfield == modfield)) return true; return false; }