dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1f6dbfea037366656a7184385957008d7504cd4a
parent b937082b98cb2210497a9e6766b46ddfd5a4548f
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Wed, 10 Apr 2019 19:56:09 -0400

dmenu mount and umount fixes

Diffstat:
M.scripts/i3cmds/dmenumount | 7+++----
M.scripts/i3cmds/dmenuumount | 6+++---
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/.scripts/i3cmds/dmenumount b/.scripts/i3cmds/dmenumount @@ -3,7 +3,6 @@ # If they're in /etc/fstab, they'll be mounted automatically. # Otherwise, you'll be prompted to give a mountpoint from already existsing directories. # If you input a novel directory, it will prompt you to create that directory. -pgrep -x dmenu && exit getmount() { \ [ -z "$chosen" ] && exit 1 @@ -17,7 +16,7 @@ getmount() { \ mountusb() { \ chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" - sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0 + sudo -A mount "$chosen" && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}') getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" partitiontype="$(lsblk -no "fstype" "$chosen")" @@ -25,14 +24,14 @@ mountusb() { \ "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";; esac - notify-send "$chosen mounted to $mp." + notify-send "💻 USB mounting" "$chosen mounted to $mp." } mountandroid() { \ chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1) getmount "$HOME -maxdepth 3 -type d" simple-mtpfs --device "$chosen" "$mp" - notify-send "Android device mounted to $mp." + notify-send "🤖 Android Mounting" "Android device mounted to $mp." } asktype() { \ diff --git a/.scripts/i3cmds/dmenuumount b/.scripts/i3cmds/dmenuumount @@ -7,17 +7,17 @@ unmountusb() { [ -z "$drives" ] && exit chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') [ -z "$chosen" ] && exit - sudo -A umount "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted." + 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?") [ -z "$chosen" ] && exit - sudo -A umount -l "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted." + 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 + case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in USB) unmountusb ;; Android) unmountandroid ;; esac