diff options
-rw-r--r-- | osdep/macosx_menubar.m | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/osdep/macosx_menubar.m b/osdep/macosx_menubar.m index 8081ed202e..92bd3fa991 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/macosx_menubar.m @@ -87,11 +87,31 @@ }], @{ @"name": @"separator" }, [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Services", + @"key" : @"", + }], + @{ @"name": @"separator" }, + [NSMutableDictionary dictionaryWithDictionary:@{ @"name" : @"Hide mpv", @"action" : @"hide:", @"key" : @"h", @"target" : NSApp }], + [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Hide Others", + @"action" : @"hideOtherApplications:", + @"key" : @"h", + @"modifiers" : [NSNumber numberWithUnsignedInteger: + NSEventModifierFlagCommand | + NSEventModifierFlagOption], + @"target" : NSApp + }], + [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Show All", + @"action" : @"unhideAllApplications:", + @"key" : @"", + @"target" : NSApp + }], @{ @"name": @"separator" }, [NSMutableDictionary dictionaryWithDictionary:@{ @"name" : @"Quit and Remember Position", @@ -126,6 +146,11 @@ }], @{ @"name": @"separator" }, [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Close", + @"action" : @"performClose:", + @"key" : @"w" + }], + [NSMutableDictionary dictionaryWithDictionary:@{ @"name" : @"Save Screenshot", @"action" : @"cmd:", @"key" : @"", @@ -577,6 +602,7 @@ - (NSMenu *)mainMenu { NSMenu *mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"]; + NSApp.servicesMenu = [NSMenu alloc]; for(id mMenu in menuTree) { NSMenu *menu = [[NSMenu alloc] initWithTitle:mMenu[@"name"]]; @@ -600,6 +626,15 @@ keyEquivalent:subMenu[@"key"]]; [iItem setTarget:subMenu[@"target"]]; [subMenu setObject:iItem forKey:@"menuItem"]; + + NSNumber *m = subMenu[@"modifiers"]; + if (m) { + [iItem setKeyEquivalentModifierMask:m.unsignedIntegerValue]; + } + + if ([subMenu[@"name"] isEqual:@"Services"]) { + iItem.submenu = NSApp.servicesMenu; + } } } } |