Skip to content

Instantly share code, notes, and snippets.

@paulbdavis
Last active January 2, 2016 20:29
Show Gist options
  • Save paulbdavis/8356819 to your computer and use it in GitHub Desktop.
Save paulbdavis/8356819 to your computer and use it in GitHub Desktop.
mcabber eventcmd script
#!/usr/bin/env bash
EVENT_TYPE="$1"
EVENT_SUBTYPE="$2"
JID="$3"
FILE="$4"
TITLE="XMPP"
SOUND_DIR="$HOME/.mcabber/sounds"
SOUND_DEVICE="alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo"
TIMEOUT=10000
function new_message_in() {
paplay -d "$SOUND_DEVICE" "$SOUND_DIR"/receive.wav
notify-send -t "$TIMEOUT" "$TITLE" "New message from ${JID}."
}
function new_message_out() {
paplay -d "$SOUND_DEVICE" "$SOUND_DIR"/send.wav
}
if [[ "$EVENT_TYPE" = "MSG" ]] && [[ "$EVENT_SUBTYPE" = "IN" ]]
then
new_message_in
fi
if [[ "$EVENT_TYPE" = "MSG" ]] && [[ "$EVENT_SUBTYPE" = "OUT" ]]
then
new_message_out
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment