#!/usr/bin/env bash export XAUTHORITY=/home/philip/.Xauthority export DISPLAY=:0 export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" busname="/dev/$1"; #devpath="$2"; deviceDetails=$(lsusb -D "${busname}" 2>/dev/null | head -n 1) deviceName=$(cut -d " " -f4- <<< "${deviceDetails}") deviceID=$(cut -d " " -f3 <<< "${deviceDetails}") case "$deviceID" in "1b3f:2019") # usb microphone pactl set-default-source alsa_input.usb-MUSIC-BOOST_USB_Microphone_MB-306-00.mono-fallback dunstify -t 2000 -a "Microphone" -u low -i media-removable-symbolic \ -h string:x-dunst-stack-tag:usb-microphone "$deviceName connected. Set as default" ;; "04e8:4001") # Samsung Electronics Co., Ltd PSSD T7 dunstify -t 2000 -a "SSD" -u low -i media-removable-symbolic \ -h string:x-dunst-stack-tag:usb-ssd "$deviceName connected" ;; "8087:0024") # Intel Corp. Integrated Rate Matching Hub # internal hub, do nothing ;; "2237:4237") # Kobo Clara Colour dunstify -t 2000 -a "SSD" -u low -i media-removable-symbolic \ -h string:x-dunst-stack-tag:usb-ssd "$deviceName connected" ;; *) echo "$deviceDetails" >> ~/unknown-device-connected dunstify -u normal -t 1000 -r 9000 -i media-removable-symbolic "$deviceDetails" \ -h string:x-dunst-stack-tag:usb-device "$deviceID $deviceName Connected" ;; esac