aboutsummaryrefslogtreecommitdiff
path: root/usb-notify.sh
blob: 9bb509145d6897e3bd6829ba9131dda004d20856 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"