aboutsummaryrefslogtreecommitdiff
path: root/dmenuUmount.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-11-19 14:13:18 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-11-19 14:13:18 +0100
commit683564bd058884356491b7b847f5d2e204207389 (patch)
treec7d60ec611dc6c72fcf885d30051fae9757d67c1 /dmenuUmount.sh
downloadscripts-683564bd058884356491b7b847f5d2e204207389.tar.gz
scripts-683564bd058884356491b7b847f5d2e204207389.zip
Initial scripts commit.
Diffstat (limited to 'dmenuUmount.sh')
-rw-r--r--dmenuUmount.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/dmenuUmount.sh b/dmenuUmount.sh
new file mode 100644
index 0000000..873ad2d
--- /dev/null
+++ b/dmenuUmount.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# _ _
+# __| |_ __ ___ ___ _ __ _ _
+# / _` | '_ ` _ \ / _ \ '_ \| | | |
+# | (_| | | | | | | __/ | | | |_| |
+# \__,_|_| |_| |_|\___|_| |_|\__,_|
+# _
+# _ _ _ __ ___ ___ _ _ _ __ | |_ ___
+# | | | | '_ ` _ \ / _ \| | | | '_ \| __/ __|
+# | |_| | | | | | | (_) | |_| | | | | |_\__ \
+# \__,_|_| |_| |_|\___/ \__,_|_| |_|\__|___/
+#
+# Gives a dmenu prompt to umount mounted drives.
+# Shows mounted partitions; select one to unmount.
+
+exclusionregex="\(/boot\|/home\|/\)$"
+drives=$(lsblk -lp | grep "part /" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}')
+[[ "$drives" = "" ]] && exit
+chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
+[[ "$chosen" = "" ]] && exit
+umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted."
+#umount $chosen && notify-send "$chosen unmounted."