It's only alt and alt+shift that dont work in global menubar

alt in combination with ctrl/cmd works fine.
This commit is contained in:
Kovid Goyal
2021-04-22 10:50:43 +05:30
parent b6c1e1a609
commit 36da65120a

View File

@@ -21,9 +21,9 @@ from .constants import (
is_wayland, kitty_exe, logo_png_file, running_in_kitty is_wayland, kitty_exe, logo_png_file, running_in_kitty
) )
from .fast_data_types import ( from .fast_data_types import (
GLFW_IBEAM_CURSOR, GLFW_MOD_ALT, create_os_window, free_font_data, GLFW_IBEAM_CURSOR, GLFW_MOD_ALT, GLFW_MOD_SHIFT, create_os_window,
glfw_init, glfw_terminate, load_png_data, set_custom_cursor, free_font_data, glfw_init, glfw_terminate, load_png_data,
set_default_window_icon, set_options set_custom_cursor, set_default_window_icon, set_options
) )
from .fonts.box_drawing import set_scale from .fonts.box_drawing import set_scale
from .fonts.render import set_font_family from .fonts.render import set_font_family
@@ -112,11 +112,12 @@ def get_macos_shortcut_for(opts: OptionsStub, function: str = 'new_os_window') -
candidates.append(k) candidates.append(k)
if candidates: if candidates:
from .fast_data_types import cocoa_set_global_shortcut from .fast_data_types import cocoa_set_global_shortcut
alt_mods = GLFW_MOD_ALT, GLFW_MOD_ALT | GLFW_MOD_SHIFT
# Reverse list so that later defined keyboard shortcuts take priority over earlier defined ones # Reverse list so that later defined keyboard shortcuts take priority over earlier defined ones
for candidate in reversed(candidates): for candidate in reversed(candidates):
if candidate.mods & GLFW_MOD_ALT: if candidate.mods in alt_mods:
# Option based shortcuts dont work in the global menubar, see # Option based shortcuts dont work in the global menubar,
# presumably because Apple reserves them for IME, see
# https://github.com/kovidgoyal/kitty/issues/3515 # https://github.com/kovidgoyal/kitty/issues/3515
continue continue
if cocoa_set_global_shortcut(function, candidate[0], candidate[2]): if cocoa_set_global_shortcut(function, candidate[0], candidate[2]):