commit 2c421a1c99a05f8b9c1e0fde6970e373371f163a
parent 39099fcdd0fec93db3ea37011a0cabf6683957ad
Author: Bastien Dejean <nihilhill@gmail.com>
Date: Mon, 16 Feb 2015 10:18:24 +0100
Abort any chord chain with *Escape*
Fixes #39
Diffstat:
3 files changed, 12 insertions(+), 7 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: 12/29/2014
+.\" Date: 02/16/2015
.\" Manual: Sxhkd Manual
.\" Source: Sxhkd 0.5.4
.\" Language: English
.\"
-.TH "SXHKD" "1" "12/29/2014" "Sxhkd 0\&.5\&.4" "Sxhkd Manual"
+.TH "SXHKD" "1" "02/16/2015" "Sxhkd 0\&.5\&.4" "Sxhkd Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -156,7 +156,9 @@ Hotkeys and commands can be spread across multiple lines by ending each partial
.sp
When multiple chords are separated by semicolons, the hotkey is a chord chain: the command will only be executed after receiving each chord of the chain in consecutive order\&.
.sp
-The colon character can be used instead of the semicolon to indicate that the chord chain shall not be aborted when the chain tail is reached\&. In which case, the \fIEscape\fR key can be used to manually abort the chain\&.
+The colon character can be used instead of the semicolon to indicate that the chord chain shall not be aborted when the chain tail is reached\&.
+.sp
+The \fIEscape\fR key can be used to abort a chord chain\&.
.sp
If \fB@\fR is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events\&.
.sp
diff --git a/doc/sxhkd.1.txt b/doc/sxhkd.1.txt
@@ -94,7 +94,9 @@ Hotkeys and commands can be spread across multiple lines by ending each partial
When multiple chords are separated by semicolons, the hotkey is a chord chain: the command will only be executed after receiving each chord of the chain in consecutive order.
-The colon character can be used instead of the semicolon to indicate that the chord chain shall not be aborted when the chain tail is reached. In which case, the _Escape_ key can be used to manually abort the chain.
+The colon character can be used instead of the semicolon to indicate that the chord chain shall not be aborted when the chain tail is reached.
+
+The _Escape_ key can be used to abort a chord chain.
If *@* is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events.
diff --git a/types.c b/types.c
@@ -55,7 +55,6 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel
locked = true;
if (timeout > 0)
alarm(0);
- grab_chord(escape_chord);
}
if (c->state == c->tail) {
if (hk->cycle != NULL) {
@@ -85,9 +84,11 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel
return result;
if (!chained) {
- if (num_active > 0)
+ if (num_active > 0) {
chained = true;
- } else if (num_active == 0 || (locked && match_chord(escape_chord, event_type, keysym, button, modfield))) {
+ grab_chord(escape_chord);
+ }
+ } else if (num_active == 0 || match_chord(escape_chord, event_type, keysym, button, modfield)) {
abort_chain();
return find_hotkey(keysym, button, modfield, event_type, replay_event);
}