diff --git a/README.markdown b/README.markdown index e7e4490..9866374 100644 --- a/README.markdown +++ b/README.markdown @@ -67,6 +67,14 @@ The title of the notification. This defaults to ‘Terminal’. ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +`-subtitle VALUE` + +The subtitle of the notification. + +------------------------------------------------------------------------------- + `-group ID` Specifies the ‘group’ a notification belongs to. For any ‘group’ only _one_ diff --git a/Terminal Notifier/AppDelegate.m b/Terminal Notifier/AppDelegate.m index 7ccd8ac..c7c5b01 100644 --- a/Terminal Notifier/AppDelegate.m +++ b/Terminal Notifier/AppDelegate.m @@ -30,6 +30,7 @@ - (void)printHelpBanner; " Optional:\n" \ "\n" \ " -title VALUE The notification title. Defaults to ‘Terminal’.\n" \ + " -subtitle VALUE The notification subtitle.\n" \ " -group ID A string which identifies the group the notifications belong to.\n" \ " Old notifications with the same ID will be removed.\n" \ " -activate ID The bundle identifier of the application to activate when the user clicks the notification.\n" \ @@ -50,6 +51,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification; } else { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString *subtitle = defaults[@"subtitle"]; NSString *message = defaults[@"message"]; NSString *remove = defaults[@"remove"]; if (message == nil && remove == nil) { @@ -70,6 +72,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification; if (defaults[@"open"]) options[@"open"] = defaults[@"open"]; [self deliverNotificationWithTitle:defaults[@"title"] ?: @"Terminal" + subtitle:subtitle message:message options:options]; } @@ -77,6 +80,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification; } - (void)deliverNotificationWithTitle:(NSString *)title + subtitle:(NSString *)subtitle message:(NSString *)message options:(NSDictionary *)options; { @@ -85,6 +89,7 @@ - (void)deliverNotificationWithTitle:(NSString *)title NSUserNotification *userNotification = [NSUserNotification new]; userNotification.title = title; + userNotification.subtitle = subtitle; userNotification.informativeText = message; userNotification.userInfo = options; @@ -118,6 +123,7 @@ - (void)userActivatedNotification:(NSUserNotification *)userNotification; NSLog(@"User activated notification:"); NSLog(@" group ID: %@", groupID); NSLog(@" title: %@", userNotification.title); + NSLog(@" subtitle: %@", userNotification.subtitle); NSLog(@" message: %@", userNotification.informativeText); NSLog(@"bundle ID: %@", bundleID); NSLog(@" command: %@", command);