aboutsummaryrefslogtreecommitdiff
path: root/scripts/unmount-usb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/unmount-usb')
-rwxr-xr-xscripts/unmount-usb11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/unmount-usb b/scripts/unmount-usb
new file mode 100755
index 0000000..c90dde4
--- /dev/null
+++ b/scripts/unmount-usb
@@ -0,0 +1,11 @@
+#!/bin/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