A simple action to remap key presses sent to programs running in kitty

This commit is contained in:
Kovid Goyal
2023-12-03 13:08:53 +05:30
parent f1fc2126bc
commit 74388b4183
5 changed files with 49 additions and 24 deletions

View File

@@ -48,6 +48,9 @@ Detailed list of changes
- A new option :opt:`notify_on_cmd_finish` to show a desktop notification when a long running command finishes (:pull:`6817`)
- A new action :ac:`send_key` to simplify mapping key presses to other keys without needing :ac:`send_text`
0.31.0 [2023-11-08]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -389,20 +389,14 @@ How do I map key presses in kitty to different keys in the terminal program?
This is accomplished by using ``map`` with :sc:`send_text <send_text>` in :file:`kitty.conf`.
For example::
map alt+s send_text normal,application \x13
map alt+s send_key ctrl+s
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 ``show_key`` kitten. Run::
This causes the program running in kitty to receive the :kbd:`ctrl+s` key when
you press the :kbd:`alt+s` key. To see this in action, run::
kitten show_key
kitten show-key -m kitty
Then press the key you want to emulate. Note that this kitten will only show
keys that actually reach the terminal program, in particular, keys mapped to
actions in kitty will not be shown. To check those first map them to
:ac:`no_op`. You can also start a kitty instance without any shortcuts to
interfere::
kitty -o clear_all_shortcuts=yes kitten show_key
Which will print out what key events it receives.
How do I open a new window or tab with the same working directory as the current window?

View File

@@ -215,23 +215,16 @@ also simulate pressing the enter key which is ``\r``. For example::
Now, if you press :kbd:`f1` when at shell prompt it will run the ``echo Hello,
world!`` command.
To have one key press send another key press::
To have one key press send another key press, use :ac:`send_key`::
map alt+s send_text normal,application \x13
map alt+s send_key ctrl+s
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 ``show_key`` kitten. Run::
This causes the program running in kitty to receive the :kbd:`ctrl+s` key when
you press the :kbd:`alt+s` key. To see this in action, run::
kitten show_key
kitten show-key -m kitty
Then press the key you want to emulate. Note that this kitten will only show
keys that actually reach the terminal program, in particular, keys mapped to
actions in kitty will not be shown. To check those first unmap them.
You can also start a kitty instance without any shortcuts to interfere:
.. code-block:: sh
kitty -o clear_all_shortcuts=yes kitten show_key
Which will print out what key events it receives.
All mappable actions
------------------------