Note: You are viewing an old version of this page. View the current version.

/etc/udev.rules/00-bling.rules:

RUN+="/etc/udev/sounds/hw.sh"

/etc/udev/sounds/hw.sh:

#!/bin/bash

#logger -t "hw.sh" "$(whoami) Honoring ${ACTION} for ${SUBSYSTEM}..."
add="/etc/udev/sounds/hw_insert.wav"
rem="/etc/udev/sounds/hw_remove.wav"

[ "${SUBSYSTEM}" == "usb" ] || exit 0

case "${ACTION}" in
add)     snd="${add}" ;;
remove)  snd="${rem}" ;;
*)       ;;
esac

[ "${snd}" ] && /usr/bin/aplay -q "${snd}" &

Note that aplay likely won't work if you have a sound manager like esd squatting on the sound devices, so set it to give them up after a while.

Also, sound managers like esd won't work because they disallow connections from sources that don't match credentials

Salt and pepper to taste...