summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmenuumount
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmenuumount')
-rwxr-xr-x.local/bin/dmenuumount10
1 files changed, 6 insertions, 4 deletions
diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount
index da0f401..26612ef 100755
--- a/.local/bin/dmenuumount
+++ b/.local/bin/dmenuumount
@@ -6,25 +6,27 @@
unmountusb() {
[ -z "$drives" ] && exit
- chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
+ chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
+ chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
- chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
+ chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \
- case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in
+ choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
+ case "$choice" in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
}
-drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
+drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit