Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Control mappings #1639

Closed
jreybert opened this issue May 24, 2019 · 18 comments
Closed

Issue with Control mappings #1639

jreybert opened this issue May 24, 2019 · 18 comments

Comments

@jreybert
Copy link
Contributor

When I type <Ctrl>-_, it acts like Backspace.

I do not configure any mappings in my configuration files, and I don't find any <Ctrl>-_ mapping in configuration.

Configuration:

I don't know if it related, but I also encounter conflicts between system libraries and the ones installed by kitty. I had to remove libharfbuzz.so.0 installed by kitty from my LD_LIBRARY_PATH, or I was unable to start firefox, or mate-terminal for example:

$ mate-terminal
mate-terminal: symbol lookup error: /lib64/libpangoft2-1.0.so.0: undefined symbol: hb_glib_script_from_script
@kovidgoyal
Copy link
Owner

What keyboard layout is this? And post the output from --debug-keyboard

@kovidgoyal
Copy link
Owner

And dont put the kitty libraries in LD_LIBRARY_PATH, they are meant to be used privately for kitty. They will not work with other software on your system

@jreybert
Copy link
Contributor Author

What keyboard layout is this?

I use azerty layout.

And post the output from --debug-keyboard

In the new terminal, I only type <Ctrl-_>

$ ./bin/kitty  --debug-keyboard
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: none glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x11 clean_sym: underscore composed_sym: underscore mods: ctrl+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
on_key_input: glfw key: 56 native_code: 0x38 action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Release scancode: 0x11 clean_sym: underscore mods: ctrl+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
on_key_input: glfw key: 56 native_code: 0x38 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events

And dont put the kitty libraries in LD_LIBRARY_PATH, they are meant to be used privately for kitty. They will not work with other software on your system

I did not notice the rpath. Thanks.

@kovidgoyal
Copy link
Owner

Can't be pure azerty since it does not have an underscore key as far as I know. Must be some some modified form since the default us-keyborad based one has underscore as shift+hyphen.

You have two possibilities to fix it, either use send_text in kitty.conf with the native_code from the debug output to map it to whatever you need, or if you want it to work automatically, add a GLFW_KEY_UNDERSCORE to the kitty source code. You can see how I added GLFW_KEY_PLUS in the past and do it similarly.

@kovidgoyal
Copy link
Owner

Note that I have not tested the fix.

@jreybert
Copy link
Contributor Author

I've tested it. The good news is that <C-_> does not acts like <Backspace> anymore. The bad news is that vim still does not trigger it.

in vim, if I add the following mapping:

map <C-_> :echomsg "<C-_> triggered"<CR>

With vim in mate-terminal, when I type <C-_>, I get the following message:

^_ triggered

With vim in kitty, I get nothing.

Comments: I tried to map other top row keyboard keys in vim: <C--> and <C-)> for example. These mappings do not work in vim, either within mate or kitty. These top row keys may have some strange behavior.

@kovidgoyal
Copy link
Owner

What does shift+underscore produce on your system?

@kovidgoyal
Copy link
Owner

In vim you will only be able to map keys that have ascii key codes,
underscore is one of those keys, parentheses and hyphens are not.

@jreybert
Copy link
Contributor Author

jreybert commented May 24, 2019

Badly, I encounter another issue, which is more problematic. I can work without <C-_>, because this is a personal mapping. I remapped it on <C-y> and it is OK.

Now, vim has a builtin mapping (to switch between buffers). On azerty keyboard, to type 6, you must type <Shift-minus>. Then, to do <C-6>, you must type <Ctrl-Shift-minus>.

On kitty, it acts like it ignores the Shift key, because when I type <C-S-minus>, it reduces the font (like <C-minus> would do).

Debug:

<C-_>
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x11 clean_sym: underscore composed_sym: underscore mods: ctrl+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
on_key_input: glfw key: 56 native_code: 0x38 action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Release scancode: 0x11 clean_sym: underscore mods: ctrl+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
on_key_input: glfw key: 56 native_code: 0x38 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events

<C-S-_>
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x32 clean_sym: Shift_L composed_sym: Shift_L mods: ctrl+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Press scancode: 0x11 clean_sym: underscore composed_sym: 8 mods: ctrl+shift+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
Keypress matched action: nth_window
on_key_input: glfw key: 56 native_code: 0x38 action: PRESS mods: 0x3 text: '' state: 0 handled as shortcut
Release scancode: 0x11 clean_sym: underscore mods: ctrl+shift+numlock glfw_fallback_key: 56 (8) xkb_key: 56 (8)
on_key_input: glfw key: 56 native_code: 0x38 action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x32 clean_sym: Shift_L mods: ctrl+shift+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events

<C-minus>
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0xf clean_sym: minus composed_sym: minus mods: ctrl+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
on_key_input: glfw key: 45 native_code: 0x2d action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Release scancode: 0xf clean_sym: minus mods: ctrl+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
on_key_input: glfw key: 45 native_code: 0x2d action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x2 text: '' state: 0 ignoring as keyboard mode does not allow release events

<C-S-minus>
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x32 clean_sym: Shift_L composed_sym: Shift_L mods: ctrl+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Press scancode: 0xf clean_sym: minus composed_sym: 6 mods: ctrl+shift+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
Keypress matched action: change_font_size
on_key_input: glfw key: 45 native_code: 0x2d action: PRESS mods: 0x3 text: '' state: 0 handled as shortcut
Release scancode: 0xf clean_sym: minus mods: ctrl+shift+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
on_key_input: glfw key: 45 native_code: 0x2d action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+shift+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x32 clean_sym: Shift_L mods: shift+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: RELEASE mods: 0x1 text: '' state: 0 ignoring as keyboard mode does not allow release events

