diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-11 23:31:33 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-11 23:31:33 +0200 |
commit | 2a99ee0e7fd8c32eeb08be0d6ef273259390da41 (patch) | |
tree | 2d6e6bc178112c53b8f280d684e1fcf12ce61373 /usb-device-add.sh | |
parent | c3d495ae52944f230b0513324abed62efe3cc2b5 (diff) | |
download | scripts-2a99ee0e7fd8c32eeb08be0d6ef273259390da41.tar.gz scripts-2a99ee0e7fd8c32eeb08be0d6ef273259390da41.tar.bz2 scripts-2a99ee0e7fd8c32eeb08be0d6ef273259390da41.zip |
update
Diffstat (limited to 'usb-device-add.sh')
-rwxr-xr-x | usb-device-add.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/usb-device-add.sh b/usb-device-add.sh new file mode 100755 index 0000000..c29e759 --- /dev/null +++ b/usb-device-add.sh @@ -0,0 +1,38 @@ +#!/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 "USB Microphone connected" + ;; + "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 "USB SSD connected" + ;; + "8087:0024") + # Intel Corp. Integrated Rate Matching Hub + # internal hub, do nothing + ;; + *) + 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 "Connected $deviceDetails" + ;; +esac + + + |