diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-08 09:21:53 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-08 09:21:53 +0200 |
commit | 37a97189e813abd2844fff7ea5cf30c31ceef95a (patch) | |
tree | b0d0e2861e81920bf2cfd88528c44c0f060df938 /usb-notify.sh | |
parent | 13139f06ec935b881dca5c97f26f93223ead53d6 (diff) | |
download | scripts-37a97189e813abd2844fff7ea5cf30c31ceef95a.tar.gz scripts-37a97189e813abd2844fff7ea5cf30c31ceef95a.tar.bz2 scripts-37a97189e813abd2844fff7ea5cf30c31ceef95a.zip |
update
Diffstat (limited to 'usb-notify.sh')
-rwxr-xr-x | usb-notify.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/usb-notify.sh b/usb-notify.sh new file mode 100755 index 0000000..9bb5091 --- /dev/null +++ b/usb-notify.sh @@ -0,0 +1,23 @@ +#!/bin/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 " " -f-3 <<< ${deviceDetails}) + +# Slim notification +# /usr/bin/notify-send -a "USB-notify" -c "device.change" "$deviceName" "$busname" -r 1337 + +# Full notification +# /usr/bin/notify-send -a "USB-notify" -c "device.change" "$deviceName" "$deviceID \n $busname \n $devpath" -r 1337 + +# dunstify is like notify-send but specific to dunst +# dunstify "USB change" +dunstify -u normal -t 1000 -r 9000 -i media-removable-symbolic "USB $deviceDetails" |