removed android stuff from dmenumount\umount scripts

This commit is contained in:
krolyxon 2022-07-26 16:20:45 +05:30
parent 75f7550e7e
commit 1463ae72e5
3 changed files with 10 additions and 55 deletions

View File

@ -32,6 +32,9 @@ statusbar_color = red
volume_color = "green" volume_color = "green"
statusbar_time_color = cyan:b statusbar_time_color = cyan:b
## Selected tracks ##
selected_item_prefix = "* "
## Seeking ## ## Seeking ##
incremental_seeking = "yes" incremental_seeking = "yes"
seek_time = "1" seek_time = "1"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Gives a dmenu prompt to mount unmounted drives and Android phones. If # Gives a dmenu prompt to mount unmounted drives. If
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll # 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 # be prompted to give a mountpoint from already existsing directories. If you
# input a novel directory, it will prompt you to create that directory. # input a novel directory, it will prompt you to create that directory.
@ -31,37 +31,11 @@ mountusb() { \
notify-send "💻 USB mounting" "$chosen mounted to $mp." notify-send "💻 USB mounting" "$chosen mounted to $mp."
} }
mountandroid() { \
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
case $choice in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit echo "No USB drive detected" && exit
echo "Android device(s) detected."
mountandroid
else else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected." echo "USB drive(s) detected."
mountusb mountusb
else fi
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

View File

@ -12,33 +12,11 @@ unmountusb() {
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$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?")" || exit 1
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \
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,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}') drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
if ! grep simple-mtpfs /etc/mtab; then if [ -z "$drives" ]; then
[ -z "$drives" ] && echo "No drives to unmount." && exit echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else else
if [ -z "$drives" ] echo "Unmountable USB drive detected."
then unmountusb
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi fi