krypted.com

Tiny Deathstars of Foulness

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:

January 25th, 2014

Posted In: personal

Tags: , ,

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: terminalnotifier1 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. terminalnotifier2 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.

September 24th, 2013

Posted In: Mac OS X, Mac OS X Server, Mac Security

Tags: , , , ,

There are a few ways I like to extend my battery life on my MacBook Air. These days, it’s increasingly important to conserve battery life as the transition to Mountain Lion (Mac OS X 10.8) has caused my battery life to spiral into so much of a vortex that I am concerned that my laptop must be shooting raw electricity out of the bottom (which would certainly explain why my hair has a tendency to be perpendicular with the ground when I exit a plane). Ever since moving to Mountain Lion (yes, this includes 10.8.2), I’m lucky to get 3 hours of battery life out of the Mac that used to give me at least 5 hours… There are a number of tricks that I use to extend battery life. Some are obvious, such as dimming the screen, only using an app at a time, killing off menu items, temporarily stop Spotlight Indexing and killing off LaunchDaemons and LaunchAgents that I’m not using. I even used to used an app called CoolBookController to throttle my processor speeds while flying. But that doesn’t work as of Lion (certainly not in Mountain Lion). One thing that I’ve been able to do that extends my battery life a little more (maybe an extra half hour) is to kill off Notification Center (I wrote about customizing Notification Center earlier here). I know, I know, it shouldn’t matter… But recently, a customer asked me to script disabling Notification Center. Since I’ve been killing it off with a script, this was a pretty straight forward task. It’s easy to disable Notification Center temporarily using the GUI. Simply click on the Notification Center icon in the menu bar and then scroll up to see the “Show Alerts and Banners” button. Click OFF or ON to toggle it off and on. As you can see, Notification Center then starts back up the next day. To disable Notification Center from the command line, write a KeepAlive key that is false into the /System/Library/LaunchAgents/com.apple.notificationcenterui.plist like so: sudo defaults write /System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive -bool false Then, if you kill NotificationCenter off, it’ll stay off: killall NotificationCenter If you want to re-enable Notification Center, you’d just run the same with a true: sudo defaults write /System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive -bool true The easy way to then get it back is to reboot. Now, just for giggles, Notification Center is actually the /System/Library/CoreServices/NotificationCenter.app and in there lies the /System/Library/CoreServices/NotificationCenter.app/Contents/MacOS/NotificationCenter binary. If you open it, you’ll get multiple Notification Center icons in the menu bar. I’m not sure why I decided to try that at some point. But it’s kinda’ fun… Ultimately, I travel with multiple MacBooks, so rather than toss one of them in a checked bag, or one destined for the overhead, I am temporarily just keeping a second 11 in the bag I keep under the seat in front of me for now…

October 22nd, 2012

Posted In: Mac OS X, Mac OS X Server, Mac Security, Mass Deployment

Tags: , , , , , , , ,

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: Introduction Managing the Server Configuring Services Troubleshooting Command Line Misc

August 28th, 2012

Posted In: Mac OS X Server, Mac Security

Tags: , , , , , , , , , , , , ,

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!

July 25th, 2012

Posted In: Mac OS X

Tags: , , , , , , , , ,