How to bind (double-)tapping the Shift-Key in tmux

keyboard shortcutsterminaltmuxx11

I would like to bind the tmux find-window prompt to pressing and releasing Shift twice.

I have already tried

bind-key -n S-S command-prompt "find-window -N '%%'"

This results in no error message, checked with :show-messages, but does not trigger the action when double-tapping Shift.

Best Answer

You can use under to configure Shift to emit e.g. Alt+Ctrl+Shift+F12 when tapped and released. Then you would declare that as a secondary tmux escape key, and assign a Key-binding to "Alt+Ctrl+Shift+F12" for command-prompt "find-window -N '%%'"

The exact sequence of commands:

At shell prompt:

$ xcape -e 'Shift_L=Alt_L|Control_R|Shift_L|F12'

At tmux prompt:

:set-option prefix2 "M-C-S-F12"
:bind M-C-S-F12 command-prompt "find-window -N '%%'"

Now double-tap Shift_L, and on the bottom left of your tmuxyou will see (find-window).

With Shift_R=Alt_L|Control_R|Shift_L|F11 you can use Shift_L for inner tmux, and Shift_R for outer tmux, if you nest them.

Note: I had previously posted this answer with F15, but that did not work as expected , because @Gilles says: F13 - F20 need to be declared in terminfo.

Related Question