From 1463ae72e5a9d058821cf93194aa31c929e600c5 Mon Sep 17 00:00:00 2001 From: krolyxon Date: Tue, 26 Jul 2022 16:20:45 +0530 Subject: [PATCH] removed android stuff from dmenumount\umount scripts --- .config/ncmpcpp/config | 3 +++ .local/bin/dmenumount | 32 +++----------------------------- .local/bin/dmenuumount | 30 ++++-------------------------- 3 files changed, 10 insertions(+), 55 deletions(-) diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index 27995b7..0ebf410 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -32,6 +32,9 @@ statusbar_color = red volume_color = "green" statusbar_time_color = cyan:b +## Selected tracks ## +selected_item_prefix = "* " + ## Seeking ## incremental_seeking = "yes" seek_time = "1" diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index b414dc8..241e6fd 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -1,6 +1,6 @@ #!/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 # be prompted to give a mountpoint from already existsing directories. If you # 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." } -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}')" if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid + echo "No USB drive detected" && exit else - if [ -z "$anddrives" ]; then echo "USB drive(s) detected." mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi -fi \ No newline at end of file +fi diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount index 946d12c..d9be444 100755 --- a/.local/bin/dmenuumount +++ b/.local/bin/dmenuumount @@ -12,33 +12,11 @@ unmountusb() { 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}') -if ! grep simple-mtpfs /etc/mtab; then - [ -z "$drives" ] && echo "No drives to unmount." && exit - echo "Unmountable USB drive detected." - unmountusb +if [ -z "$drives" ]; then + echo "No drives to unmount." && exit else - if [ -z "$drives" ] - then - echo "Unmountable Android device detected." - unmountandroid - else - echo "Unmountable USB drive(s) and Android device(s) detected." - asktype - fi + echo "Unmountable USB drive detected." + unmountusb fi