aboutsummaryrefslogtreecommitdiff
path: root/daemonic.c
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-16 23:49:52 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-16 23:49:52 +0530
commitd6639cf420aa7a23466cf6005f1e4b069ba839b0 (patch)
tree4212a26f52c980d7a0d8de837344580aeaa90cb1 /daemonic.c
parentcac37a84a20cc27f00ea14a95388ce650ebe749c (diff)
downloadshotkey-d6639cf420aa7a23466cf6005f1e4b069ba839b0.tar.gz
shotkey-d6639cf420aa7a23466cf6005f1e4b069ba839b0.zip
Adds unbinding of mode keys after execution
Diffstat (limited to '')
-rw-r--r--daemonic.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/daemonic.c b/daemonic.c
index 17c29bb..580794f 100644
--- a/daemonic.c
+++ b/daemonic.c
@@ -92,8 +92,8 @@ void keypress(Display *dpy, Window win, XKeyEvent *ev) {
}
}
} else {
- // TODO: Check and execute the mode
if (modes[current_mode] && current_mode < MODE_SIZE) {
+ // Check if key is in mode and execute
for (i = 0; i < LENGTH(modes[current_mode]); i++) {
mode_key = modes[current_mode][i];
@@ -101,9 +101,13 @@ void keypress(Display *dpy, Window win, XKeyEvent *ev) {
run(dpy, win, mode_key.command);
}
}
- }
- // TODO: Unbind mode keys
+ // Unbind mode related keys
+ for (i = 0; i < LENGTH(modes[current_mode]); i++) {
+ mode_key = modes[current_mode][i];
+ unbind_key(dpy, win, keys[i].mod, keys[i].key);
+ }
+ }
current_mode = -1;
}