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

macos_option_as_alt is not honored when CAPS_LOCK is ON #7836

Closed
vkz opened this issue Sep 8, 2024 · 0 comments
Closed

macos_option_as_alt is not honored when CAPS_LOCK is ON #7836

vkz opened this issue Sep 8, 2024 · 0 comments
Labels

Comments

@vkz
Copy link

vkz commented Sep 8, 2024

Describe the bug
kitty.conf has macos_option_as_alt left to ensure Opt+b et al behave like Alt+b et al on Mac OS. And they do work as expected unless CAPS_LOCK is on. In which case they behave as if the setting is macos_option_as_alt no i.e. you get diacritics as output.

To confirm I'm not expecting anything out of the ordinary here, I tried in iTerm 2 and it behaved as I would've expected, so I'm guessing it is a bug with how kitty handles CAPS_LOCK mod.

To Reproduce
Steps to reproduce the behavior:

  1. macos_option_as_alt left on OSX in your kitty.conf
  2. try Opt+b or Opt+f and confirm they move cursor by word back and forth
  3. toggle CAPS_LOCK to ON
  4. try Opt+b or Opt+f and see diacritic chars printed out to terminal

To confirm that is indeed what's happening here's the output of kitty --debug-keyboard that captures both cases with CAPS_LOCK on and off and the output does appear to confirm the claim above. Compare and contrast:

kitty --debug-keyboard without CAPS_LOCK

-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(451.203,684.398) time=1017786.9 flags=0x80120 win=0x121294cc0 winNum=322576 ctxt=0x0 keyCode=58
flagsChanged: modifier: alt native_key: 0x3a (<noname>) glfw_key: 0xe063 mods: alt 
[132.663] on_key_input: glfw key: 0xe063 native_code: 0x3a action: PRESS mods: alt text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(451.203,684.398) time=1017798.0 flags=0x80120 win=0x121294cc0 winNum=322576 ctxt=0x0 chars="b" unmodchars="b" repeat=0 keyCode=45
Press: native_key: 0x2d (b) glfw_key: 0x62 mods: alt char_count: 1 deadKeyState: 0 repeat: 0 text: <none> glfw_key: b marked_text: ()
[143.780] on_key_input: glfw key: 0x62 native_code: 0x2d action: PRESS mods: alt text: '' state: 0 sent encoded key to child: ^[ b 

kitty --debug-keybeard with CAPS_LOCK

-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(40.0938,881.328) time=1018389.5 flags=0x10100 win=0x140f67fc0 winNum=322703 ctxt=0x0 keyCode=57
flagsChanged: modifier: capslock native_key: 0x39 (<noname>) glfw_key: 0xe00e mods: capslock 
[16.808] on_key_input: glfw key: 0xe00e native_code: 0x39 action: PRESS mods: capslock text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(40.0938,881.328) time=1018393.3 flags=0x90120 win=0x140f67fc0 winNum=322703 ctxt=0x0 keyCode=58
flagsChanged: modifier: alt native_key: 0x3a (<noname>) glfw_key: 0xe063 mods: alt+capslock 
[20.674] on_key_input: glfw key: 0xe063 native_code: 0x3a action: PRESS mods: alt+capslock text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(40.0938,881.328) time=1018393.3 flags=0x90120 win=0x140f67fc0 winNum=322703 ctxt=0x0 chars="ı" unmodchars="b" repeat=0 keyCode=45
Press: native_key: 0x2d (b) glfw_key: 0x62 mods: alt+capslock char_count: 1 deadKeyState: 0 repeat: 0 
	insertText: ı replacementRange: (9223372036854775807, 0)
text: 0xc4 0xb1 glfw_key: b marked_text: ()
[20.704] on_key_input: glfw key: 0x62 native_code: 0x2d action: PRESS mods: alt+capslock text: 'ı' state: 0 sent key as text to child:  ı

Environment details

kitty 0.34.1 (7f61f1f9f3) created by Kovid Goyal
Darwin  23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 arm64
ProductName:		macOS ProductVersion:		14.6.1 BuildVersion:		23G93
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /Users/user/.config/kitty/kitty.conf

Config options different from defaults:
bold_font            Source Code Pro Medium
bold_italic_font     Source Code Pro Medium Italic
clipboard_max_size   0
enable_audio_bell    False
font_family          Source Code Pro Light
font_size            12.0
italic_font          Source Code Pro Light Italic
macos_option_as_alt  2
tab_title_template   {fmt.bold}{sup.index}{fmt.nobold}{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}
visual_bell_duration 0.1
Added shortcuts:
	ctrl+m →  send_key ctrl+@
Removed shortcuts:
	cmd+, →  edit_config_file
	cmd+enter →  new_window
	cmd+h →  hide_macos_app
	cmd+k →  clear_terminal to_cursor active
	cmd+m →  minimize_macos_window
	cmd+n →  new_os_window
	cmd+q →  quit
	cmd+t →  new_tab
	cmd+w →  close_tab
	ctrl+cmd+, →  load_config_file
	ctrl+cmd+f →  toggle_fullscreen
	opt+cmd+h →  hide_macos_other_apps
	opt+cmd+r →  clear_terminal reset active
	opt+cmd+s →  toggle_macos_secure_keyboard_entry
	shift+cmd+/ →  open_url https://sw.kovidgoyal.net/kitty/
	shift+cmd+[ →  previous_tab
	shift+cmd+] →  next_tab
	shift+cmd+d →  close_window
	shift+cmd+w →  close_os_window
Changed shortcuts:
	kitty_mod+1 →  goto_tab 1
	kitty_mod+2 →  goto_tab 2
	kitty_mod+3 →  goto_tab 3
	kitty_mod+4 →  goto_tab 4
	kitty_mod+5 →  goto_tab 5
	kitty_mod+6 →  goto_tab 6
	kitty_mod+7 →  goto_tab 7
	kitty_mod+8 →  goto_tab 8
	kitty_mod+9 →  goto_tab 9

Important environment variables seen by the kitty process:
	PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
	LANG                                en_GB.UTF-8
	SHELL                               /bin/zsh
	USER                                user

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.

@vkz vkz added the bug label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant