diff options
author | Dmitry Meyer <me@undef.im> | 2023-11-11 11:13:22 +0000 |
---|---|---|
committer | Philip Jones <philj56@gmail.com> | 2024-12-30 15:19:27 +0000 |
commit | 1eb6137572ab6c257ab6ab851d5d742167c18120 (patch) | |
tree | 0baae3b40398bfe940b7856b0331a7b799809e44 | |
parent | 717f3a8f8589a2727f9811cbbc8b60671a0150d5 (diff) |
Add Ctrl+h and Ctrl+m keybindings
-rw-r--r-- | doc/tofi.1.md | 6 | ||||
-rw-r--r-- | doc/tofi.1.scd | 5 | ||||
-rw-r--r-- | src/input.c | 9 |
3 files changed, 16 insertions, 4 deletions
diff --git a/doc/tofi.1.md b/doc/tofi.1.md index eef1942..a3e8ab3 100644 --- a/doc/tofi.1.md +++ b/doc/tofi.1.md @@ -58,6 +58,10 @@ the form **--key=value**. > Move the selection forward one page. +\<Backspace\> \| \<Ctrl\>-h + +> Delete character. + \<Ctrl\>-u > Delete line. @@ -66,7 +70,7 @@ the form **--key=value**. > Delete word. -\<Enter\> +\<Enter\> \| \<Ctrl\>-m > Confirm the current selection and quit. diff --git a/doc/tofi.1.scd b/doc/tofi.1.scd index 88ef396..8dd259f 100644 --- a/doc/tofi.1.scd +++ b/doc/tofi.1.scd @@ -52,13 +52,16 @@ All config file options described in *tofi*(5) are also accepted, in the form <Page Down> Move the selection forward one page. +<Backspace> | <Ctrl>-h + Delete character. + <Ctrl>-u Delete line. <Ctrl>-w | <Ctrl>-<Backspace> Delete word. -<Enter> +<Enter> | <Ctrl>-m Confirm the current selection and quit. <Escape> | <Ctrl>-c | <Ctrl>-g | <Ctrl>-[ diff --git a/src/input.c b/src/input.c index 17b2015..8b8f0a7 100644 --- a/src/input.c +++ b/src/input.c @@ -62,7 +62,8 @@ void input_handle_keypress(struct tofi *tofi, xkb_keycode_t keycode) add_character(tofi, keycode); } else if ((key == KEY_BACKSPACE || key == KEY_W) && ctrl) { delete_word(tofi); - } else if (key == KEY_BACKSPACE) { + } else if (key == KEY_BACKSPACE + || (key == KEY_H && ctrl)) { delete_character(tofi); } else if (key == KEY_U && ctrl) { clear_input(tofi); @@ -94,7 +95,9 @@ void input_handle_keypress(struct tofi *tofi, xkb_keycode_t keycode) || ((key == KEY_C || key == KEY_LEFTBRACE || key == KEY_G) && ctrl)) { tofi->closed = true; return; - } else if (key == KEY_ENTER || key == KEY_KPENTER) { + } else if (key == KEY_ENTER + || key == KEY_KPENTER + || (key == KEY_M && ctrl)) { tofi->submit = true; return; } @@ -157,6 +160,8 @@ static uint32_t keysym_to_key(xkb_keysym_t sym) return KEY_ENTER; case XKB_KEY_KP_Enter: return KEY_KPENTER; + case XKB_KEY_m: + return KEY_M; } return (uint32_t)-1; } |