dmenu-usb (493B)
1 #!/usr/bin/sh 2 # mount, unmount and poweroff usb drives through dmenu with udisksctl 3 # inspired by dmenu-udevil 4 5 DEV_LABEL="/dev/disk/by-label/" 6 7 label="$(find $DEV_LABEL* | cut -d'/' -f5 | dmenu -p "usb:")" 8 path="$DEV_LABEL$label" 9 [[ -z $label ]] && echo "Cancelled." && exit 10 11 action=$(echo -e "mount\nunmount\npoweroff" | dmenu -p "$label:") 12 [[ -z $action ]] && echo "Cancelled." && exit 13 [[ $action = poweroff ]] && action=power-off 14 udisksctl "$action" -b "$path" 2>&1 | xargs -0 notify-send