From 89f8506d85aa262ca009b2c2761cbffb0e1b6844 Mon Sep 17 00:00:00 2001 From: iStagnant Date: Mon, 20 Feb 2023 23:16:20 +0200 Subject: [PATCH] Made mounter not show already mounted android devices in the mounting prompt --- .local/bin/mounter | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index 3b2a314..7eec8aa 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -11,6 +11,9 @@ set -e # Check for phones. phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")" +for NUMBER in $(echo "$phones" | sed -rn 's/.([0-9]).*/\1/gp'); do + [[ $(sed -rn 's/simple-mtpfs-([0-9]).*/\1/gp' /etc/mtab) = $NUMBER ]] && phones="$(echo "$phones" | sed "/$NUMBER: .*/d")" +done # Check for drives. lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" # Get all LUKS drives @@ -94,7 +97,7 @@ case "$chosen" in getmount chosen="${chosen%%:*}" chosen="${chosen:1}" # This is a bashism. - sudo -A simple-mtpfs -o allow_other --device "$chosen" "$mp" + sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$chosen" --device "$chosen" "$mp" notify-send "🤖 Android Mounted." "Android device mounted to $mp." ;; esac