From 27c00576c283316ffd82e3572fd956c20c494cf1 Mon Sep 17 00:00:00 2001 From: Jameson <108906685+2084x@users.noreply.github.com> Date: Mon, 20 Feb 2023 23:01:52 +1100 Subject: [PATCH 1/3] update tutorialvids (#1276) remove duplicate status bar and align --- .local/bin/tutorialvids | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.local/bin/tutorialvids b/.local/bin/tutorialvids index 1ea734f..8d1dc47 100755 --- a/.local/bin/tutorialvids +++ b/.local/bin/tutorialvids @@ -6,22 +6,21 @@ vidlist=" dwm (window manager) https://videos.lukesmith.xyz/videos/watch/f6b78db7-b368-4647-bc64-28c08fff1988 -dwmblocks (status bar) https://videos.lukesmith.xyz/w/mmxHMbqZZEr5FManB57Yy1 +dwmblocks (status bar) https://videos.lukesmith.xyz/w/mmxHMbqZZEr5FManB57Yy1 pacman (installing/managing programs) https://videos.lukesmith.xyz/videos/watch/8e7cadb9-0fed-47ce-a2a8-6635fa48614b -status bar https://videos.lukesmith.xyz/videos/watch/a4d5326b-0aac-496e-bfc3-5acd5cee89f0 sxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2 -st (terminal) https://videos.lukesmith.xyz/videos/watch/efddd39d-bac5-4599-b572-177beb4ce6e8 +st (terminal) https://videos.lukesmith.xyz/videos/watch/efddd39d-bac5-4599-b572-177beb4ce6e8 i3 (old window manager) https://videos.lukesmith.xyz/videos/watch/b861525c-7ada-40ee-a2bb-b5e1ffe0f48b neomutt (email) https://videos.lukesmith.xyz/videos/watch/83122e83-52d9-4278-ae1a-7d1beeb50c8e -ncmpcpp (music player) https://videos.lukesmith.xyz/videos/watch/b5ac6f0d-a220-4433-88e3-e98fc791dc0a +ncmpcpp (music player) https://videos.lukesmith.xyz/videos/watch/b5ac6f0d-a220-4433-88e3-e98fc791dc0a newsboat (RSS reader) https://videos.lukesmith.xyz/videos/watch/bd2c3fff-40fa-47ea-aa98-5b1ec0c903b6 lf (file manager) https://videos.lukesmith.xyz/w/rKeHsF5ZHDNDbR1buUKB1c -zathura (pdf viewer) https://videos.lukesmith.xyz/videos/watch/c780f75a-11f6-48a9-a191-d079ebc36ea4 -gpg keys https://videos.lukesmith.xyz/videos/watch/040f5530-4830-4583-9ddc-2080b421531b +zathura (pdf viewer) https://videos.lukesmith.xyz/videos/watch/c780f75a-11f6-48a9-a191-d079ebc36ea4 +gpg keys https://videos.lukesmith.xyz/videos/watch/040f5530-4830-4583-9ddc-2080b421531b calcurse (calendar) https://videos.lukesmith.xyz/videos/watch/4b937e8b-7654-46e3-8d01-79392ec5b3d1 -urlview https://videos.lukesmith.xyz/videos/watch/31a4918f-633b-4bd6-b08e-956ac75d0324 +urlview https://videos.lukesmith.xyz/videos/watch/31a4918f-633b-4bd6-b08e-956ac75d0324 colorschemes with pywal https://videos.lukesmith.xyz/videos/watch/1b476003-61b2-4609-ac4b-820c3d128643 vi mode in shell https://videos.lukesmith.xyz/videos/watch/228aa50c-836f-456f-9f0d-a45157fe4313 -pass (password manager) https://videos.lukesmith.xyz/videos/watch/432fc942-5e28-4682-9beb-f5cb237a1dd6 +pass (password manager) https://videos.lukesmith.xyz/videos/watch/432fc942-5e28-4682-9beb-f5cb237a1dd6 " echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv From 89f8506d85aa262ca009b2c2761cbffb0e1b6844 Mon Sep 17 00:00:00 2001 From: iStagnant Date: Mon, 20 Feb 2023 23:16:20 +0200 Subject: [PATCH 2/3] 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 From d292d927f187f7ea60d9294baab10b0aa9675abc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 21 Feb 2023 10:27:08 -0500 Subject: [PATCH 3/3] use android name in fsname --- .local/bin/mounter | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index 7eec8aa..b532e08 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -3,29 +3,36 @@ # Mounts Android Phones and USB drives (encrypted or not). This script will # replace the older `dmenumount` which had extra steps and couldn't handle # encrypted drives. -# TODO: Remove already mounted Android phones from prompt. # TODO: Try decrypt for drives in crtypttab # TODO: Add some support for connecting iPhones (although they are annoying). -set -e +IFS=' +' +# Function for escaping cell-phone names. +escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g" ;} # 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 +mountedphones="$(grep "simple-mtpfs" /etc/mtab)" +# If there are already mounted phones, remove them from the list of mountables. +[ -n "$mountedphones" ] && phones="$(for phone in $phones; do + for mounted in $mountedphones; do + escphone="$(escape "$phone")" + [[ "$mounted" =~ "$escphone" ]] && break 1 + done && continue 1 + echo "$phone" +done)" + # Check for drives. lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" # Get all LUKS drives -allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)" || true +allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)" # Get a list of the LUKS drive UUIDs already decrypted. -decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" || true +decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" # Functioning for formatting drives correctly for dmenu: filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; } # Get only LUKS drives that are not decrypted. -IFS=' -' unopenedluks="$(for drive in $allluks; do uuid="${drive%% *}" uuid="${uuid//-}" # This is a bashism. @@ -42,6 +49,10 @@ normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt alldrives="$(echo "$phones $unopenedluks $normalparts" | sed "/^$/d;s/ *$//")" + +# Quit the script if a sequential command fails. +set -e + test -n "$alldrives" # Feed all found drives to dmenu and get user choice. @@ -95,9 +106,9 @@ case "$chosen" in πŸ“±*) notify-send "❗Note" "Remember to allow file access on your phone now." getmount - chosen="${chosen%%:*}" - chosen="${chosen:1}" # This is a bashism. - sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$chosen" --device "$chosen" "$mp" + 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" notify-send "πŸ€– Android Mounted." "Android device mounted to $mp." ;; esac