From 37a97189e813abd2844fff7ea5cf30c31ceef95a Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Thu, 8 May 2025 09:21:53 +0200 Subject: update --- usb-notify.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 usb-notify.sh (limited to 'usb-notify.sh') 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" -- cgit v1.2.3