Skip to content

Instantly share code, notes, and snippets.

@EdgeCaseBerg
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdgeCaseBerg/7faec8847e563f950372 to your computer and use it in GitHub Desktop.
Save EdgeCaseBerg/7faec8847e563f950372 to your computer and use it in GitHub Desktop.
event.sh file for mcabber to send notifications via notify-send when recieving messages or updates from users.
#!/bin/sh
#set the following in your .mcabberrc file for notifications
#set events_command = ~/.mcabber/event.sh
#set events_ignore_active_window = 0
#set event_log_files = 1
#set event_log_dir = /tmp
if [ $1 = "MSG" ]; then
case "$2" in
IN)
if [ -n "$4" -a -f "$4" ]; then
message="$(cat $4)"
notify-send "$3 :: $message"
rm $4
fi
;;
MUC)
if [ -n "$4" -a -f "$4" ]; then
message="$(cat $4)"
notify-send "$3 :: $message"
rm $4
fi
;;
OUT)
echo > /dev/null
;;
esac
elif [ $1 = "STATUS" ]; then
case "$2" in
_)
notify-send "$3 has signed off"
;;
O)
notify-send "$3 is now online"
;;
F)
notify-send "$3 is chatty"
;;
A)
notify-send "$3 is away"
;;
N)
notify-send "$3 is now extended away"
;;
D)
notify-send "$3 is busy"
;;
I)
notify-send "$3 is invisible"
;;
?)
notify-send "Something is wrong"
;;
X)
notify-send "$3 has a request"
;;
esac
elif [ $1 = "UNREAD" ]; then
notify-send "There are $2 new messages"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment