Skip to content

Instantly share code, notes, and snippets.

@kelsin
Last active August 29, 2015 14:00
Show Gist options
  • Save kelsin/3aed1520d0e877d8cea8 to your computer and use it in GitHub Desktop.
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
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