A new show_key kitten

Fixes #3556
This commit is contained in:
Kovid Goyal
2021-04-29 13:10:20 +05:30
parent 3e00ee4155
commit 28b4fe5cb6
7 changed files with 98 additions and 27 deletions

View File

@@ -4,6 +4,12 @@ Changelog
|kitty| is a feature-rich, cross-platform, *fast*, GPU based terminal.
To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.3 [future]
----------------------
- A new ``show_key`` kitten to easily see the bytes generated by the terminal
for key presses in the various keyboard modes (:pull:`3556`)
0.20.2 [2021-04-28]
----------------------

View File

@@ -229,23 +229,11 @@ For example::
map alt+s send_text all \x13
This maps :kbd:`alt+s` to :kbd:`ctrl+s`. To figure out what bytes to use for
the :sc:`send_text <send_text>` you can use the ``showkey`` utility. Run::
the :sc:`send_text <send_text>` you can use the ``show_key`` kitten. Run::
showkey -a
kitty +kitten show_key
Then press the key you want to emulate. On macOS, this utility is currently not
available. The manual way to figure it out is:
1. Look up your key's decimal value in the table at the bottom of `this
page <http://ascii-table.com/ansi-escape-sequences.php>`_ or any
ANSI escape sequence table. There are different modifiers for :kbd:`ctrl`,
:kbd:`alt`, etc. For e.g., for :kbd:`ctrl+s`, find the ``S`` row and look at
the third column value, ``19``.
2. Convert the decimal value to hex with ``kitty +runpy "print(hex(19))"``.
This shows the hex value, ``13`` in this case.
3. Use ``\x(hexval)`` in your ``send_text`` command in kitty. So in this example, ``\x13``
Then press the key you want to emulate.
How do I open a new window or tab with the same working directory as the current window?
--------------------------------------------------------------------------------------------

View File

@@ -28,7 +28,7 @@ issues in that proposal, listed at the :ref:`bottom of this document
You can see this protocol with all enhancements in action by running::
kitty +kitten key_demo
kitty +kitten show_key -m kitty
inside the kitty terminal to report key events.