Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaclu/tmux-keybtest
Check what keys tmux can detect from the terminal being used.
https://github.com/jaclu/tmux-keybtest
tmux tmux-conf tmux-config tmux-keyboard
Last synced: about 2 months ago
JSON representation
Check what keys tmux can detect from the terminal being used.
- Host: GitHub
- URL: https://github.com/jaclu/tmux-keybtest
- Owner: jaclu
- License: mit
- Created: 2024-06-05T19:28:37.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-13T15:20:39.000Z (2 months ago)
- Last Synced: 2024-07-13T16:38:52.728Z (2 months ago)
- Topics: tmux, tmux-conf, tmux-config, tmux-keyboard
- Language: Shell
- Homepage:
- Size: 48.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-tmux - tmux-keybtest
README
# tmux-keybtest
Check what keys tmux can detect from the terminal being used.
When a key is pressed and it was identified, its tmux name is displayed
on the status line, like `C-M-Up`Terminals often have some issues, for some keys they might generate the
wrong thing, or even nothing. Using this can give help to select the
right terminal, or if one is already selected, it can show what keys
are available to use. Some terminals offer good suport in defining what
sequence can be sent when pressing a key,
this is unfortunately not always the case.If the Operating System or terminal binds some keys, they will not be
detected by tmux.
Sometims it is possible to disable such usages of a key that would make
more sense to handle by tmux.I have only defined the letters a-z and the Swedish umlauts,
contributions for other characters would be apreciated!## Usage
Clone this, then run `keybtest.sh`
This will start a tmux session that will display the tmux notation for
any key pressed that tmux could recognize. Be aware that some keys might
not send the intended sequence, so tmux will interperate it as something
else!The tmux key name prefixes are:
- `S-` Shift was pressed together with the key
- `C-` Control was pressed together with the key
- `M-` Alt was pressed together with the keyUse the names displayed here in your tmux.conf to bind that key to a desired
action matching the current terminals capabilities.It might be obvious, but this should not be run this inside another tmux
session, since that would typically bind some keys.The exit sequence `C-x` `C-x` is displayed in the status line, so usage
should be self-explainatory, without any need to memorize the exit sequence.## Keys not tested
### Shift S-
- The shifted regular keys are not tested, instead of binding `S-a` or
`S-A` use `A`### Control C-
- cant be bound: `~ $ % & * { } | "`
- Case is ignored, binding `C-A` after `C-a` will drop the `C-a` bind,
thus only binding lowercase here. Case is also ignored for key presses,
so if binding `C-a` pressing ctrl+A will trigger that action and
vice-versa.
- Skipped to avoid collision
- `C-i` is the same as `Tab`
- `C-m` is the same as `Enter`
- `C-[` is the same as `Escape`### Control Shift C-S-
- Regular keys Not tested, same as with `S-`
### Meta Shift M-S-
- Regular keys Not tested, same as with `S-`
### Control Meta C-M-
- cant be bound: `~ $ % & * { } | "`
- Case is ignored, binding `C-M-A` after `C-M-a` will drop the `C-M-a` bind,
thus only binding lowercase here. Case is also ignored for key presses,
so if binding `C-M-a` pressing ctrl+alt+A will trigger that action and
vice-versa.- Skipped to avoid collision
- `C-M-i` is the same as `C-M-tab`
- `C-M-m` is the same as `C-M-Enter`
- `C-M-[` is the same as `C-M-Escape`### Control Meta Shift C-M-S-
- cant be bound: `~ $ % & * { } | "`
- Since this is using shift, no lower case keys are bound here## Other things
In the tmux universe the key for Insert is called `IC` and Delete is
called `DC` so if those are spotted, the terminal is doing the right thing!If a key generates an unrecognized code, there is a high likelyhood that the
terminal will beep, so if in a public spot, muting the sound might come
in handy before running this.Unrecognized keys will be printed.
If time allows, please submit such output in an issue, and I will add it!
I will only need the character/character sequence displayed for a given key,
ideally also what keyboard type generated it, but that is optional.## If terminal cant be made to send the correct sequence
If what is generated is understood by tmux, but not what was intended,
like if `S-F3` is generated by Alt+Up and `S-F3` wont be used.
Just bind the action intended for Alt+Up to `S-F3` - problem solved!If it is not possible to alter what the terminal generates,
but a key does generate something unique that tmux doesnt recognize,
that sequence can be bound to the desired action by using user-keys.Tmux is picky about notation for defining user-keys.
Remember to use octals prefixed by `\\` and always give three digits,
so if the octal is 73 give it as `\\073`Octals are normally in the middle column when using `showkeys -a`
It might be somewhat confusing, when defining a user-key an index is used,
but when binding it, the index is used as a suffix to `User`.
See this sample:```tmux
set -s user-keys[101] "\\342\\201\\204"
bind -n User101 send-keys F1
```## What does the terminal generate for a given key
To check what sequence a key generates by the terminal, here are some
suggestions, should be run outside tmux, since it might capture keys.- showkeys -a
- xxd