@@ -33,34 +33,32 @@ - (void) awakeFromNib {
3333 [[NSFileManager defaultManager ] copyItemAtPath: cgFileInResource toPath: shuttleConfigFile error: nil ];
3434 }
3535 }
36-
37- // Load the menu content
38- // [self loadMenu];
39-
36+
4037 // Define Icons
38+ // only regular icon is needed for 10.10 and higher. OS X changes the icon for us.
4139 regularIcon = [NSImage imageNamed: @" StatusIcon" ];
4240 altIcon = [NSImage imageNamed: @" StatusIconAlt" ];
4341
42+ // Create the status bar item
43+ statusItem = [[NSStatusBar systemStatusBar ] statusItemWithLength: NSSquareStatusItemLength ];
44+ [statusItem setMenu: menu];
45+ [statusItem setImage: regularIcon];
46+
4447 // Check for AppKit Version, add support for darkmode if > 10.9
4548 BOOL oldAppKitVersion = (floor (NSAppKitVersionNumber ) <= 1265 );
4649
50+ // 10.10 or higher, dont load the alt image let OS X style it.
4751 if (!oldAppKitVersion)
4852 {
49- // 10.10 or higher, add support to icon for auto detection of Regular/Dark mode
50- [regularIcon setTemplate: YES ];
51- [altIcon setTemplate: YES ];
53+ regularIcon.template = YES ;
54+ }
55+ // Load the alt image for OS X < 10.10
56+ else {
57+ [statusItem setHighlightMode: YES ];
58+ [statusItem setAlternateImage: altIcon];
5259 }
5360
54- // Create the status bar item
55- statusItem = [[NSStatusBar systemStatusBar ] statusItemWithLength: 25.0 ];
56-
57- [statusItem setMenu: menu];
58- [statusItem setHighlightMode: YES ];
59- [statusItem setImage: regularIcon];
60- [statusItem setAlternateImage: altIcon];
61-
6261 launchAtLoginController = [[LaunchAtLoginController alloc ] init ];
63-
6462 // Needed to trigger the menuWillOpen event
6563 [menu setDelegate: self ];
6664}
@@ -357,9 +355,11 @@ - (void) buildMenu:(NSArray*)data addToMenu:(NSMenu *)m {
357355 NSString *termTitle = cfg[@" title" ];
358356 // Get the value of setting inTerminal
359357 NSString *termWindow = cfg[@" inTerminal" ];
358+ // Get the menu name will will use this as the title if title is null.
359+ NSString *menuName = cfg[@" name" ];
360360
361361 // Place the terminal command, theme, and title into an comma delimited string
362- NSString *menuRepObj = [NSString stringWithFormat: @" %@ ,%@ ,%@ ,%@ " , menuCmd, termTheme, termTitle, termWindow];
362+ NSString *menuRepObj = [NSString stringWithFormat: @" %@ ,%@ ,%@ ,%@ , %@ " , menuCmd, termTheme, termTitle, termWindow, menuName ];
363363
364364 [menuItem setTitle: cfg[@" name" ]];
365365 [menuItem setRepresentedObject: menuRepObj];
@@ -384,6 +384,7 @@ - (void) openHost:(NSMenuItem *) sender {
384384 // Are commands run in a new tab (default) a new terminal window (new), or in the current tab of the last used window (current).
385385 NSString *terminalWindow;
386386
387+
387388 // if for some reason we get a representedObject with only one item...
388389 if (objectsFromJSON.count <=1 ) {
389390 escapedObject = [[sender representedObject ] stringByReplacingOccurrencesOfString: @" \" " withString: @" \\\" " ];
@@ -402,7 +403,7 @@ - (void) openHost:(NSMenuItem *) sender {
402403 }
403404 // Check if terminalTitle is null
404405 if ( [[objectsFromJSON objectAtIndex: 2 ] isEqualToString: @" (null)" ]){
405- terminalTitle = @" " ;
406+ terminalTitle = [objectsFromJSON objectAtIndex: 4 ] ;
406407 }else {
407408 terminalTitle = [objectsFromJSON objectAtIndex: 2 ];
408409 }
@@ -422,7 +423,7 @@ - (void) openHost:(NSMenuItem *) sender {
422423 // Set Paths to iTerm Nightly AppleScripts
423424 NSString *iTerm2NightlyNewWindow = [[NSBundle mainBundle ] pathForResource: @" iTerm2-nightly-new-window" ofType: @" scpt" ];
424425 NSString *iTerm2NightlyCurrentWindow = [[NSBundle mainBundle ] pathForResource: @" iTerm2-nightly-current-window" ofType: @" scpt" ];
425- NSString *iTerm2StableNewTabDefault = [[NSBundle mainBundle ] pathForResource: @" iTerm2-nightly-new-tab-default" ofType: @" scpt" ];
426+ NSString *iTerm2NightlyNewTabDefault = [[NSBundle mainBundle ] pathForResource: @" iTerm2-nightly-new-tab-default" ofType: @" scpt" ];
426427
427428 // Set Paths to terminalScripts
428429 NSString *terminalNewWindow = [[NSBundle mainBundle ] pathForResource: @" terminal-new-window" ofType: @" scpt" ];
@@ -473,7 +474,7 @@ - (void) openHost:(NSMenuItem *) sender {
473474 [self runScript: iTerm2NightlyCurrentWindow handler: handlerName parameters: passParameters];
474475 }else {
475476 // we are using the default action of shuttle, use the active window in a new Tab
476- [self runScript: iTerm2StableNewTabDefault handler: handlerName parameters: passParameters];
477+ [self runScript: iTerm2NightlyNewTabDefault handler: handlerName parameters: passParameters];
477478 }
478479 }
479480 }
@@ -601,11 +602,12 @@ - (IBAction)configure:(id)sender {
601602}
602603
603604- (IBAction )showAbout : (id )sender {
604-
605- // Call the windows controller
605+
606+ // Call the windows controller
606607 AboutWindowController *aboutWindow = [[AboutWindowController alloc ] initWithWindowNibName: @" AboutWindowController" ];
607608
608609 // Set the window to stay on top
610+ [aboutWindow.window makeKeyAndOrderFront: nil ];
609611 [aboutWindow.window setLevel: NSFloatingWindowLevel ];
610612
611613 // Show the window
0 commit comments