File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,11 +397,24 @@ - (void)menuSelected:(id)sender {
397397
398398 NSRunningApplication *app = [self .apps objectAtIndex: tag];
399399 if ((modifierFlags & NSAlternateKeyMask ) && (modifierFlags & NSCommandKeyMask )) {
400- [app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
401-
400+ NSInteger shownApps = 0 ;
402401 for (NSRunningApplication *anApp in self.apps ) {
403- if (![anApp isEqual: app]) {
404- [anApp hide ];
402+ if (![anApp isEqual: app] && ![anApp isHidden ]) {
403+ shownApps++;
404+ }
405+ }
406+
407+ if (shownApps <= 0 ) {
408+ for (NSRunningApplication *anApp in self.apps ) {
409+ [anApp unhide ];
410+ }
411+ } else {
412+ [app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
413+
414+ for (NSRunningApplication *anApp in self.apps ) {
415+ if (![anApp isEqual: app]) {
416+ [anApp hide ];
417+ }
405418 }
406419 }
407420 } else if (modifierFlags & NSAlternateKeyMask ) {
@@ -424,6 +437,8 @@ - (void)menuSelected:(id)sender {
424437 }
425438
426439 if (modifierFlags & NSControlKeyMask ) {
440+ [app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
441+
427442 NSTask *task = [[NSTask alloc ] init ];
428443 task.launchPath = @" /usr/bin/open" ;
429444 task.arguments = @[@" -a" , @" mission control" , @" --args" , @" 2" ];
You can’t perform that action at this time.
0 commit comments