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

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

RUN+="/tmp/sounds/hw.sh"

/tmp/sounds/hw.sh:

#!/bin/bash

#logger -t "hw.sh" "$(whoami) Honoring ${ACTION} for ${SUBSYSTEM}..."

if [ "${SUBSYSTEM}" != "usb" ]
then
        exit 0
fi

if [ "${ACTION}" = "add" ]
then
        /usr/bin/aplay /tmp/sounds/hw_insert.wav &
        exit 0
elif [ "${ACTION}" = "remove" ]
then
        /usr/bin/aplay /tmp/sounds/hw_remove.wav &
        exit 0
fi

Salt and pepper to taste...