I was working on an article, doing really well, getting some nice research done, then BAM, Notification Center tells me that a friend was having a beer down the street that happened to look totally nommers on Untappd. So I had to check it out for myself. How I feel about Notification Center today:
krypted January 25th, 2014
Posted In: personal
beer, MAC, Notification Center
The terminal-notifier command is a tool used for sending messages and actions to the Notification Center. It’s a gem, so to set it up we’ll first run the gem command to install it by name:
gem install terminal-notifier
Once installed, run the command along with the -message option followed by a quoted message:
terminal-notifier -message "Hello world"
This produces a message from Notification Center as follows:
The title on the screen though, says Terminal. We want to change the title to something else. To do so, add the -title option. Adding the -title option along with a quoted title then displays a title in the top of the notification.
You can also add a subtitle, which allows for you to, for example, add the name of the app in either of the two fields along with the action you’re performing in the other. For example, if you wanted to add Notification Center alerts to TripWire you could do something like this:
terminal-notifier -message "There were no updates today" -title "TripWire" -subtitle "Drive Scanned"
I like to add sound to some, done using the cleverly named -sound option. Sounds include: blow, bottle, frog, funk, glass, hero, morse, ping, pop, purr, sosumi, submarine and tink. In the following example, I’m going to go ahead and do pretty much the same thing but have a command expand into the message and have it make the pop sound:
terminal-notifier -message `cat mylog.file` -title "TripWire" -subtitle "Drive Scanned" -sound pop
You can add a -group number, which is like a process ID for notifications:
terminal-notifier -message `cat mylog.file` -title "TripWire" -subtitle "Drive Scanned" -sound pop -group 101
You can then list the jobs that you fired off by the -group ID supplied earlier. For example, the following command:
terminal-notifier -list 101
Shows output as follows:
GroupID Title Subtitle Message Delivered At
101 TripWire Drive Scanned There were no updates today 2013-09-22 20:19:53 +0000
You can then remove a job by the same ID using the -remove option:
terminal-notifier -remove 101
You can also invoke actions using the -open and -execute options as well as the -activate option. Open fires up a web page, execute runs a shell script and activate opens an application. We’ll start with the script by adding -execute and linking to a shell script, that will run when someone clicks on the notification dialog:
terminal-notifier -message `cat mylog.file` -title "TripWire" -subtitle "Drive Scanned" -sound pop -group 101 -execute /scripts/champagne.sh
The -open instead of execute will fire off a web page:
terminal-notifier -message `cat mylog.file` -title "TripWire" -subtitle "Drive Scanned" -sound pop -group 101 -open http://www.krypted.com
Or use -activate to fire up an app, following it with the bundle ID:
terminal-notifier -message `cat mylog.file` -title "TripWire" -subtitle "Drive Scanned" -sound pop -group 101 -activate com.microsoft.word
Thanks to Peter for bringing this tool to my attention. I haven’t figured out how to make it persistent yet, working on that.
krypted September 24th, 2013
Posted In: Mac OS X, Mac OS X Server, Mac Security
add notifications, APNS, Notification Center, push, Script notification center
I’ve been doing a number of postings on how to use various features of the latest version of OS X Server. Given that WordPress is pretty much a reverse chronological listing of articles I’ve written, I thought I’d put together a listing of the pages that I’ve done for OS X Server 10.8 (Mountain Lion Server) in order to offer a more pedagogically aligned way of reading these posts. As such, here is the Table of Contents for these posts:
Managing the Server
krypted August 28th, 2012
Posted In: Mac OS X Server, Mac Security
10.8, Lion, Mac OS X Server, mountain lion, mountain lion server, Notification Center, OS X Server, profile manager, Push Notification, snmp, Snow Leopard, time, upgrading, web modules
I love Notification Center on my phone. I think it’s great to receive a simple list of items that have changed since the last time I looked at the phone. I can also quickly dismiss the screen so the fact that there’s often 20 or more items in the list when I’ve been sitting at my computer for 10 minutes and not looking at the phone doesn’t really bum me out much.
In Mountain Lion, Notification Center comes to the Mac. What I’ve grown to love on the iPhone, I’m not sold on for OS X. You see, the alerts that pop up on the screen are great for a phone, because if you’re looking at your phone (hopefully not while driving) then you’re likely multitasking. Since most mobile solutions are so great for multi-tasking, many of us have gotten used to multi-tasking on our mobile devices and then plugging into a keyboard when we need to do something that requires focus. Or at least that’s my workflow.
By default, Notification Center assumes the same level of multi-tasking is done on desktops as on mobile devices. But with some tuning, Notification Center can be even more useful. For example, when I’m writing I like to cut down the distractions. Doing so helps me to stay focused. And when I’m trying to keep the distractions down, there are certain things that should still jar me out of my otherwise focused state. By default, Notification Center pops up alerts on my screen that tell me that things have happened with some of my apps, such as I got an email, a calendar event is prompting or there was a tweet about me. But Notification Center allows me to configure what kinds of alerts I want to see. For example, I might want an alert about a Reminder to come through and not have tweets pop up on my screen while I’m writing. To disable one of the applications allowed to pop up an alert on the screen, open the Notifications System Preference pane and find the application in the list provided.
Then select None to disable notifications. The default setting for each app is to provide what is known as a Banner. A Banner is a prompt that informs users that an event has occurred with a supported app and then goes away. You can also set each app to provide an Alert, which is a banner that doesn’t go away on its own but must be clicked on to disappear.
You can also configure options that make Notifications a little more useful. These are configured per app and include the following:
- Show in Notification Center: Indicates the number of items for each app that are shown in the Notification Center at a time. The default is 5 and this shows you, for example, the subject, sender and first few lines of emails or the name and sender of Tweets that have information about you.
- Badge app icon: Removes the red indicator for each app. For example, when unchecked for mail you’ll no longer see how many unread emails you have.
- Play sound when receiving notifications: Enables an audible alert (ding, ding) that a notification is waiting for you.
Overall, I think it’s really awesome that I now have a feature that is very iOS-centric sitting right here on my Mac. I do think it’s a bit verbose by default, but then, that’s my workflow – the developers are probably targeting the people who feel multi-tasking is healthy on every single computing device you touch. I don’t necessarily agree, but I dig it anyway. So me and my 2 apps that still have notifications enable are going to use this feature, if a bit less verbosely than most!
krypted July 25th, 2012
Posted In: Mac OS X
configure, features, how to, Lion, Mac OS X, manage, mountain lion, Notification Center, os x 10.8, setup