Skip to Content

hty keys

hty send --key accepts symbolic key names instead of raw bytes, making scripts easier to read and write. Run hty keys at any time to print the authoritative list of supported key names for the version of hty you have installed.

Reference

Supported send_key names

Navigation:
  up, down, left, right, home, end, pageup, pagedown, insert, delete

Editing and control:
  enter, return, tab, esc, escape, space, backspace

Function keys:
  f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12

Modifier prefixes (combinable, any order):
  ctrl- (or c-)        Ctrl modifier
  alt- (or meta-, m-)  Alt/Meta modifier
  shift- (or s-)       Shift modifier

Single printable characters are also accepted directly:
  "i", ":", "/", "q"

Examples:
  ctrl-x            Ctrl+X
  c-a               Ctrl+A (short form)
  alt-f             Alt+F (Meta+F in emacs)
  shift-tab         Backtab
  shift-up          Shift+Up arrow
  ctrl-alt-f        Ctrl+Alt+F
  ctrl-shift-end    Ctrl+Shift+End
  f5                Function key F5
  alt-f3            Alt+F3

Using —key

Pass any supported key name to hty send --key. Names are case-insensitive.

hty send my-session --key esc hty send my-session --key enter hty send my-session --key ctrl-c hty send my-session --key up hty send my-session --key pagedown hty send my-session --key f5

For keys not in the list above, use hty send --bytes-hex with the raw escape sequence. For example, to send a literal ESC followed by [ you can run: hty send my-session --bytes-hex 1b5b.

Last updated on