summaryrefslogtreecommitdiff
path: root/src/ui/macos.m
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 09:41:06 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 09:41:06 +0300
commit4c277ce0e6efe5d372b399bd37eaef07d6ea8c1a (patch)
tree954e2e5f4b5c9840e90999178b972cc6b50d5f36 /src/ui/macos.m
parentec4a55a53c2ee358e0b6f6220a7fad6c83cb4101 (diff)
Closing tabs/window
Diffstat (limited to 'src/ui/macos.m')
-rw-r--r--src/ui/macos.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ui/macos.m b/src/ui/macos.m
index bf5c2f84..dcae94e6 100644
--- a/src/ui/macos.m
+++ b/src/ui/macos.m
@@ -180,6 +180,10 @@ enum iTouchBarVariant {
180 postCommand_App("preferences"); 180 postCommand_App("preferences");
181} 181}
182 182
183- (void)closeTab {
184 postCommand_App("tabs.close");
185}
186
183- (void)postMenuItemCommand:(id)sender { 187- (void)postMenuItemCommand:(id)sender {
184 NSString *command = [menuCommands objectForKey:[(NSMenuItem *)sender title]]; 188 NSString *command = [menuCommands objectForKey:[(NSMenuItem *)sender title]];
185 if (command) { 189 if (command) {
@@ -347,6 +351,11 @@ void setupApplication_MacOS(void) {
347 NSMenuItem *prefsItem = [appMenu itemWithTitle:@"Preferences…"]; 351 NSMenuItem *prefsItem = [appMenu itemWithTitle:@"Preferences…"];
348 prefsItem.target = myDel; 352 prefsItem.target = myDel;
349 prefsItem.action = @selector(showPreferences); 353 prefsItem.action = @selector(showPreferences);
354 /* Get rid of the default window close item */
355 NSMenu *windowMenu = [[[NSApp mainMenu] itemWithTitle:@"Window"] submenu];
356 NSMenuItem *windowCloseItem = [windowMenu itemWithTitle:@"Close"];
357 windowCloseItem.target = myDel;
358 windowCloseItem.action = @selector(closeTab);
350} 359}
351 360
352void insertMenuItems_MacOS(const char *menuLabel, const iMenuItem *items, size_t count) { 361void insertMenuItems_MacOS(const char *menuLabel, const iMenuItem *items, size_t count) {