diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-18 14:57:43 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-18 14:57:43 +0530 |
| commit | 579f0d0af2a02a89a85ba6d70cca6e053a644055 (patch) | |
| tree | 55ab175c4bddcce1e3dd8c309b08c13d39ae1e27 | |
| parent | 7094c2ff4ce035e5a3a0c611acd06525939d5e0e (diff) | |
| download | shotkey-579f0d0af2a02a89a85ba6d70cca6e053a644055.tar.gz shotkey-579f0d0af2a02a89a85ba6d70cca6e053a644055.zip | |
Adds back to normal mode if the key is not in mode
Diffstat (limited to '')
| -rw-r--r-- | TODO.md | 6 | ||||
| -rw-r--r-- | hotkeythingy.c | 6 |
2 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,6 @@ # TODO - - [ ] Grab entire keyboard for modes + - [ ] KeyPress and KeyRelease options + - [X] Grab entire keyboard for modes - [X] Add modes - [X] Persistent mode - [X] Get current mode @@ -8,6 +9,3 @@ - [X] Clean up build system - [X] Fix installation - [X] Create man page - -# Patches - - [ ] KeyPress and KeyRelease options diff --git a/hotkeythingy.c b/hotkeythingy.c index 922931a..dcbcc08 100644 --- a/hotkeythingy.c +++ b/hotkeythingy.c @@ -124,8 +124,8 @@ void keypress(Display *dpy, Window win, XKeyEvent *ev) { } } } else { - // Escape key - is_mode_persistent = is_mode_persistent && ev->keycode != 9; + // Will quit if the key pressed is not defined in the mode + is_mode_persistent = False; if (modes[current_mode] && current_mode < LENGTH(modes)) { // Check if key is in mode and execute @@ -133,6 +133,8 @@ void keypress(Display *dpy, Window win, XKeyEvent *ev) { mode_key = modes[current_mode][i]; if (keysym == mode_key.key && CLEANMASK(mode_key.mod) == CLEANMASK(ev->state)) { + // Action taken so keep the mode alive + is_mode_persistent = True; run(dpy, win, mode_key.command); } } |
