Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ installed (with [homebrew](http://brew.sh/)) by running:

Then I read and react to these notifications with the follow bash functions:

Change localhost to the remote machine where weechat is running

WEEHOST=localhost

function irc-notification {
TYPE=$1
MSG=$2

terminal-notifier \
-title IRC \
-subtitle "$TYPE" \
Expand All @@ -39,9 +43,9 @@ Then I read and react to these notifications with the follow bash functions:
-sound default \
-group IRC
}

function get-irc-notifications {
ssh remote.host.net 'nc -k -l -U /tmp/weechat.notify.sock' | \
ssh $WEEHOST 'killall nc ; rm -rf /tmp/weechat.notify.sock ; 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
Expand Down
9 changes: 6 additions & 3 deletions notifications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#
# Then run "get-irc-notifications" in a terminal after loading this script.

# change accordingly
WEEHOST=localhost

function irc-notification {
TYPE=$1
MSG=$2
Expand All @@ -22,16 +25,16 @@ function irc-notification {
-title IRC \
-subtitle "$TYPE" \
-message "$MSG" \
-appIcon ~/path/to/icon.png \
-contentImage ~/path/to/icon.png \
-appIcon ~/share/weechat.png \
-contentImage ~/share/weechat.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' | \
ssh $WEEHOST 'killall nc ; rm -rf /tmp/weechat.notify.sock ; 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
Expand Down