Krolyxon
Commit 1463ae7

Branches

Refs →

dotfiles-x111463ae7

removed android stuff from dmenumount\umount scripts

Author
krolyxon
Date
2022-07-26 16:20 +0530
Parent
75f7550
Commit
1463ae72e5a9d058821cf93194aa31c929e600c5

+10 −55

3 files changed

  1. M .config/ncmpcpp/config +3 −0
  2. M .local/bin/dmenumount +3 −29
  3. M .local/bin/dmenuumount +4 −26
M .config/ncmpcpp/config View
@@ -32,6 +32,9 @@ statusbar_color = red
3232 volume_color = "green"
3333 statusbar_time_color = cyan:b
3434
35+## Selected tracks ##
36+selected_item_prefix = "* "
37+
3538 ## Seeking ##
3639 incremental_seeking = "yes"
3740 seek_time = "1"
M .local/bin/dmenumount View
@@ -1,6 +1,6 @@
11 #!/bin/sh
22
3โˆ’# Gives a dmenu prompt to mount unmounted drives and Android phones. If
3+# Gives a dmenu prompt to mount unmounted drives. If
44 # they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
55 # be prompted to give a mountpoint from already existsing directories. If you
66 # input a novel directory, it will prompt you to create that directory.
@@ -31,37 +31,11 @@ mountusb() { \
3131 notify-send "๐Ÿ’ป USB mounting" "$chosen mounted to $mp."
3232 }
3333
34โˆ’mountandroid() { \
35โˆ’ chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
36โˆ’ chosen="$(echo "$chosen" | cut -d : -f 1)"
37โˆ’ getmount "$HOME -maxdepth 3 -type d"
38โˆ’ simple-mtpfs --device "$chosen" "$mp"
39โˆ’ echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
40โˆ’ simple-mtpfs --device "$chosen" "$mp"
41โˆ’ notify-send "๐Ÿค– Android Mounting" "Android device mounted to $mp."
42โˆ’ }
43โˆ’
44โˆ’asktype() { \
45โˆ’ choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
46โˆ’ case $choice in
47โˆ’ USB) mountusb ;;
48โˆ’ Android) mountandroid ;;
49โˆ’ esac
50โˆ’ }
51โˆ’
52โˆ’anddrives=$(simple-mtpfs -l 2>/dev/null)
5334 usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
5435
5536 if [ -z "$usbdrives" ]; then
56โˆ’ [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
57โˆ’ echo "Android device(s) detected."
58โˆ’ mountandroid
37+ echo "No USB drive detected" && exit
5938 else
60โˆ’ if [ -z "$anddrives" ]; then
6139 echo "USB drive(s) detected."
6240 mountusb
63โˆ’ else
64โˆ’ echo "Mountable USB drive(s) and Android device(s) detected."
65โˆ’ asktype
66โˆ’ fi
67โˆ’fi
41+fi
M .local/bin/dmenuumount View
@@ -12,33 +12,11 @@ unmountusb() {
1212 sudo -A umount "$chosen" && notify-send "๐Ÿ’ป USB unmounting" "$chosen unmounted."
1313 }
1414
15โˆ’unmountandroid() { \
16โˆ’ chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
17โˆ’ [ -z "$chosen" ] && exit
18โˆ’ sudo -A umount -l "$chosen" && notify-send "๐Ÿค– Android unmounting" "$chosen unmounted."
19โˆ’ }
20โˆ’
21โˆ’asktype() { \
22โˆ’ choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
23โˆ’ case "$choice" in
24โˆ’ USB) unmountusb ;;
25โˆ’ Android) unmountandroid ;;
26โˆ’ esac
27โˆ’ }
28โˆ’
2915 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}')
3016
31โˆ’if ! grep simple-mtpfs /etc/mtab; then
32โˆ’ [ -z "$drives" ] && echo "No drives to unmount." && exit
33โˆ’ echo "Unmountable USB drive detected."
34โˆ’ unmountusb
17+if [ -z "$drives" ]; then
18+ echo "No drives to unmount." && exit
3519 else
36โˆ’ if [ -z "$drives" ]
37โˆ’ then
38โˆ’ echo "Unmountable Android device detected."
39โˆ’ unmountandroid
40โˆ’ else
41โˆ’ echo "Unmountable USB drive(s) and Android device(s) detected."
42โˆ’ asktype
43โˆ’ fi
20+ echo "Unmountable USB drive detected."
21+ unmountusb
4422 fi