3

Among many other modifications I remapped my Caps Lock to Hyper, an ancient modifier key from the Space-cadet keyboards.

However I can not find an example how to use it for key-bindings in Tmux, which has Emacs-like key-binding definitions, for example C-k defines Ctrl-k in both of them, so I tried H-kwhich works perfectly in Emacs, but as it turned out, not in Tmux.

The exact binding definition from my .tmux.conf

bind-key -T copy-mode H-k send-keys -X -N 30 scroll-down

Results in the following error:

/home/attila/.tmux.conf:21: unknown key: H-k

I know there is a trick to mimic the Hyper key as a simultaneous press of all other modifier keys, however I use xcape, so this is not an option.

atevm
  • 287

2 Answers2

10

Your terminal does not support the "hyper" modifier, let alone tmux.

tmux is a TUI application. It only knows what terminals send to it. Terminals, in the POSIX General Terminal Interface paradigm, only send characters; ordinary characters, control characters, escape sequences, and control sequences. There is no concept of raw keystrokes and separately transmitted modifier key information. tmux, like other TUI applications, has no dealing in any such concepts.

Some of the control sequences transmitted by terminals and terminal emulators in response to function keys and extended keys can include parameters specifying an instantaneous modifier state. But the DEC VT convention that they generally follow has only ⇧ Level 2 Shift, ⎇ Alt, and ⎈ Control. It does not have a concept of a "hyper" modifier, DEC terminals having no such key. Nor does it even have the concept in the first place of such special control sequences for alphanumeric keys; only for (some) keys on the calculator, editing, cursor, and function keypads.

Further reading

JdeBP
  • 68,745
  • I should have checked that first, thank you. It is always amazing to see how far back you must go in time to find the basis of some Unix concept. – atevm May 27 '18 at 23:35
5

No. man tmux lists the recognised keys:

KEY BINDINGS tmux allows a command to be bound to most keys, with or without a prefix key.

When specifying keys, most represent themselves (for example ‘A’ to
‘Z’). Ctrl keys may be prefixed with ‘C-’ or ‘^’, and Alt (meta) with ‘M-’. In addition, the following special key names are accepted: Up, Down,
Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F12, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab.

You can also read the list of accepted keys in the source.

jasonwryan
  • 73,126