From 05e6e8ebd866ff9a5a18aed9d2b20a5ebb562f0f Mon Sep 17 00:00:00 2001 From: Marco Bazzani Date: Mon, 13 Feb 2017 16:18:06 +0000 Subject: [PATCH 1/2] Update notifications.sh fix reconnect and nc kill --- notifications.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/notifications.sh b/notifications.sh index a6c33f0..1057b23 100755 --- a/notifications.sh +++ b/notifications.sh @@ -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 @@ -22,8 +25,8 @@ 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 \ @@ -31,7 +34,7 @@ function irc-notification { } 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 From 998b22c2a12a9021d6dba51218e1f89b775e8f10 Mon Sep 17 00:00:00 2001 From: Marco Bazzani Date: Mon, 13 Feb 2017 16:19:27 +0000 Subject: [PATCH 2/2] Update README.md fixes to reconnect and kill the pending nc process --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 21c3d7a..10004f1 100644 --- a/README.md +++ b/README.md @@ -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" \ @@ -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