summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ar/.config/qutebrowser/config.py2
-rwxr-xr-xar/.local/bin/mounter20
-rwxr-xr-xar/.local/bin/unmounter41
3 files changed, 46 insertions, 17 deletions
diff --git a/ar/.config/qutebrowser/config.py b/ar/.config/qutebrowser/config.py
index 00f85f0..167f130 100644
--- a/ar/.config/qutebrowser/config.py
+++ b/ar/.config/qutebrowser/config.py
@@ -661,7 +661,7 @@ c.completion.use_best_match = True
## Automatically start playing `<video>` elements.
## Type: Bool
-# c.content.autoplay = True
+c.content.autoplay = False
## List of URLs to ABP-style adblocking rulesets. Only used when Brave's
## ABP-style adblocker is used (see `content.blocking.method`). You can
diff --git a/ar/.local/bin/mounter b/ar/.local/bin/mounter
index 6f294d2..026f9b3 100755
--- a/ar/.local/bin/mounter
+++ b/ar/.local/bin/mounter
@@ -49,6 +49,16 @@ mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
echo "$phone"
done)"
+iphones="$(ideviceinfo | grep -E "^DeviceName" | sed "s/DeviceName: //;s/^/🍎/")"
+mountediphones="$(grep "ifuse" /etc/mtab)"
+[ -n "$mountediphones" ] && iphones="$(for iphone in $iphones; do
+ for mounted in $mountediphones; do
+ esciphone="$(escape "$iphone")"
+ [[ "$mounted" =~ $esciphone ]] && break 1
+ done && continue 1
+ echo "$iphone"
+done)"
+
# Check for drives.
lsblkoutput="$(sudo lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
# Get all LUKS drives
@@ -114,6 +124,7 @@ done)"
# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
+$iphones
$unopenedluks
$normalparts
$smbs" | sed "/^$/d;s/ *$//")"
@@ -161,9 +172,16 @@ case "$chosen" in
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
- sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
+ sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp" 2>dev/null
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
;;
+🍎*)
+ getmount
+ number="${chosen%%:*}"
+ number="${chosen:1}" # This is a bashism.
+ sudo -A ifuse "$mp" 2>dev/null
+ notify-send "🍎 iPhone Mounted." "$chosen mounted to $mp."
+ ;;
📡*)
chosen="${chosen##* }"
path="${chosen##*/}"
diff --git a/ar/.local/bin/unmounter b/ar/.local/bin/unmounter
index 1e413bf..7d0efee 100755
--- a/ar/.local/bin/unmounter
+++ b/ar/.local/bin/unmounter
@@ -6,11 +6,13 @@
set -e
mounteddroids="$(grep simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
+mountedios="$(grep ifuse /etc/mtab | awk '{print "🍎" $2}')"
lsblkoutput="$(lsblk -nrpo "name,type,size,mountpoint")"
mounteddrives="$(echo "$lsblkoutput" | awk '($2=="part"||$2="crypt")&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "💾%s (%s)\n",$4,$3}')"
mountedcifs="$(grep cifs /etc/mtab | awk '{print "🪟" $2}')"
allunmountable="$(echo "$mounteddroids
+$mountedios
$mounteddrives
$mountedcifs" | sed "/^$/d;s/ *$//")"
test -n "$allunmountable"
@@ -19,23 +21,32 @@ chosen="$(echo "$allunmountable" | dmenu -i -p "Unmount which drive?")"
chosen="${chosen%% *}"
test -n "$chosen"
-if grep -q "/${chosen#*/}" /etc/mtab | grep -q "cifs" /etc/mtab; then
- sudo -A umount "/${chosen#*/}" && sudo -A rm -r "/${chosen#*/}"
- notify-send "⏏️ SMB Drive unmounted." "/${chosen#*/} has been unmounted."
- exit 0
+label=$(sudo lsblk -no "label" "$(df "/${chosen#*/}" | tail -n 1 | awk '{print $1}')")
+if [ -n "$label" ]; then
+ mountpath="$(sudo lsblk -no "mountpoints" "$(df "/${chosen#*/}" | tail -n 1 | awk '{print $1}')")"
+ sudo -A umount -l "/${chosen#*/}"
+ notify-send "⏏️ Device unmounted." "$chosen has been unmounted."
+ if [ "${chosen#*/}" = "${chosen}" ] &&
+ [ "${chosen##*/}" = "$label" ] &&
+ [ "/media/$USER/${chosen##*/}" = "$mountpath" ] &&
+ [ -e "/${chosen#*/}" ] &&
+ [ ! -s "/${chosen#*/}" ]; then
+ rm -rf "/${chosen#*/}" >/dev/null 2>&1 || sudo rm -rf "/${chosen#*/}"
+ notify-send "🚮 Mounted path removed." "$chosen has been removed."
+ fi
+else
+ if grep -q "/${chosen#*/}" /etc/mtab | grep -qE "cifs" /etc/mtab; then
+ sudo -A umount "/${chosen#*/}"
+ notify-send "⏏️ SMB Drive unmounted." "/${chosen#*/} has been unmounted."
+ elif grep -q "/${chosen#*/}" /etc/mtab | grep -q "ifus" /etc/mtab; then
+ sudo -A umount "/${chosen#*/}"
+ notify-send "⏏️ IOS Drive unmounted." "/${chosen#*/} has been unmounted."
+ fi
+ [ -e "/${chosen#*/}" ] && [ ! -s "/${chosen#*/}" ] &&
+ sudo -A rm -r "/${chosen#*/}" &&
+ notify-send "🚮 Mounted path removed." "$chosen has been removed."
fi
-[ "${chosen#*/}" = "${chosen}" ] && [ "${chosen##*/}" = "$(sudo lsblk -no "label" "$(df "/${chosen#*/}" | tail -n 1 | awk '{print $1}')")" ] && rmcheck=true || rmcheck=false
-mountpath="$(sudo lsblk -no "mountpoints" "$(df "/${chosen#*/}" | tail -n 1 | awk '{print $1}')")"
-sudo -A umount -l "/${chosen#*/}"
-[ "/media/$USER/${chosen##*/}" = "$mountpath" ] && [ "$rmcheck" ] && {
- [ -e "/${chosen#*/}" ] && [ -z "$(ls -A "/${chosen#*/}")" ] && (rm -rf "/${chosen#*/}" >/dev/null 2>&1 || sudo rm -rf "/${chosen#*/}") || {
- rmdiryn=$(printf "No\\nYes" | dmenu -i -p "Do you want to delete /${chosen#*/}?")
- [ "$rmdiryn" = "Yes" ] && (rm -rf "/${chosen#*/}" >/dev/null 2>&1 || sudo -A rm -r "/${chosen#*/}")
- }
-}
-notify-send "⏏️ Device unmounted." "$chosen has been unmounted."
-
# Close the chosen drive if decrypted.
cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")"
cryptid="${cryptid%% *}"