@kovidgoyal
Copy link
Owner

C-S-minus is the key combination to reduce font size.

@jreybert
Copy link
Contributor Author

Hm, fair enough. For that, I just have to override the reduce font size mapping in a first time. Actually I can't... So my only move would be to change the kitty_mod to something else, like ctrl-super.

It seems that I am not the first one which had this issue (#171). I will try to understand what are the causes and see if I can try anything around here (though, it seems to be a very difficult issue).

@kovidgoyal
Copy link
Owner

by the way see c2fd700

@kovidgoyal
Copy link
Owner

And you should be able to unmap it in kitty.conf with

ctrl+shift+- noop

@jreybert
Copy link
Contributor Author

I still have issue with key mappings. I am using c2fd700 version.

  • <Alt-.> in bash does not work (with azerty, this is <Alt-Shift-;>). This is a standard bash mapping to get the last parameter in history.
  • <C-6> (<C-S-minus> with azerty) in vim still doesn't work, even with ctrl+shift+- noop config.
  • <C-_>` still doesn't work
<Alt-Shit-;>
Press scancode: 0x40 clean_sym: Alt_L composed_sym: Alt_L mods: numlock glfw_key: 342 (LEFT ALT) xkb_key: 65513 (Alt_L)
on_key_input: glfw key: 342 native_code: 0xffe9 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x32 clean_sym: Shift_L composed_sym: Shift_L mods: alt+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: PRESS mods: 0x4 text: '' state: 0 sent key to child
Press scancode: 0x3b clean_sym: semicolon composed_sym: period mods: alt+shift+numlock glfw_key: 59 (SEMICOLON) xkb_key: 59 (semicolon)
on_key_input: glfw key: 59 native_code: 0x3b action: PRESS mods: 0x5 text: '' state: 0 sent key to child
Release scancode: 0x3b clean_sym: semicolon mods: alt+shift+numlock glfw_key: 59 (SEMICOLON) xkb_key: 59 (semicolon)
on_key_input: glfw key: 59 native_code: 0x3b action: RELEASE mods: 0x5 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x32 clean_sym: Shift_L mods: alt+shift+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: RELEASE mods: 0x5 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x40 clean_sym: Alt_L mods: alt+numlock glfw_key: 342 (LEFT ALT) xkb_key: 65513 (Alt_L)
on_key_input: glfw key: 342 native_code: 0xffe9 action: RELEASE mods: 0x4 text: '' state: 0 ignoring as keyboard mode does not allow release events
<C-Shift-minus>
Release scancode: 0x85 clean_sym: Super_L mods: super+numlock glfw_key: 343 (LEFT SUPER) xkb_key: 65515 (Super_L)
Press scancode: 0x25 clean_sym: Control_L composed_sym: Control_L mods: numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x32 clean_sym: Shift_L composed_sym: Shift_L mods: ctrl+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: PRESS mods: 0x2 text: '' state: 0 sent key to child
Press scancode: 0xf clean_sym: minus composed_sym: 6 mods: ctrl+shift+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
on_key_input: glfw key: 45 native_code: 0x2d action: PRESS mods: 0x3 text: '' state: 0 sent key to child
Release scancode: 0xf clean_sym: minus mods: ctrl+shift+numlock glfw_key: 45 (MINUS) xkb_key: 45 (minus)
on_key_input: glfw key: 45 native_code: 0x2d action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x25 clean_sym: Control_L mods: ctrl+shift+numlock glfw_key: 341 (LEFT CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 341 native_code: 0xffe3 action: RELEASE mods: 0x3 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x32 clean_sym: Shift_L mods: shift+numlock glfw_key: 340 (LEFT SHIFT) xkb_key: 65505 (Shift_L)
on_key_input: glfw key: 340 native_code: 0xffe1 action: RELEASE mods: 0x1 text: '' state: 0 ignoring as keyboard mode does not allow release events

@kovidgoyal
Copy link
Owner

I dont understand what you are saying. According to that log, when you press alt+shift+; the keys kitt receives are alt+shift+; not alt+. so your keyboard layout doesn't appear to be working. If for some reason you want alt+shift+; to send the same bytes as alt+, use send_text for it in kitty.conf, like this:

map alt+shift+; send_text all \x1b\x2e

@jreybert
Copy link
Contributor Author

What I mean is that <Alt-Shift-;> works in other terminals, bash reacts like it receives <Alt-.>.

Bash mapping is <Alt-.>. Since . (dot) is not a direct key on azerty mapping, but accessible through a modifier (Shift + semicolon), it seems reasonable that bash receives <Alt-.> code. I suspect the problem I have in vim with <C-6> is the same.

I wonder how terminals handle this kind of behavior. I understand this can be nightmare to manage this kind of keyboard specific behavior. But this is the first time such standard mapping do not work out of the box.

I will take a look on mate-terminal source code, and try to to understand how they manage this.

@kovidgoyal
Copy link
Owner

@gsker What nonsense. Application private libraries such as those used by the kitty binary build are loaded using rpath. Putting them in LD_LIBRARY_PATH would mean that any application launched from within kitty would also use them, potentially breaking it, just as @jreybert found.

@gsker
Copy link

gsker commented Jul 3, 2019

Truly I am ignorant. I deleted my nonsense comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants