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

How to get control over control+shift+plus keychord? #1224

Closed
ersv opened this issue Dec 11, 2018 · 7 comments
Closed

How to get control over control+shift+plus keychord? #1224

ersv opened this issue Dec 11, 2018 · 7 comments

Comments

@ersv
Copy link

ersv commented Dec 11, 2018

I try to change the keybinding for increase font size to control+shift++
I have tried:
map control+shift++ change_font_size all +2.0
map control+shift+plus change_font_size all +2.0
map control+shift+0x2b change_font_size all +2.0

But all fail.
From --debug-keyboard:

Press scancode: 0x14 clean_sym: plus composed_sym: question mods: ctrl+shift glfw_fallback_key: 45 (MINUS) xkb_key: 45 (minus)
Keypress matched action: change_font_size

It seems that kitty inserts automatically glif_fallback_key: 45 (minus) and then the default key-chord

map kitty_mod+minus change_font_size all -2.0

kicks in, decreasing the font size instead of increasing it.

If I instead use
map control+shift+0 change_font_size all +2.0
it works.

How can I make kitty use control+shift+plus to increase the font size?

@fanktom
Copy link

fanktom commented Dec 11, 2018

I can second that I am not able to use the plus key.

@kovidgoyal
Copy link
Owner

If your minus and plus keys are shifted versions of each other in your keyboard layout, then you need to set one as ctrl++ and the other as ctrl+shift+-

@ersv
Copy link
Author

ersv commented Dec 11, 2018

There is something weird going on. Pressing '+' and '-' on my keyboard correctly is reported in kitty as '+' and '-'. Pressing shift++ correctly is reported as '?' which is the shifted key on my keyboard. Also, pressing shift+- is correctly reported as '_` which is the shifted key on my keyboard.

However, pressing control+shift++ I get:
Press scancode: 0x14 clean_sym: plus composed_sym: question mods: ctrl+shift glfw_fallback_key: 45 (MINUS) xkb_key: 45 (minus)
Keypress matched action: change_font_size
It inserts 'fallback_key' MINUS

When I press control-shift-- I get:
Press scancode: 0x3d clean_sym: minus composed_sym: underscore mods: ctrl+shift glfw_key: 45 (MINUS) xkb_key: 45 (minus)
Keypress matched action: change_font_size

As it should.

So, in my understanding, they are not shifted. control-shift-+ somehow just inserts control-shift-- for some reason.

Any ideas?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Dec 11, 2018

this is because glfw has no plus key. See http://www.glfw.org/docs/latest/group__keys.html

so it is not possible to handle a shortcut such as ctrl+shift++ in glfw. I'm afraid you are out of luck there.

EDIT: accidentally wrote question instead of plus originally, now corrected.

@kovidgoyal
Copy link
Owner

sorry mis-spoke should have said plus not question

@ersv
Copy link
Author

ersv commented Dec 11, 2018

Thank you for all your responses.
Hope I don't wear you out, just trying to understand the workings of kitty here.

What I don't get is that when pressing '+', it is echoed back in kitty, so looks like it handles '+' somehow.
Also, I am on linux (ubuntu) and I saw in your manual that in that case I should be able to use XKB key names. In this case there is such a name: 'plus'.

Though, trying
map ctrl+shift+plus change_font_size all +2.0
does not work. Shouldn't it? (Instead it somehow gets replaced with ctrl+shift+- which decreases font size.)

@kovidgoyal
Copy link
Owner

  • alone or (shift++) will work because they produce text. So they dont
    get mapped to key presses anyway. ctrl+shift++ does not produce text.
    Look at the text field in the debug output.

Sadly, in your particular case, the native key mapping wont work, this
is because it has lower priority than glfw key matching. If glfw key
matching succeeds (which it does in this case, albeit to the wrong key,
via the fallback mechanism) then it will always be used in preference.

If you really want to fix this, the way to do it is to add a plus key to
glfw GLFW_KEY_PLUS and adjust the mapping functions in xkb_glfw.c to use
it.

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