macOS: Add menu items to the Edit menu to clear the screen and scrollback
This commit is contained in:
parent
c6ae4b0a53
commit
cbefc72a7e
7 changed files with 37 additions and 3 deletions
|
|
@ -101,6 +101,8 @@ Detailed list of changes
|
|||
|
||||
- macOS: Allow using the Passwords app to autofill passwords via the Edit->Autofill menu mimicking other macOS applications (:pull:`8195`)
|
||||
|
||||
- macOS: Add menu items to the Edit menu to clear the screen and scrollback
|
||||
|
||||
0.38.1 [2024-12-26]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -1222,6 +1222,8 @@ process_cocoa_pending_actions(void) {
|
|||
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[CLEAR_TERMINAL_AND_SCROLLBACK]) { call_boss(clear_terminal, "sO", "to_cursor", Py_True ); }
|
||||
if (cocoa_pending_actions[CLEAR_SCROLLBACK]) { call_boss(clear_terminal, "sO", "scrollback", Py_True ); }
|
||||
if (cocoa_pending_actions[CLEAR_SCREEN]) { call_boss(clear_terminal, "sO", "to_cursor_scroll", Py_True ); }
|
||||
if (cocoa_pending_actions[RELOAD_CONFIG]) { call_boss(load_config_file, NULL); }
|
||||
if (cocoa_pending_actions[TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY]) { call_boss(toggle_macos_secure_keyboard_entry, NULL); }
|
||||
if (cocoa_pending_actions[TOGGLE_FULLSCREEN]) { call_boss(toggle_fullscreen, NULL); }
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ typedef enum {
|
|||
CLOSE_WINDOW,
|
||||
RESET_TERMINAL,
|
||||
CLEAR_TERMINAL_AND_SCROLLBACK,
|
||||
CLEAR_SCROLLBACK,
|
||||
CLEAR_SCREEN,
|
||||
RELOAD_CONFIG,
|
||||
TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY,
|
||||
TOGGLE_FULLSCREEN,
|
||||
|
|
|
|||
|
|
@ -252,6 +252,8 @@ - (void)user_menu_action:(id)sender {
|
|||
PENDING(close_window, CLOSE_WINDOW)
|
||||
PENDING(reset_terminal, RESET_TERMINAL)
|
||||
PENDING(clear_terminal_and_scrollback, CLEAR_TERMINAL_AND_SCROLLBACK)
|
||||
PENDING(clear_scrollback, CLEAR_SCROLLBACK)
|
||||
PENDING(clear_screen, CLEAR_SCREEN)
|
||||
PENDING(reload_config, RELOAD_CONFIG)
|
||||
PENDING(toggle_macos_secure_keyboard_entry, TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY)
|
||||
PENDING(toggle_fullscreen, TOGGLE_FULLSCREEN)
|
||||
|
|
@ -275,6 +277,8 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item {
|
|||
item.action == @selector(close_window:) ||
|
||||
item.action == @selector(reset_terminal:) ||
|
||||
item.action == @selector(clear_terminal_and_scrollback:) ||
|
||||
item.action == @selector(clear_scrollback:) ||
|
||||
item.action == @selector(clear_screen:) ||
|
||||
item.action == @selector(previous_tab:) ||
|
||||
item.action == @selector(next_tab:) ||
|
||||
item.action == @selector(detach_tab:))
|
||||
|
|
@ -308,7 +312,8 @@ + (GlobalMenuTarget *) shared_instance
|
|||
} GlobalShortcut;
|
||||
typedef struct {
|
||||
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, clear_terminal_and_scrollback;
|
||||
GlobalShortcut previous_tab, next_tab, new_tab, new_window, close_window, reset_terminal;
|
||||
GlobalShortcut clear_terminal_and_scrollback, clear_screen, clear_scrollback;
|
||||
GlobalShortcut toggle_macos_secure_keyboard_entry, toggle_fullscreen, open_kitty_website;
|
||||
GlobalShortcut hide_macos_app, hide_macos_other_apps, minimize_macos_window, quit;
|
||||
} GlobalShortcuts;
|
||||
|
|
@ -324,7 +329,8 @@ + (GlobalMenuTarget *) shared_instance
|
|||
#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(clear_terminal_and_scrollback); else Q(reload_config);
|
||||
else Q(new_window); else Q(close_window); else Q(reset_terminal);
|
||||
else Q(clear_terminal_and_scrollback); else Q(clear_scrollback); else Q(clear_screen); else Q(reload_config);
|
||||
else Q(toggle_macos_secure_keyboard_entry); else Q(toggle_fullscreen); else Q(open_kitty_website);
|
||||
else Q(hide_macos_app); else Q(hide_macos_other_apps); else Q(minimize_macos_window); else Q(quit);
|
||||
#undef Q
|
||||
|
|
@ -772,6 +778,8 @@ - (BOOL)openFileURLs:(NSPasteboard*)pasteboard
|
|||
NSMenu* editMenu = [[NSMenu alloc] initWithTitle:@"Edit"];
|
||||
[editMenuItem setSubmenu:editMenu];
|
||||
MENU_ITEM(editMenu, @"Clear to Start", clear_terminal_and_scrollback);
|
||||
MENU_ITEM(editMenu, @"Clear Scrollback", clear_scrollback);
|
||||
MENU_ITEM(editMenu, @"Clear Screen", clear_screen);
|
||||
[editMenu release];
|
||||
|
||||
NSMenuItem* windowMenuItem =
|
||||
|
|
|
|||
|
|
@ -192,6 +192,12 @@ def set_cocoa_global_shortcuts(opts: Options) -> dict[str, SingleKey]:
|
|||
val = get_macos_shortcut_for(func_map, 'clear_terminal to_cursor active', lookup_name='clear_terminal_and_scrollback')
|
||||
if val is not None:
|
||||
global_shortcuts['clear_terminal_and_scrollback'] = val
|
||||
val = get_macos_shortcut_for(func_map, 'clear_terminal scrollback active', lookup_name='clear_scrollback')
|
||||
if val is not None:
|
||||
global_shortcuts['clear_scrollback'] = val
|
||||
val = get_macos_shortcut_for(func_map, 'clear_terminal to_cursor_scroll active', lookup_name='clear_screen')
|
||||
if val is not None:
|
||||
global_shortcuts['clear_screen'] = val
|
||||
val = get_macos_shortcut_for(func_map, 'load_config_file', lookup_name='reload_config')
|
||||
if val is not None:
|
||||
global_shortcuts['reload_config'] = val
|
||||
|
|
|
|||
|
|
@ -4331,11 +4331,23 @@
|
|||
only='macos',
|
||||
)
|
||||
|
||||
map('Clear up to cursor line',
|
||||
map('Clear to start',
|
||||
'clear_terminal_and_scrollback cmd+k clear_terminal to_cursor active',
|
||||
only='macos',
|
||||
)
|
||||
|
||||
map('Clear scrollback',
|
||||
'clear_scrollback option+cmd+k clear_terminal scrollback active',
|
||||
only='macos',
|
||||
)
|
||||
|
||||
map('Clear screen',
|
||||
'clear_screen cmd+ctrl+l clear_terminal to_cursor_scroll active',
|
||||
only='macos',
|
||||
)
|
||||
|
||||
|
||||
|
||||
map('Reload kitty.conf',
|
||||
'reload_config_file kitty_mod+f5 load_config_file',
|
||||
long_text='''
|
||||
|
|
|
|||
2
kitty/options/types.py
generated
2
kitty/options/types.py
generated
|
|
@ -970,6 +970,8 @@ def __setattr__(self, key: str, val: typing.Any) -> typing.Any:
|
|||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=44), definition='edit_config_file'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=114), definition='clear_terminal reset active'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=107), definition='clear_terminal to_cursor active'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=107), definition='clear_terminal scrollback active'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=108), definition='clear_terminal to_cursor_scroll active'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=44), definition='load_config_file'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=44), definition='debug_config'))
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=9, key=47), definition='open_url https://sw.kovidgoyal.net/kitty/'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue