I'm using X11 and a Norwegian keyboard layout (setxkbmap no).
When pressing ctrl-shift-+, the font size is decreased and when pressing ctrl-shift--, nothing happens.
Steps to reproduce the issue:
setxkbmap nokitty.ctrl-shift-- and ctrl-shift-+ on a Norwegian keyboard layout.
.
Pressing ctrl-shift-麓 increases font size on my Norwegian keyboard.
The documentation says ctrl-shift-minus and ctrl-shift-equals, though, not ctrl-shift-backtick and ctrl-shift-plus. If only US English keyboard layouts are supported, the documentation should state that.
https://sw.kovidgoyal.net/kitty/#other-keyboard-shortcuts
There is no way to define shortcuts that work across all keyboard layouts. You simply need to use the --debug-keyboard flag to kitty and adjust a few shortcuts that dont work for your layout in kitty.conf
gnome-terminal and konsole both manage to handle the Norwegian keyboard layout.
yes, and I can come up with ten keyboard layouts they dont handle. But let me amend my previous statemement. I dont know of any way to define keyboard shortcuts that work across all keyboard layouts. If you do, patches are most welcome.
Should be possible by using keyboard scancodes instead of keycodes. Will look into it and submit a patch if I figure out something.
I still think it's a valid issue, though.
Sure if you can figure out a way to do it, I will be happy to change my mind on the validity of the issue. But given that as far as I know there is no way to do it robustly across all keyboard layouts, the issue will remain closed.
It is possible to acknowledge that something is an issue without having the solution ready.
It is simply impossible to define a shortcut that works across all layouts. Say I have a keyboard layout that has a key named alpha (as in the greek letter alpha). Any shortcut involving that key will be impossible to implement in a keyboard layout that does not have that key. That's a simple fact. That you dont like it, does not change it. While this is a contrived example, it is the same fundamental principle.
Therefore having shortcuts that dont work across all keyboard layouts is not a bug, since that goal is not attainable.
The norwegian keyboard has both + and -, it's just in a different place than the us keyboard.
yes but in the US keyboard you have to press shift to access them, in the norwegian one you do not, which is why the shortcuts dont work.
I tried to make the keyboard mapping ( which is used in many mac apps ):
map cmd+plus change_font_size all +2.0
to no effect. If i also map
map cmd+minus change_font_size all +2.0
both mappings decreases the font. Is plus a valid key?
Not in glfw, it isn't. See http://www.glfw.org/docs/latest/group__keys.html
However, I just recently added the ability to map shortcuts by raw key codes, for precisely this reason. https://sw.kovidgoyal.net/kitty/conf.html#keyboard-shortcuts
you can use that to define the shortcut, as described in the link. The sad part is there is no portable way to define such shortcuts across all keyboard layouts, that I know of.
This is the output for cmd-plus
~ $ kitty --debug-keyboard
on_key_input: glfw key: 343 native_code: 0x37 action: PRESS mods: 0x8 text: '' state: 0 sent key to child 2018-09-10 11:40:40.768 kitty[5491:1451319] char_count: 1 cocoa text: <none>
2018-09-10 11:40:40.768 kitty[5491:1451319] scancode: 0x1b (+) mods: super text: <none> glfw_key: MINUS
on_key_input: glfw key: 45 native_code: 0x1b action: PRESS mods: 0x8 text: '' state: 0 handled as shortcut
on_key_input: glfw key: 45 native_code: 0x1b action: RELEASE mods: 0x8 text: '' state: 0 ignoring as keyboard mode does not allow release events
on_key_input: glfw key: 343 native_code: 0x37 action: RELEASE mods: 0x0 text: '' state: 0 ignoring as keyboard mode does not allow release events
And this is for cmd-minus.
2018-09-10 11:42:05.704 kitty[5491:1451319] char_count: 1 cocoa text: <none>
2018-09-10 11:42:05.704 kitty[5491:1451319] scancode: 0x2c (-) mods: super text: <none> glfw_key: MINUS
on_key_input: glfw key: 45 native_code: 0x2c action: PRESS mods: 0x8 text: '' state: 0 handled as shortcut
on_key_input: glfw key: 45 native_code: 0x2c action: RELEASE mods: 0x8 text: '' state: 0 ignoring as keyboard mode does not allow release events
on_key_input: glfw key: 343 native_code: 0x37 action: RELEASE mods: 0x0 text: '' state: 0 ignoring as keyboard mode does not allow release events
It is kind of odd that glfw_key is MINUS in both cases.
Anyway it works if i assign the native code as follows:
map cmd+0x1b change_font_size all +2.0
map cmd+0x2c change_font_size all -2.0
Thanks for your help and an awesome terminal editor.
you're welcome :)
Most helpful comment
The norwegian keyboard has both
+and-, it's just in a different place than the us keyboard.