aboutsummaryrefslogtreecommitdiff
path: root/stuff/scripts/unmount-usb
blob: dfcb078ec71047560dd37e1ab2181659f4cd13c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
options=$(lsblk | grep /run/media/$USER | rev | cut -d ' ' -f 1 | rev)
[ -n "$options" ] && opt_num=$(echo "$options" | wc -l) || opt_num=0
if [ $opt_num == 0 ]; then
	notify-send "Nothing mounted!"
elif [ $opt_num == 1 ]; then
	udiskie-umount "$options"
else
	unmount_device=$(echo "$options" | dmenu -p "What device you want to unmount?")
	[[ ! -z "$unmount_device" ]] && udiskie-umount "$unmount_device"
fi