Created
June 10, 2013 06:21
-
-
Save JamesTheBard/5746867 to your computer and use it in GitHub Desktop.
mcabber notification script
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
#!/bin/sh | |
echo "$1 $2 $3 $4" >> ~/test.mcabber.log | |
EVENT_TYPE=$1 | |
EVENT_SUBTYPE=$2 | |
JID=$3 | |
FILE=$4 | |
TITLE="Google Hangouts" | |
SOUND_FILE="$HOME/.mcabber/sounds/alert_47.wav" | |
ICON="$HOME/.mcabber/images/chat.png" | |
TIMEOUT=10000 | |
function new_message_in() { | |
notify-send -i $ICON -t $TIMEOUT "$TITLE" "New message from ${JID}." | |
aplay -d 2 $SOUND_FILE | |
} | |
if [ $EVENT_TYPE == "MSG" ] && [ $EVENT_SUBTYPE == "IN" ] | |
then | |
new_message_in | |
fi |
thank you very much!
this has helped me enormously.
Very nice script. Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The mcabberrc file has the following options set to get this to work:
This places the eventcmd script into the $HOME/.mcabber directory. The eventcmd script gets passed information like:
Just remember to either change $SOUND_FILE and $ICON variables to applicable files, or to change the function new_message_in to not play sounds (aplay) or display an icon.
You can test it out by navigating to the $HOME/.mcabber directory and running:
./eventcmd MSG IN "Test User"