From d6639cf420aa7a23466cf6005f1e4b069ba839b0 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 16 Jun 2020 23:49:52 +0530 Subject: Adds unbinding of mode keys after execution --- daemonic.c | 10 +++++++--- 1 file 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; } -- cgit v1.3.1