aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/unmount_usb.sh
blob: 764365c9f8a423c8c43849e9581296d464587fac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

options=$(lsblk | grep /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