Global Constant
Steve Nay's ramblings

Linux notifications for the Kynetx KRL command-line tool

This is a response to Mike Grace’s excellent post, Growl Notifications for Kynetx KRL Command Line Tool. The idea is entirely his; I’ve just implemented a solution for Linux. I recommend you go read his post so you know what this is all about.

Since Linux uses libnotify instead of Growl, it’s fairly simple to implement as similar solution to Mike’s on a Linux system.

You’ll need the libnotify-bin package installed. You can do that in the normal manner.

First, add the following to your ~/.bashrc file:

krl() {   if [[ $1 == "commit" ]]; then     command krl $@ | tee status.txt     notify-send -i ~/.kynetx-x.png "KRL" "`cat status.txt`"     rm status.txt   else     command krl $@   fi; }

This is basically creating a function that will run whenever you issue the “krl commit” command. It pipes the output of the KRL gem to a file and then uses the text of that file in the notification.

You can download the Kynetx “X” image to your home directory if you like with the following command:

curl https://kynetx-apps.s3.amazonaws.com/krl-commit-growl-notify/kynetx-x.png > ~/.kynetx-x.png

That’s it! Have fun!