Last active
August 29, 2015 14:00
-
-
Save kelsin/3aed1520d0e877d8cea8 to your computer and use it in GitHub Desktop.
Functions to log into my remote server and read notifications from a socket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function irc-notification { | |
| TYPE=$1 | |
| MSG=$2 | |
| terminal-notifier \ | |
| -title IRC \ | |
| -subtitle "$TYPE" \ | |
| -message "$MSG" \ | |
| -appIcon ~/path/to/icon.png \ | |
| -contentImage ~/path/to/icon.png \ | |
| -execute "/usr/local/bin/tmux select-window -t 0:IRC" \ | |
| -activate com.apple.Terminal \ | |
| -sound default \ | |
| -group IRC | |
| } | |
| function get-irc-notifications { | |
| ssh remote.host.net 'nc -k -l -U /tmp/weechat.notify.sock' | \ | |
| while read type message; do | |
| irc-notification "$(echo -n $type | base64 -D -)" "$(echo -n $message | base64 -D -)" | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment