Closed jamessan closed 2 years ago
This is by design. Keys not representable in the traditional terminal encoding are now sent using the new kitty keyboard protocol, even in legacy mode. See discussion in https://github.com/kovidgoyal/kitty/issues/3248
I know this is an old thread, but I wonder if it is possible to disable this behaviour: it is somewhat annoying to see these charactors in the terminal after "PrintScreen" is pressed..
Thanks.
Map it to discard_event in kitty.conf
Map it to discard_event in kitty.conf
Thanks!
Just in case anybody is looking in this thread for a solution, add this to your kitty.conf:
map print_screen discard_event
Doesn't work for me:
$ grep print ~/.config/kitty/kitty.conf
map print_screen discard_event
$ kitty --version
kitty 0.21.2 created by Kovid Goyal
$ kitty --debug-keyboard
[151 10:39:07.514080] Ignoring unknown config key: open_url_modifiers
[151 10:39:07.514189] Ignoring unknown config key: rectangle_select_modifiers
[151 10:39:07.514219] Ignoring unknown config key: terminal_select_modifiers
Loading new XKB keymaps
Modifier indices alt: 0x3 super: 0x6 hyper: 0xffffffff meta: 0xffffffff numlock: 0x4 shift: 0x0 capslock: 0x1
Move mouse_button: -1 mods: none grabbed: 0
Press xkb_keycode: 0x6b clean_sym: Print composed_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: PRESS mods: none text: '' state: 0 sent key to child
Release xkb_keycode: 0x6b clean_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x6b clean_sym: Print composed_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: PRESS mods: none text: '' state: 0 sent key to child
Release xkb_keycode: 0x6b clean_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x85 clean_sym: Super_L composed_sym: Super_L mods: none glfw_key: 57444 (LEFT_SUPER) xkb_key: 65515 (Super_L)
on_key_input: glfw key: 0xe064 native_code: 0xffeb action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
on_key_input: glfw key: 0xe064 native_code: 0xffeb action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
For each press of Print Screen it prints 361u
to the new terminal window.
your version of kitty is too old
With the latest nightly ("Nightly release, generated on: 2022-05-29 21:26:02 UTC from commit: 581c388."), same result :cry:
$ grep print ~/.config/kitty/kitty.conf
map print_screen discard_event
$ ./local/kitty/bin/kitty --version
kitty 0.25.1 created by Kovid Goyal
$ ./local/kitty/bin/kitty --debug-keyboard
[151 15:10:48.583923] Ignoring unknown config key: open_url_modifiers
[151 15:10:48.584279] Ignoring unknown config key: rectangle_select_modifiers
[151 15:10:48.584361] Ignoring unknown config key: terminal_select_modifiers
Loading new XKB keymaps
Modifier indices alt: 0x3 super: 0x6 hyper: 0xffffffff meta: 0xffffffff numlock: 0x4 shift: 0x0 capslock: 0x1
Move x: 751.0 y: 296.0 grabbed: 0
Press xkb_keycode: 0x6b clean_sym: Print composed_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: PRESS mods: none text: '' state: 0 sent encoded key to child
Release xkb_keycode: 0x6b clean_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x6b clean_sym: Print composed_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: PRESS mods: none text: '' state: 0 sent encoded key to child
Release xkb_keycode: 0x6b clean_sym: Print mods: none glfw_key: 57361 (PRINT_SCREEN) xkb_key: 65377 (Print)
on_key_input: glfw key: 0xe011 native_code: 0xff61 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: none glfw_key: 57442 (LEFT_CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 0xe062 native_code: 0xffe3 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x36 clean_sym: c composed_sym: c mods: ctrl glfw_key: 99 (c) xkb_key: 99 (c)
on_key_input: glfw key: 0x63 native_code: 0x63 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child
Release xkb_keycode: 0x36 clean_sym: c mods: ctrl glfw_key: 99 (c) xkb_key: 99 (c)
on_key_input: glfw key: 0x63 native_code: 0x63 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Press xkb_keycode: 0x28 clean_sym: d composed_sym: d mods: ctrl glfw_key: 100 (d) xkb_key: 100 (d)
on_key_input: glfw key: 0x64 native_code: 0x64 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child
Then you arent actually mapping what you think you are mapping.
kitty --config=NONE -o 'map print_screen discard_event'
will work.
This works. It seems to be relevant where in the config file that line is placed. Works now. Thanks for your patience, sorry for the noise!
your version of kitty is too old
For the record, now it works even with: kitty 0.21.2 created by Kovid Goyal
For the record, there are some more events you might want to discard:
map print_screen discard_event
map ctrl+print_screen discard_event
map alt+print_screen discard_event
map super+print_screen discard_event
Describe the bug Press Print Screen key and part (
7361u
) of the escape code (CSI 57361u
) is written to the terminal. How much seems to depend on the shell (zsh -7361u
, bash -361u
, dash - the entire thing), however I wouldn't expect anything by default.Output from
kitty --debug-input
:Environment details
Additional context Try to reproduce the problem with
kitty --config NONE
if you cannot then post a minimal kitty.conf that reproduces the problem. If the problem involves interaction with some other terminal program post a minimal config for that program to reproduce the problem as well.