Permalink
Browse files

Remove menu items for switching windows by number and duplicate separ…

…ators in Snow Leopard when launching with multi-window startup group
  • Loading branch information...
AaronH committed Jan 8, 2010
1 parent 624a9c9 commit 8846a7daaf83769592750c8400a115ffac8b90cc
Showing with 18 additions and 1 deletion.
  1. +18 −1 TerminalTabSwitching.m
View
@@ -5,10 +5,27 @@ - (void)updateTabListMenu
{
NSMenu* windowsMenu = [[NSApplication sharedApplication] windowsMenu];
+ BOOL wasSeparator = FALSE;
+
for(NSMenuItem* menuItem in [windowsMenu itemArray])
{
- if([menuItem action] == @selector(selectRepresentedTabViewItem:))
+ // makeKeyAndOrderFront switches windows based on COMMAND+NUMBER in Snow Leopard
+ // When starting Terminal with a multi-window Window group, tabswitching will
+ // fall down due to conflict. Removing these items fixes the problem.
+ // Ideally, you could switch their keyEquivelant to OPTION or something,
+ // but that is a project for another day.
+ if([menuItem action] == @selector(selectRepresentedTabViewItem:) || [menuItem action] == @selector(makeKeyAndOrderFront:))
[windowsMenu removeItem:menuItem];
+
+ // remove duplicate separators that can appear in Snow Leopard
+ // when removing menu items
+ if ([menuItem isSeparatorItem]) {
+ if (wasSeparator == TRUE) [windowsMenu removeItem:menuItem];
+ wasSeparator = TRUE;
+ }
+ else wasSeparator = FALSE;
+
+
}
NSArray* tabViewItems = [[self valueForKey:@"tabView"] tabViewItems];

0 comments on commit 8846a7d

Please sign in to comment.