diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 7c7c025e8..620a85d8c 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1009,6 +1009,7 @@ process_global_state(void *data) { if (cocoa_pending_actions & NEW_WINDOW) { call_boss(new_window, NULL); } if (cocoa_pending_actions & CLOSE_WINDOW) { call_boss(close_window, NULL); } if (cocoa_pending_actions & RESET_TERMINAL) { call_boss(clear_terminal, "sO", "reset", Py_True ); } + if (cocoa_pending_actions & RELOAD_CONFIG) { call_boss(load_config_file, NULL); } if (cocoa_pending_actions_data.wd) { if (cocoa_pending_actions & NEW_OS_WINDOW_WITH_WD) { call_boss(new_os_window_with_wd, "s", cocoa_pending_actions_data.wd); } if (cocoa_pending_actions & NEW_TAB_WITH_WD) { call_boss(new_tab_with_wd, "s", cocoa_pending_actions_data.wd); } diff --git a/kitty/cocoa_window.m b/kitty/cocoa_window.m index 646385df9..b65fd2041 100644 --- a/kitty/cocoa_window.m +++ b/kitty/cocoa_window.m @@ -91,6 +91,7 @@ PENDING(previous_tab, PREVIOUS_TAB) PENDING(new_window, NEW_WINDOW) PENDING(close_window, CLOSE_WINDOW) PENDING(reset_terminal, RESET_TERMINAL) +PENDING(reload_config, RELOAD_CONFIG) - (void)open_kitty_website_url:(id)sender { (void)sender; @@ -117,7 +118,7 @@ typedef struct { NSEventModifierFlags mods; } GlobalShortcut; typedef struct { - GlobalShortcut new_os_window, close_os_window, close_tab, edit_config_file; + GlobalShortcut new_os_window, close_os_window, close_tab, edit_config_file, reload_config; GlobalShortcut previous_tab, next_tab, new_tab, new_window, close_window, reset_terminal; } GlobalShortcuts; static GlobalShortcuts global_shortcuts; @@ -132,7 +133,7 @@ cocoa_set_global_shortcut(PyObject *self UNUSED, PyObject *args) { #define Q(x) if (strcmp(name, #x) == 0) gs = &global_shortcuts.x Q(new_os_window); else Q(close_os_window); else Q(close_tab); else Q(edit_config_file); else Q(new_tab); else Q(next_tab); else Q(previous_tab); - else Q(new_window); else Q(close_window); else Q(reset_terminal); + else Q(new_window); else Q(close_window); else Q(reset_terminal); else Q(reload_config); #undef Q if (gs == NULL) { PyErr_SetString(PyExc_KeyError, "Unknown shortcut name"); return NULL; } int cocoa_mods; @@ -380,6 +381,7 @@ cocoa_create_global_menu(void) { keyEquivalent:@""]; [appMenu addItem:[NSMenuItem separatorItem]]; MENU_ITEM(appMenu, @"Preferences…", edit_config_file); + MENU_ITEM(appMenu, @"Reload preferences", reload_config); [appMenu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", app_name] action:@selector(hide:) diff --git a/kitty/main.py b/kitty/main.py index c8151a8a1..3a7ce90f7 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -143,6 +143,9 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ()) val = get_macos_shortcut_for(opts, 'clear_terminal', args=('reset', True), lookup_name='reset_terminal') if val is not None: global_shortcuts['reset_terminal'] = val + val = get_macos_shortcut_for(opts, 'load_config_file', args=(), lookup_name='reload_config') + if val is not None: + global_shortcuts['reload_config'] = val if is_macos and opts.macos_custom_beam_cursor: set_custom_ibeam_cursor() if not is_wayland() and not is_macos: # no window icons on wayland diff --git a/kitty/state.h b/kitty/state.h index 7e83aa38d..700d18985 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -278,6 +278,7 @@ typedef enum { NEW_WINDOW = 2048, CLOSE_WINDOW = 4096, RESET_TERMINAL = 8192, + RELOAD_CONFIG = 16384, } CocoaPendingAction; void set_cocoa_pending_action(CocoaPendingAction action, const char*); #endif