diff options
author | Phil Jones <philj56@gmail.com> | 2022-06-29 18:21:56 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2022-06-29 18:21:56 +0100 |
commit | 6f08bb41283e02bc35e25fc9f769fb950e9ee957 (patch) | |
tree | 6f26952a1f2ac4e5de211737e592e156a3789c10 | |
parent | 84016458470a8e9f076f3e7f1714c35e80afd7d6 (diff) |
Add Ctrl-j and Ctrl-k keybindings.
-rw-r--r-- | doc/tofi.1.md | 6 | ||||
-rw-r--r-- | doc/tofi.1.scd | 6 | ||||
-rw-r--r-- | src/main.c | 18 |
3 files changed, 22 insertions, 8 deletions
diff --git a/doc/tofi.1.md b/doc/tofi.1.md index ce3289f..6d2d83f 100644 --- a/doc/tofi.1.md +++ b/doc/tofi.1.md @@ -50,13 +50,13 @@ the form **--key=value**. # KEYS -\<Up\> \| \<Left\> +\<Up\> \| \<Left\> \| \<Ctrl\>-k > Move the selection back one entry. -\<Down\> \| \<Right\> \| \<Tab\> +\<Down\> \| \<Right\> \| \<Ctrl\>-j \| \<Tab\> -> Move the selection back forward entry. +> Move the selection forward one entry. \<Enter\> diff --git a/doc/tofi.1.scd b/doc/tofi.1.scd index 87740c1..0e48639 100644 --- a/doc/tofi.1.scd +++ b/doc/tofi.1.scd @@ -45,11 +45,11 @@ All config file options described in *tofi*(5) are also accepted, in the form # KEYS -<Up> | <Left> +<Up> | <Left> | <Ctrl>-k Move the selection back one entry. -<Down> | <Right> | <Tab> - Move the selection back forward entry. +<Down> | <Right> | <Ctrl>-j | <Tab> + Move the selection forward one entry. <Enter> Confirm the current selection and quit. @@ -205,12 +205,26 @@ static void wl_keyboard_key( return; } - if (sym == XKB_KEY_Up || sym == XKB_KEY_Left) { + if (sym == XKB_KEY_Up || sym == XKB_KEY_Left + || (sym == XKB_KEY_k + && xkb_state_mod_name_is_active( + tofi->xkb_state, + XKB_MOD_NAME_CTRL, + XKB_STATE_MODS_EFFECTIVE) + ) + ) { uint32_t nsel = MAX(MIN(tofi->window.entry.num_results, tofi->window.entry.results.count), 1); tofi->window.entry.selection += nsel; tofi->window.entry.selection--; tofi->window.entry.selection %= nsel; - } else if (sym == XKB_KEY_Down || sym == XKB_KEY_Right || sym == XKB_KEY_Tab) { + } else if (sym == XKB_KEY_Down || sym == XKB_KEY_Right || sym == XKB_KEY_Tab + || (sym == XKB_KEY_j + && xkb_state_mod_name_is_active( + tofi->xkb_state, + XKB_MOD_NAME_CTRL, + XKB_STATE_MODS_EFFECTIVE) + ) + ) { uint32_t nsel = MAX(MIN(tofi->window.entry.num_results, tofi->window.entry.results.count), 1); tofi->window.entry.selection++; tofi->window.entry.selection %= nsel; |