From 75bc064a2fba1561af61a75f584d3dac84630c4f Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sun, 6 Nov 2022 19:29:06 +0000 Subject: [PATCH 01/48] Add youtube shorts to linkhandler (#1226) --- .local/bin/linkhandler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index cc971fc7..f62b5812 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -13,7 +13,7 @@ else fi case "$url" in - *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; From d6616cf08b8b7af26050f993bd2c0b742fbe78fe Mon Sep 17 00:00:00 2001 From: Gioele De Vitti Date: Fri, 11 Nov 2022 18:38:57 +0100 Subject: [PATCH 02/48] Stop trapping SIGINT to allow further use of Ctrl+C once lfcd is closed (#1231) * Avoid expansion of file path containing spaces * Do not trap INT signal on lfcd * Untrap to stop trapping once lfcd quit * Revert "Avoid expansion of file path containing spaces" This reverts commit edcccf8f1bb0eb283aa332dc3a2d2b431eb6d189. * Trap SIGINT again --- .config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 7e96734e..c46f51d8 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -54,7 +54,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. # Use lf to switch directories and bind it to ctrl-o lfcd () { tmp="$(mktemp -uq)" - trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT lf -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" From 0efa08107c72947730e06aaea896c42e174b831e Mon Sep 17 00:00:00 2001 From: Rokosun <79040025+futureisfoss@users.noreply.github.com> Date: Wed, 16 Nov 2022 16:04:26 +0000 Subject: [PATCH 03/48] Improve sd script (#1235) * Improve sd script Now sd will also work on apps like mpv and zathura * Fix sd script not working on firefox --- .local/bin/sd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.local/bin/sd b/.local/bin/sd index 7e09bf6e..8047d33b 100755 --- a/.local/bin/sd +++ b/.local/bin/sd @@ -2,10 +2,8 @@ # Open a terminal window in the same directory as the currently active window. -PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") -PID="$(pstree -lpA "$PID")" -PID="${PID##*"${SHELL##*/}"(}" -PID="${PID#*lf(}" -PID="${PID%%)*}" -cd "$(readlink /proc/"$PID"/cwd)" || return 1 +PID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") +PID=$(pstree -lpATna "$PID" | grep -v '\-\(lf,[0-9]\+ -server\|(st-urlhandler,[0-9]\+)\|xclip,[0-9]\+\)' | sed '$s/.*,\([0-9]\+\).*/\1/;t;d') +cwd=$(readlink /proc/"$PID"/cwd) +[ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; } "$TERMINAL" From ffb557119a3426a50dd6905722b6fe89826fbe88 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 16 Nov 2022 11:07:53 -0500 Subject: [PATCH 04/48] close #1234 --- .config/lf/scope | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/lf/scope b/.config/lf/scope index f91fd84b..654e9682 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -26,7 +26,7 @@ case "$(file --dereference --brief --mime-type -- "$1")" in text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/troff) man ./ "$1" | col -b ;; text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; - application/zip) atool --list -- "$1" ;; + application/*zip) atool --list -- "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" From 236118759897e6529cc3282caed29b289fab3c7e Mon Sep 17 00:00:00 2001 From: Gioele De Vitti Date: Wed, 16 Nov 2022 17:15:57 +0100 Subject: [PATCH 05/48] Avoid expansion of file path containing spaces (#1230) --- .config/lf/lfrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 0d534568..1f4dfa1e 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -115,8 +115,8 @@ map set hidden! map shell map x $$f map X !$f -map o &mimeopen $f -map O $mimeopen --ask $f +map o &mimeopen "$f" +map O $mimeopen --ask "$f" map A rename # at the very end map c push A # new rename From d266ca3517a4906a51613ce3f4cde7728c286706 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 16 Nov 2022 11:23:03 -0500 Subject: [PATCH 06/48] fix #1236 --- .config/lf/lfrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 0d534568..035e459b 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -42,8 +42,8 @@ cmd open ${{ done & ;; audio/*) mpv --audio-display=no $f ;; - video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; - application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + video/*|application/vnd.rn-realmedia) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; From fa600f8ca722da4dabc705e89b7c17de3035a3ae Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 16 Nov 2022 11:56:11 -0500 Subject: [PATCH 07/48] fix #1233 and improve and cleanup mount scripts --- .local/bin/dmenumount | 10 ++++----- .local/bin/dmenuumount | 49 +++++++++++------------------------------- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index abeb0ce5..8cf4a6b5 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -27,18 +27,18 @@ mountusb() { \ "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; - esac - notify-send "πŸ’» USB mounting" "$chosen mounted to $mp." + esac && notify-send "πŸ’» USB mounting" "$chosen mounted to $mp." || + notify-send "πŸ’» Drive failed to mount." "Probably a permissions issue or drive is already mounted." } 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." + simple-mtpfs --device "$chosen" "$mp" && + notify-send "πŸ€– Android Mounting" "Android device mounted to $mp." || + notify-send "πŸ€– Android failed mounting." "Probably a permissions issue or phone is already mounted." } asktype() { \ diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount index 946d12c3..656d1f12 100755 --- a/.local/bin/dmenuumount +++ b/.local/bin/dmenuumount @@ -4,41 +4,18 @@ # Provides you with mounted partitions, select one to unmount. # Drives mounted at /, /boot and /home will not be options to unmount. -unmountusb() { - [ -z "$drives" ] && exit - chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 - chosen="$(echo "$chosen" | awk '{print $1}')" - [ -z "$chosen" ] && exit - sudo -A umount "$chosen" && notify-send "πŸ’» USB unmounting" "$chosen unmounted." - } +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}'; awk '/simple-mtpfs/ { print "πŸ“±", $2; }' /etc/mtab)" -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." - } +chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 -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 -else - if [ -z "$drives" ] - then - echo "Unmountable Android device detected." - unmountandroid - else - echo "Unmountable USB drive(s) and Android device(s) detected." - asktype - fi -fi +case "$chosen" in + πŸ“±*) + chosen="${chosen#πŸ“± }" + sudo -A umount -l "$chosen" + ;; + *) + chosen="${chosen% (*}" + sudo -A umount -l "$chosen" + ;; +esac && notify-send "πŸ–₯️ Drive unmounted." "$chosen successfully unmounted." || + notify-send "πŸ–₯️ Drive failed to unmount." "Possibly a permissions or I/O issue." From 450745a467524a0bacdae2679deb370ac2a2e9d5 Mon Sep 17 00:00:00 2001 From: Adrian Wijaya Date: Sun, 20 Nov 2022 04:46:38 +0700 Subject: [PATCH 08/48] fix epub preview not working (#1238) --- .config/lf/scope | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/lf/scope b/.config/lf/scope index 654e9682..1d835275 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -26,7 +26,6 @@ case "$(file --dereference --brief --mime-type -- "$1")" in text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/troff) man ./ "$1" | col -b ;; text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; - application/*zip) atool --list -- "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" @@ -43,6 +42,7 @@ case "$(file --dereference --brief --mime-type -- "$1")" in [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + application/*zip) atool --list -- "$1" ;; *opendocument*) odt2txt "$1" ;; application/pgp-encrypted) gpg -d -- "$1" ;; esac From 588aeb9a1e52b8c3e1d33c07272be7f97f5f9b71 Mon Sep 17 00:00:00 2001 From: Jameson <108906685+2084x@users.noreply.github.com> Date: Sun, 15 Jan 2023 16:26:57 +1100 Subject: [PATCH 09/48] Use wpctl to change volume (#1248) --- .local/bin/statusbar/sb-volume | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index d17ce666..52999f41 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -4,9 +4,9 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t ;; - 4) pamixer --allow-boost -i 1 ;; - 5) pamixer --allow-boost -d 1 ;; + 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; + 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; 3) notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. - Middle click to mute. - Scroll to change." ;; From 9068ccd66cb8c4a7f4655303cc9eaa26bba78127 Mon Sep 17 00:00:00 2001 From: Jameson <108906685+2084x@users.noreply.github.com> Date: Sun, 15 Jan 2023 16:27:25 +1100 Subject: [PATCH 10/48] Use g instead of gg in zathura (#1246) --- .config/wal/templates/zathurarc | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/wal/templates/zathurarc b/.config/wal/templates/zathurarc index a12bbd3c..8f0b16fa 100644 --- a/.config/wal/templates/zathurarc +++ b/.config/wal/templates/zathurarc @@ -12,6 +12,7 @@ map K zoom in map J zoom out map i recolor map p print +map g goto top set default-bg "{background}" set default-fg "{foreground}" From 5c262da7c39fb0b3cd52acca36f45d4e7c629d37 Mon Sep 17 00:00:00 2001 From: Jameson <108906685+2084x@users.noreply.github.com> Date: Sun, 15 Jan 2023 16:27:46 +1100 Subject: [PATCH 11/48] Fix markdown compiling (#1247) --- .local/bin/compiler | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.local/bin/compiler b/.local/bin/compiler index 6e28cd0d..8420e25f 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -39,9 +39,9 @@ case "$ext" in java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; m) octave "$file" ;; md) if [ -x "$(command -v lowdown)" ]; then - lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf + lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf elif [ -x "$(command -v groffdown)" ]; then - groffdown -i "$file" | groff > "$base.pdf" + groffdown -i "$file" | groff -T pdf > "$base".pdf else pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" fi ; ;; @@ -51,7 +51,7 @@ case "$ext" in py) python "$file" ;; [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; rs) cargo build ;; - sass) sassc -a "$file" "$base.css" ;; + sass) sassc -a "$file" "$base".css ;; scad) openscad -o "$base".stl "$file" ;; sent) setsid -f sent "$file" 2>/dev/null ;; tex) textype "$file" ;; From 5c52bd63394aafbb93b6713b74c148e5a4ec17c7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 15 Jan 2023 08:23:06 -0500 Subject: [PATCH 12/48] tweaks --- .config/lf/lfrc | 4 ++-- .local/bin/statusbar/sb-music | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 0d534568..01d17f8b 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -31,7 +31,7 @@ cmd open ${{ case $(file --mime-type "$(readlink -f $f)" -b) in application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; - text/*|application/json|inode/x-empty) $EDITOR $fx;; + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | @@ -41,7 +41,7 @@ cmd open ${{ lf -remote "send toggle" done & ;; - audio/*) mpv --audio-display=no $f ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music index 7ea70320..d164b4be 100755 --- a/.local/bin/statusbar/sb-music +++ b/.local/bin/statusbar/sb-music @@ -1,6 +1,6 @@ #!/bin/sh -filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} +filter() { sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & From c8aa0495eb49d78f4f8ed6c3952c9a7d9d76ae12 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 15 Jan 2023 08:30:21 -0500 Subject: [PATCH 13/48] record script changes --- .local/bin/dmenurecord | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord index b83a7c52..990b7b3c 100755 --- a/.local/bin/dmenurecord +++ b/.local/bin/dmenurecord @@ -9,6 +9,8 @@ # # If there is already a running instance, user will be prompted to end it. +getdim() { xrandr | sed -n "s/\s*\([0-9]\+x[0-9]\+\).*\*.*/\1/p" ;} + updateicon() { \ echo "$1" > /tmp/recordingicon pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" @@ -16,26 +18,23 @@ updateicon() { \ killrecording() { recpid="$(cat /tmp/recordingpid)" - # kill with SIGTERM, allowing finishing touches. kill -15 "$recpid" rm -f /tmp/recordingpid updateicon "" pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" - # even after SIGTERM, ffmpeg may still run, so SIGKILL it. - sleep 3 - kill -9 "$recpid" - exit } screencast() { \ ffmpeg -y \ -f x11grab \ - -framerate 60 \ - -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ + -framerate 30 \ + -s "$(getdim)" \ -i "$DISPLAY" \ - -f alsa -i default \ - -r 30 \ - -c:v h264 -crf 0 -preset ultrafast -c:a aac \ + -r 24 \ + -use_wallclock_as_timestamps 1 \ + -f alsa -thread_queue_size 1024 -i default \ + -c:v h264 \ + -crf 0 -preset ultrafast -c:a aac \ "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & echo $! > /tmp/recordingpid updateicon "βΊοΈπŸŽ™οΈ" @@ -43,7 +42,8 @@ screencast() { \ video() { ffmpeg \ -f x11grab \ - -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ + -framerate 30 \ + -s "$(getdim)" \ -i "$DISPLAY" \ -c:v libx264 -qp 0 -r 30 \ "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & @@ -104,7 +104,7 @@ videoselected() ffmpeg \ -f x11grab \ - -framerate 60 \ + -framerate 30 \ -video_size "$W"x"$H" \ -i :0.0+"$X,$Y" \ -c:v libx264 -qp 0 -r 30 \ From 56b61ca1d51da9341e9dd882106d111c8cff8b4b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 17 Jan 2023 16:20:27 -0500 Subject: [PATCH 14/48] add larbs user.js additions --- .config/firefox/larbs.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .config/firefox/larbs.js diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js new file mode 100644 index 00000000..452572f2 --- /dev/null +++ b/.config/firefox/larbs.js @@ -0,0 +1,32 @@ +// These are changes made on top of the Arkenfox JS file to tweak it as +// desired. Any of these settings can be overridden by the user. + +// Disable the Twitter/R*ddit/Faceberg ads in the URL bar: +user_pref("browser.urlbar.quicksuggest.enabled", false); +user_pref("browser.urlbar.suggest.topsites", false); // [FF78+] + +// Do not suggest web history in the URL bar: +user_pref("browser.urlbar.suggest.history", false); + +// Do not prefil forms: +user_pref("signon.prefillForms", false); + +// Do not autocomplete in the URL bar: +user_pref("browser.urlbar.autoFill", false); + +// Enable the addition of search keywords: +user_pref("keyword.enabled", true); + +// Allow access to http (i.e. not https) sites: +user_pref("dom.security.https_only_mode", false); + +// Keep cookies until expiration or user deletion: +user_pref("network.cookie.lifetimePolicy", 0); + +user_pref("dom.webnotifications.serviceworker.enabled", false); + +// Disable push notifications: +user_pref("dom.push.enabled", false); + +// Disable the pocket antifeature: +user_pref("extensions.pocket.enabled", false); From a247e3e851666775d0b29111240c05401a990604 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 19 Jan 2023 09:11:18 -0500 Subject: [PATCH 15/48] enable custom userChrome.js --- .config/firefox/larbs.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js index 452572f2..7fc34a3a 100644 --- a/.config/firefox/larbs.js +++ b/.config/firefox/larbs.js @@ -30,3 +30,9 @@ user_pref("dom.push.enabled", false); // Disable the pocket antifeature: user_pref("extensions.pocket.enabled", false); + +// Don't autodelete cookies on shutdown: +user_pref("clearOnShutdown.cookies", false); + +// Enable custom userChrome.js: +user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); From ab8f99cb712895c37c19f907712f2de00f792ab2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 19 Jan 2023 12:50:17 -0500 Subject: [PATCH 16/48] lax for logins --- .config/firefox/larbs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js index 7fc34a3a..b0c89acb 100644 --- a/.config/firefox/larbs.js +++ b/.config/firefox/larbs.js @@ -36,3 +36,6 @@ user_pref("clearOnShutdown.cookies", false); // Enable custom userChrome.js: user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); + +// This could otherwise cause some issues on bank logins and other annoying sites: +user_pref("network.http.referer.XOriginPolicy", 0); From 1ccf88c09961f2feb752d024afd4f58375cdec98 Mon Sep 17 00:00:00 2001 From: Rokosun <79040025+futureisfoss@users.noreply.github.com> Date: Fri, 20 Jan 2023 19:44:36 +0000 Subject: [PATCH 17/48] Various bug fixes and improvements for sd script * Programs that show ~/ or / instead of the actual working directory are now ignored by the script (except for zsh & lf where its correct). This will fix bugs where sd opens your home folder instead of the current working directory. * This also removes the need for manually excluding all programs that don't show the correct cwd. * git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored too. --- .local/bin/sd | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.local/bin/sd b/.local/bin/sd index 8047d33b..a0ff84c2 100755 --- a/.local/bin/sd +++ b/.local/bin/sd @@ -2,8 +2,21 @@ # Open a terminal window in the same directory as the currently active window. -PID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") -PID=$(pstree -lpATna "$PID" | grep -v '\-\(lf,[0-9]\+ -server\|(st-urlhandler,[0-9]\+)\|xclip,[0-9]\+\)' | sed '$s/.*,\([0-9]\+\).*/\1/;t;d') -cwd=$(readlink /proc/"$PID"/cwd) +windowPID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") +PIDlist=$(pstree -lpATna "$windowPID" | sed -En 's/.*,([0-9]+).*/\1/p' | tac) +for PID in $PIDlist; do + cmdline=$(ps -o args= -p "$PID") + process_group_leader=$(ps -o comm= -p "$(ps -o pgid= -p "$PID" | tr -d ' ')") + cwd=$(readlink /proc/"$PID"/cwd) + # zsh and lf won't be ignored even if it shows ~ or / + case "$cmdline" in + 'lf -server') continue ;; + "${SHELL##*/}"|'lf'|'lf '*) break ;; + esac + # git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored + [ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue + # This is to ignore programs that show ~ or / instead of the actual working directory + [ "$cwd" != "$HOME" ] && [ "$cwd" != '/' ] && break +done [ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; } "$TERMINAL" From 6e75e3a3bf4205a3f6d9a286f058ad1dd000e7d6 Mon Sep 17 00:00:00 2001 From: Amy <58243358+aymey@users.noreply.github.com> Date: Sat, 21 Jan 2023 08:10:47 +1100 Subject: [PATCH 18/48] add TERMINAL_PROG variable (#1237) used in programs like `xtrace` (line 172 `/usr/bin/xtrace`) --- .config/shell/profile | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/shell/profile b/.config/shell/profile index 10763526..7c7a613d 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -13,6 +13,7 @@ unsetopt PROMPT_SP # Default programs: export EDITOR="nvim" export TERMINAL="st" +export TERMINAL_PROG="st" export BROWSER="librewolf" # ~/ Clean-up: From 9e433aa75398241744b10b8b87fcb09ce3f4989e Mon Sep 17 00:00:00 2001 From: Axel <14095200+codegax@users.noreply.github.com> Date: Mon, 23 Jan 2023 00:18:01 +0000 Subject: [PATCH 19/48] Update README.md (#1254) Update link to dependency csv --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1594423b..135a8e49 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ curl -LO larbs.xyz/larbs.sh ``` or clone the repo files directly to your home directory and install the -[dependencies](https://github.com/LukeSmithxyz/LARBS/blob/master/progs.csv). +[dependencies](https://github.com/LukeSmithxyz/LARBS/blob/master/static/progs.csv). ## Default Desktop Artwork From 2ca01a2886f23a7171ce52f1154f6f105b481720 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 27 Jan 2023 17:32:33 -0500 Subject: [PATCH 20/48] usb/android/luks (un)mount scripts to replace dmenumount and dmenuumount --- .local/bin/mounter | 93 ++++++++++++++++++++++++++++++++++++++++++++ .local/bin/unmounter | 28 +++++++++++++ 2 files changed, 121 insertions(+) create mode 100755 .local/bin/mounter create mode 100755 .local/bin/unmounter diff --git a/.local/bin/mounter b/.local/bin/mounter new file mode 100755 index 00000000..a6636859 --- /dev/null +++ b/.local/bin/mounter @@ -0,0 +1,93 @@ +#!/bin/bash + +# 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 mount first for drives if in fstab to avoid directory prompt? +# TODO: Add some support for connecting iPhones (although they are annoying). + +set -e + +# Check for phones. +phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/πŸ“±/")" +# Check for drives. +alldrives="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" +# Get all LUKS drives +allluks="$(echo "$alldrives" | grep crypto_LUKS)" +# Get a list of the LUKS drive UUIDs already decrypted. +decrypted="$(ls /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. + for open in $decrypted; do + [ "$uuid" = "$open" ] && break 1 + done && continue 1 + echo "πŸ”’ $drive" +done | filter)" + +# Get all normal, non-encrypted or decrypted partitions that are not mounted. +normalparts="$(echo "$alldrives"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/πŸ’Ύ /" | filter )" + +# Add all to one variable. If no mountable drives found, exit. +alldrives="$(echo "$phones +$unopenedluks +$normalparts" | sed "/^$/d;s/ *$//")" +test -n "$alldrives" + +# Feed all found drives to dmenu and get user choice. +chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)" + +# Function for prompting user for a mountpoint. +getmount(){ + mp="$(find /mnt /media /mount /home -maxdepth 5 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")" + test -n "$mp" + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi +} + +case "$chosen" in + πŸ’Ύ*) + chosen="${chosen%% *}" + chosen="${chosen:1}" # This is a bashism. + getmount + sudo mount "$chosen" "$mp" + notify-send "πŸ’ΎDrive Mounted." "$chosen mounted to $mp." + ;; + + πŸ”’*) + chosen="${chosen%% *}" + chosen="${chosen:1}" # This is a bashism. + # Number the drive. + while true; do + [ -f "/dev/mapper/usb$num" ] || break + num="$(printf "%02d" "$((num +1))")" + done + + # Decrypt in a terminal window + ${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num" + # Check if now decrypted. + test -b /dev/mapper/usb$num + + getmount + sudo mount "/dev/mapper/usb$num" "$mp" + notify-send "πŸ”“Decrypted drive Mounted." "$chosen decrypted and mounted to $mp." + ;; + + πŸ“±*) + getmount + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" + chosen="${chosen%%:*}" + chosen="${chosen:1}" # This is a bashism. + simple-mtpfs --device "$chosen" "$mp" + notify-send "πŸ€– Android Mounted." "Android device mounted to $mp." + ;; +esac diff --git a/.local/bin/unmounter b/.local/bin/unmounter new file mode 100755 index 00000000..7f1dbf5d --- /dev/null +++ b/.local/bin/unmounter @@ -0,0 +1,28 @@ +#!/bin/sh + +# Unmount USB drives or Android phones. Replaces the older `dmenuumount`. Fewer +# prompt and also de-decrypts LUKS drives that are unmounted. + +set -e + +mounteddroids="$(grep simple-mtpfs /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}')" + +allunmountable="$(echo "$mounteddroids +$mounteddrives" | sed "/^$/d;s/ *$//")" +test -n "$allunmountable" + +chosen="$(echo "$allunmountable" | dmenu -i -p "Unmount which drive?")" +chosen="${chosen%% *}" +test -n "$chosen" + +sudo -A umount -l "/${chosen#*/}" +notify-send "Device unmounted." "$chosen has been unmounted." + +# Close the chosen drive if decrypted. +cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")" +cryptid="${cryptid%% *}" +test -b /dev/mapper/"${cryptid##*/}" +sudo -A cryptsetup close "$cryptid" +notify-send "πŸ”’Device dencryption closed." "Drive is now securely locked again." From f5ac77e719ff9696438037fd68d0b7bd584534e3 Mon Sep 17 00:00:00 2001 From: Sergei Kozyrev Date: Sat, 28 Jan 2023 06:06:49 +0600 Subject: [PATCH 21/48] check if kb_choice is empty in sb-kbselect (#1243) --- .local/bin/statusbar/sb-kbselect | 1 + 1 file changed, 1 insertion(+) diff --git a/.local/bin/statusbar/sb-kbselect b/.local/bin/statusbar/sb-kbselect index f0c923f5..ab2140c3 100755 --- a/.local/bin/statusbar/sb-kbselect +++ b/.local/bin/statusbar/sb-kbselect @@ -5,6 +5,7 @@ kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 case $BLOCK_BUTTON in 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)" + [ -z "$kb_choice" ] && exit 0 kb="$(echo "$kb_choice" | awk '{print $3}')" setxkbmap "$kb" pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; From f30078225e1a19af0d6b2696187a991f332a65bf Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 27 Jan 2023 19:16:27 -0500 Subject: [PATCH 22/48] resolve #1249 --- .config/sxiv/exec/key-handler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index 4a4f10a1..4c78f18b 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -28,6 +28,6 @@ do "d") [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; "g") ifinstalled gimp && setsid -f gimp "$file" ;; - "i") notify-send "File information" "$(mediainfo "$file")" ;; + "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: /;s/$/<\/b>/" | grep "")" ;; esac done From 96f65d12deb7afb73a3464628035166edfe0dd1a Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:25:47 +0000 Subject: [PATCH 23/48] Don't stop mounter script on ls error (#1255) * Don't stop mounter script on ls error If no decrypted LUKS drives are found, the script errors with `ls: cannot access '/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-*': No such file or directory` and stops, this makes sure the error doesn't stop the script. * True was on wrong line --- .local/bin/mounter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index a6636859..4f188f25 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -14,7 +14,7 @@ phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/πŸ“±/")" # Check for drives. alldrives="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" # Get all LUKS drives -allluks="$(echo "$alldrives" | grep crypto_LUKS)" +allluks="$(echo "$alldrives" | grep crypto_LUKS)" || true # Get a list of the LUKS drive UUIDs already decrypted. decrypted="$(ls /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" # Functioning for formatting drives correctly for dmenu: From 191d8617e2d0391283f69ae4d8a8e7ee1a4c718e Mon Sep 17 00:00:00 2001 From: Amy <58243358+aymey@users.noreply.github.com> Date: Sun, 29 Jan 2023 03:21:14 +1100 Subject: [PATCH 24/48] remove adding newline (#1257) eol is set on by default --- .config/nvim/init.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index d8aaf5e1..5c397f0e 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -117,7 +117,6 @@ set noshowcmd autocmd BufWritePre * let currPos = getpos(".") autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\n\+\%$//e - autocmd BufWritePre *.[ch] %s/\%$/\r/e autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) " When shortcut files are updated, renew bash and ranger configs with new material: From 9c74ccb955b6a35a8455e2b4f204a4e18a59e16a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 28 Jan 2023 12:03:25 -0500 Subject: [PATCH 25/48] reduce find depth for speed. shellcheck. --- .local/bin/mounter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index 4f188f25..38da0df6 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -16,7 +16,7 @@ alldrives="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" # Get all LUKS drives allluks="$(echo "$alldrives" | grep crypto_LUKS)" || true # Get a list of the LUKS drive UUIDs already decrypted. -decrypted="$(ls /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" +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}' ; } @@ -46,7 +46,7 @@ chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)" # Function for prompting user for a mountpoint. getmount(){ - mp="$(find /mnt /media /mount /home -maxdepth 5 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")" + mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")" test -n "$mp" if [ ! -d "$mp" ]; then mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") @@ -75,7 +75,7 @@ case "$chosen" in # Decrypt in a terminal window ${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num" # Check if now decrypted. - test -b /dev/mapper/usb$num + test -b "/dev/mapper/usb$num" getmount sudo mount "/dev/mapper/usb$num" "$mp" From 6e2de6f4f66ad230fdf05be4308b8e766805fe36 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 1 Feb 2023 09:29:24 -0500 Subject: [PATCH 26/48] remove firefox sync --- .config/firefox/larbs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js index b0c89acb..d24849e8 100644 --- a/.config/firefox/larbs.js +++ b/.config/firefox/larbs.js @@ -39,3 +39,6 @@ user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); // This could otherwise cause some issues on bank logins and other annoying sites: user_pref("network.http.referer.XOriginPolicy", 0); + +// Disable Firefox sync and its menu entries +user_pref("identity.fxaccounts.enabled", false); From 3cee7b8844f8f01b36e2be4a04095e06042c50d2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 1 Feb 2023 13:32:50 -0500 Subject: [PATCH 27/48] update for name change --- .config/firefox/larbs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js index d24849e8..d0d0d5c1 100644 --- a/.config/firefox/larbs.js +++ b/.config/firefox/larbs.js @@ -32,7 +32,7 @@ user_pref("dom.push.enabled", false); user_pref("extensions.pocket.enabled", false); // Don't autodelete cookies on shutdown: -user_pref("clearOnShutdown.cookies", false); +user_pref("privacy.clearOnShutdown.cookies", false); // Enable custom userChrome.js: user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); From c9234676636b3c48ff5767b245790cd58b17085a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 2 Feb 2023 12:05:33 -0500 Subject: [PATCH 28/48] add arkenfox updater wrapper --- .local/bin/arkenfox-auto-update | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 .local/bin/arkenfox-auto-update diff --git a/.local/bin/arkenfox-auto-update b/.local/bin/arkenfox-auto-update new file mode 100755 index 00000000..18029654 --- /dev/null +++ b/.local/bin/arkenfox-auto-update @@ -0,0 +1,20 @@ +#!/bin/sh + +# A wrapper for the arkenfox-updater that runs it on all pre-existing Arkenfox +# user.js files on the machine. + +# On installation of LARBS, this file is copied to /usr/local/lib/ where it is +# run by a pacman hook set up. The user should not have to run this manually. + +# Search for all Firefox and Librewolf profiles using Arkenfox. +profiles="$(grep -H "arkenfox user.js" \ + /home/*/.librewolf/*.default-release/user.js \ + /home/*/.mozilla/firefox/*.default-release/user.js)" + +IFS=' +' + +# Update each found profile. +for profile in $profiles; do + arkenfox-updater -p "${profile%%/user.js*}" -s +done From 070c613050e9149fafc8af3072218199b4588387 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 2 Feb 2023 14:15:32 -0500 Subject: [PATCH 29/48] silent if file absent --- .local/bin/arkenfox-auto-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/arkenfox-auto-update b/.local/bin/arkenfox-auto-update index 18029654..05f4ca7f 100755 --- a/.local/bin/arkenfox-auto-update +++ b/.local/bin/arkenfox-auto-update @@ -7,7 +7,7 @@ # run by a pacman hook set up. The user should not have to run this manually. # Search for all Firefox and Librewolf profiles using Arkenfox. -profiles="$(grep -H "arkenfox user.js" \ +profiles="$(grep -sH "arkenfox user.js" \ /home/*/.librewolf/*.default-release/user.js \ /home/*/.mozilla/firefox/*.default-release/user.js)" From 81456798aea0cde75358b062880d2e38d3265f9e Mon Sep 17 00:00:00 2001 From: PrivateLalle <29478339+LalleSX@users.noreply.github.com> Date: Mon, 6 Feb 2023 19:28:08 +0100 Subject: [PATCH 30/48] Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar (#1259) * Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar * Update sb-doppler * Scandinavian countries listed --------- Co-authored-by: Victor Risgaard --- .config/firefox/larbs.js | 3 +++ .config/lf/icons | 1 + .local/bin/statusbar/sb-doppler | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.config/firefox/larbs.js b/.config/firefox/larbs.js index d0d0d5c1..8328357e 100644 --- a/.config/firefox/larbs.js +++ b/.config/firefox/larbs.js @@ -42,3 +42,6 @@ user_pref("network.http.referer.XOriginPolicy", 0); // Disable Firefox sync and its menu entries user_pref("identity.fxaccounts.enabled", false); + +// Fix the issue where right mouse button instantly clicks +user_pref("ui.context_menus.after_mouseup", true); diff --git a/.config/lf/icons b/.config/lf/icons index ac8f641c..aad068ce 100644 --- a/.config/lf/icons +++ b/.config/lf/icons @@ -9,6 +9,7 @@ ex 🎯 *.mom ✍ *.me ✍ *.ms ✍ +*.avif πŸ–Ό *.png πŸ–Ό *.webp πŸ–Ό *.ico πŸ–Ό diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index 7573c98b..f58b744e 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -184,7 +184,7 @@ US: KVNX: Norman, OK US: KVBX: Vandenberg Afb: Orcutt, CA EU: Europe EU: GB: Great Brittain -EU: SCAN: Scandinavia +EU: SCAN: Scandinavia. Norway, Sweden And Denmark EU: ALPS: The Alps EU: NL: The Netherlands EU: DE: Germany From 32a896ffdff7c61da10a81b669e0c1aff9a6ea99 Mon Sep 17 00:00:00 2001 From: snailed Date: Mon, 6 Feb 2023 21:11:01 +0000 Subject: [PATCH 31/48] Make xprofile automatically start remapd --- .config/x11/xprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/x11/xprofile b/.config/x11/xprofile index 0e226282..affa8dec 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -8,7 +8,7 @@ setbg & # set the background with the `setbg` script #xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup remaps & # run the remaps script, switching caps/esc and more; check it for more info -autostart="mpd xcompmgr dunst unclutter pipewire" +autostart="mpd xcompmgr dunst unclutter pipewire remapd" for program in $autostart; do pidof -s "$program" || "$program" & From 53a66c6254c7a5d6000eee2b3a6b02d340d5511e Mon Sep 17 00:00:00 2001 From: snailed Date: Mon, 6 Feb 2023 21:15:02 +0000 Subject: [PATCH 32/48] Create remapd This script will automatically run remaps when it detects a line in dmesg that contains "input:" --- .local/bin/remapd | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .local/bin/remapd diff --git a/.local/bin/remapd b/.local/bin/remapd new file mode 100644 index 00000000..93a23f64 --- /dev/null +++ b/.local/bin/remapd @@ -0,0 +1,6 @@ +#!/bin/sh +while : ; do + dmesg -W -f kern | grep "input:" -q + sleep 1 + remaps +done From 98ea4e0080fd6f05485baa485cefe2fd7fea9fa2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 6 Feb 2023 17:05:16 -0500 Subject: [PATCH 33/48] fix #1260, more principled volume format --- .local/bin/statusbar/sb-volume | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index 52999f41..acdf7a9e 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -19,14 +19,15 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" [ "$vol" != "${vol%\[MUTED\]}" ] && echo πŸ”‡ && exit vol="${vol#Volume: }" + split() { # For ommiting the . without calling and external program. IFS=$2 set -- $1 printf '%s' "$@" } -vol="$(split "$vol" ".")" -vol="${vol##0}" + +vol="$(printf "%.0f" "$(split "$vol" ".")")" case 1 in $((vol >= 70)) ) icon="πŸ”Š" ;; From 136456e4fab5a7cb428add6e995c941b2c99dcbe Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 6 Feb 2023 18:19:09 -0500 Subject: [PATCH 34/48] add comment, remove remaps from displayselect --- .local/bin/displayselect | 1 - .local/bin/remapd | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.local/bin/displayselect b/.local/bin/displayselect index f9e80628..0227a32b 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -58,7 +58,6 @@ onescreen() { # If only one output available or chosen. postrun() { # Stuff to run to clean up. setbg # Fix background if screen size/arangement has changed. - remaps # Re-remap keys if keyboard added (for laptop bases) { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen } diff --git a/.local/bin/remapd b/.local/bin/remapd index 93a23f64..4ce32b3e 100644 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -1,4 +1,8 @@ #!/bin/sh + +# Rerun the remaps script whenever a new input device is added. Run by the +# xprofile by default. + while : ; do dmesg -W -f kern | grep "input:" -q sleep 1 From 6d75bbdf8c3adea29468328425798d2fa2ab4928 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 6 Feb 2023 20:45:11 -0500 Subject: [PATCH 35/48] remaps run by remapd automatically on startup --- .config/x11/xprofile | 1 - .local/bin/remapd | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.config/x11/xprofile b/.config/x11/xprofile index affa8dec..1d63fd2d 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -6,7 +6,6 @@ xrandr --dpi 96 # Set DPI. User may want to use a larger number for larger screens. setbg & # set the background with the `setbg` script #xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup -remaps & # run the remaps script, switching caps/esc and more; check it for more info autostart="mpd xcompmgr dunst unclutter pipewire remapd" diff --git a/.local/bin/remapd b/.local/bin/remapd index 4ce32b3e..cf67428a 100644 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -1,10 +1,9 @@ #!/bin/sh -# Rerun the remaps script whenever a new input device is added. Run by the -# xprofile by default. +# Rerun the remaps script whenever a new input device is added. while : ; do + remaps dmesg -W -f kern | grep "input:" -q sleep 1 - remaps done From 88748a48006af4e8ec5185336cfeea3aa8f64f63 Mon Sep 17 00:00:00 2001 From: PrivateLalle <29478339+LalleSX@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:51:00 +0100 Subject: [PATCH 36/48] Add support for avif in lf (#1262) Co-authored-by: Victor Risgaard --- .config/lf/lfrc | 2 +- .config/lf/scope | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index c0c4766d..6017255d 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -34,7 +34,7 @@ cmd open ${{ text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | while read -r file; do [ -z "$file" ] && continue lf -remote "send select \"$file\"" diff --git a/.config/lf/scope b/.config/lf/scope index 1d835275..87b560a0 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -22,6 +22,9 @@ ifub() { # be regenerated once seen. case "$(file --dereference --brief --mime-type -- "$1")" in + image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/troff) man ./ "$1" | col -b ;; From b35102679a980bd081509e20f3f488d4415745da Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 8 Feb 2023 13:35:57 -0500 Subject: [PATCH 37/48] actually make the script a script --- .local/bin/remapd | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .local/bin/remapd diff --git a/.local/bin/remapd b/.local/bin/remapd old mode 100644 new mode 100755 From 54c46c523bfedec1faf799e25a945953117a5d6b Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Wed, 8 Feb 2023 22:07:47 +0200 Subject: [PATCH 38/48] Shortcuts: show almost-all files (#1263) --- .local/bin/shortcuts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 8fecea28..7d7a1904 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -22,9 +22,9 @@ printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. eval "echo \"$(cat "$bmdirs")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); - printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; - printf(\"abbr %s \42cd %s; and ls -a\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; + printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; printf(\"map g%s :cd %s\nmap t%s :cd %s\nmap M%s :cd %s:mo\nmap Y%s :cd %s:co \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ; printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ; printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ; From cc53f7be1ccde78cc2d338297a00352b4fe545cf Mon Sep 17 00:00:00 2001 From: snailed Date: Thu, 9 Feb 2023 09:23:22 +0000 Subject: [PATCH 39/48] Clean up remapd I found a much better way of doing this, without a potentially too short sleep. This script waits for an input to be added, and then waits for a usb device to be bound. The remaps script can be run as soon as the USB device is bound. These changes should improve the reliability of the script and maybe even decrease latency. --- .local/bin/remapd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index cf67428a..f2edb4f2 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -2,8 +2,10 @@ # Rerun the remaps script whenever a new input device is added. -while : ; do - remaps - dmesg -W -f kern | grep "input:" -q - sleep 1 +trap "rm -f /tmp/udev_pipe" HUP INT QUIT ILL TRAP BUS TERM +mkfifo -m 600 /tmp/udev_pipe +udevadm monitor -u -t seat -s input -s usb >>/tmp/udev_pipe & +while :; do + grep -q "add" /tmp/udev_pipe && grep -q " bind" /tmp/udev_pipe + remaps us:dvorak done From a4784f9faa9a94d7411d14da113f58e54c8f82e2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 9 Feb 2023 09:19:49 -0500 Subject: [PATCH 40/48] silent sourcing error if absent --- .config/nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 5c397f0e..d9c6fe61 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -154,4 +154,4 @@ nnoremap h :call ToggleHiddenAll() " Here leader is ";". " So ":vs ;cfz" will expand into ":vs /home//.config/zsh/.zshrc" " if typed fast without the timeout. -source ~/.config/nvim/shortcuts.vim +silent! source ~/.config/nvim/shortcuts.vim From ca000f5fe458ec45c38eacfe767e27d2422e9114 Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Thu, 9 Feb 2023 16:37:31 +0200 Subject: [PATCH 41/48] Python ~/ cleanup (#1264) --- .config/python/pythonrc | 2 ++ .config/shell/profile | 1 + 2 files changed, 3 insertions(+) create mode 100644 .config/python/pythonrc diff --git a/.config/python/pythonrc b/.config/python/pythonrc new file mode 100644 index 00000000..b32e6b6f --- /dev/null +++ b/.config/python/pythonrc @@ -0,0 +1,2 @@ +import readline +readline.write_history_file = lambda *args: None diff --git a/.config/shell/profile b/.config/shell/profile index 7c7a613d..c28f5a4b 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -40,6 +40,7 @@ export UNISON="$XDG_DATA_HOME/unison" export HISTFILE="$XDG_DATA_HOME/history" export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config" export ELECTRUMDIR="$XDG_DATA_HOME/electrum" +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" # Other program settings: export DICS="/usr/share/stardict/dic/" From ec1914e0b96c7b85be2197289e45852f08b95579 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 9 Feb 2023 15:39:31 +0100 Subject: [PATCH 42/48] fix broken trap --- .local/bin/remapd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index f2edb4f2..2d87eae1 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -2,7 +2,7 @@ # Rerun the remaps script whenever a new input device is added. -trap "rm -f /tmp/udev_pipe" HUP INT QUIT ILL TRAP BUS TERM +trap "rm -f /tmp/udev_pipe; exit" HUP INT QUIT ILL TRAP BUS TERM mkfifo -m 600 /tmp/udev_pipe udevadm monitor -u -t seat -s input -s usb >>/tmp/udev_pipe & while :; do From 457539c043cc8645eb75e92ff6b0f31182b114d7 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 9 Feb 2023 17:11:16 +0100 Subject: [PATCH 43/48] remove complexity --- .local/bin/remapd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index 2d87eae1..14ae239f 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -2,10 +2,9 @@ # Rerun the remaps script whenever a new input device is added. -trap "rm -f /tmp/udev_pipe; exit" HUP INT QUIT ILL TRAP BUS TERM -mkfifo -m 600 /tmp/udev_pipe -udevadm monitor -u -t seat -s input -s usb >>/tmp/udev_pipe & while :; do - grep -q "add" /tmp/udev_pipe && grep -q " bind" /tmp/udev_pipe + udevadm monitor -u -t seat -s input -s usb | grep --line-buffer -m1 -P '[^un]bind' + sleep 1 remaps us:dvorak done + From 88477d849770561382157667e8d804e3ed8addfc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 9 Feb 2023 11:52:47 -0500 Subject: [PATCH 44/48] use bash procsub --- .local/bin/remapd | 8 +++----- .local/bin/remaps | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index 14ae239f..ee4cf396 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -1,10 +1,8 @@ -#!/bin/sh +#!/bin/bash # Rerun the remaps script whenever a new input device is added. while :; do - udevadm monitor -u -t seat -s input -s usb | grep --line-buffer -m1 -P '[^un]bind' - sleep 1 - remaps us:dvorak + remaps + grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb) done - diff --git a/.local/bin/remaps b/.local/bin/remaps index c95ac841..6d7d54e9 100755 --- a/.local/bin/remaps +++ b/.local/bin/remaps @@ -8,4 +8,4 @@ setxkbmap -option caps:super,altwin:menu_win # When caps lock is pressed only once, treat it as escape. killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' # Turn off caps lock if on since there is no longer a key for it. -xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock +xset -q | grep -q "Caps Lock:\s*on" && xdotool key Caps_Lock From fe198c960fb85850acbe819e12ca465cd6091bc3 Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Sun, 12 Feb 2023 12:24:10 +0200 Subject: [PATCH 45/48] Rewrite sb-forecast --- .local/bin/statusbar/sb-forecast | 52 ++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 9744ea42..59f04970 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -1,24 +1,41 @@ #!/bin/sh -# Displays todays precipication chance (β˜”) and daily low (πŸ₯Ά) and high (🌞). +# Displays today's precipication chance (β˜”), and daily low (πŸ₯Ά) and high (🌞). # Usually intended for the statusbar. -# If we have internet, get a weather report from wttr.in and store it locally. -# You could set up a shell alias to view the full file in a pager in the -# terminal if desired. This function will only be run once a day when needed. -weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" -getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} +weather_report="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" -# Some very particular and terse stream manipulation. We get the maximum -# precipitation chance and the daily high and low from the downloaded file and -# display them with coresponding emojis. -showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | - grep -wo "[0-9]*%" | sort -rn | sed "s/^/β˜”/g;1q" | tr -d '\n')" -sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " πŸ₯Ά" $1 "Β°","🌞" $2 "Β°"}' ;} +# Get a weather report from 'wttr.in' and save it locally. +get_forecast() { curl -sf "wttr.in/$LOCATION" > "$weather_report" || exit 1; } + +# Forecast should be updated only once a day +check_forecast() { + [ -s "$weather_report" ] && [ "$(stat -c %y "$weather_report" 2>/dev/null | + cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] +} + +get_precip_chance() { + sed '16q;d' "$weather_report" | # Extract line 16 from file + grep -wo "[0-9]*%" | # Find a sequence of digits followed by '%' + sort -rn | # Sort in descending order + head -1q # Extract first line +} + +get_daily_high_low() { + sed '13q;d' "$weather_report" | # Extract line 13 from file + grep -o "m\\([-+]\\)*[0-9]\\+" | # Find temperatures in the format "m" + sed 's/[+m]//g' | # Remove '+' and 'm' + sort -n -k 2n | # Sort in ascending order + sed -e 1b -e '$!d' # Extract the first and last lines +} + +show_weather() { + printf "β˜”%s πŸ₯Ά%sΒ° 🌞%sΒ°\n" "$(get_precip_chance)" $(get_daily_high_low) +} case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; - 2) getforecast && showweather ;; + 1) setsid -f "$TERMINAL" -e less -Srf "$weather_report" ;; + 2) get_forecast && show_weather ;; 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. β˜”: Chance of rain/snow @@ -27,9 +44,6 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -# The test if our forcecast is updated to the day. If it isn't download a new -# weather report from wttr.in with the above function. -[ -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || - getforecast +check_forecast || get_forecast -showweather +show_weather From d8f386d5123de66db7449bf1152ed86d84caaf3b Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Sun, 12 Feb 2023 13:33:34 +0200 Subject: [PATCH 46/48] Switch to kebab-case for file name --- .local/bin/statusbar/sb-forecast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 59f04970..8aab1441 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -3,7 +3,7 @@ # Displays today's precipication chance (β˜”), and daily low (πŸ₯Ά) and high (🌞). # Usually intended for the statusbar. -weather_report="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" +weather_report="${XDG_CACHE_HOME:-$HOME/.cache}/weather-report" # Get a weather report from 'wttr.in' and save it locally. get_forecast() { curl -sf "wttr.in/$LOCATION" > "$weather_report" || exit 1; } From de4b34cd32bd74c251ef13c28abfca32b959a873 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 12 Feb 2023 09:00:23 -0500 Subject: [PATCH 47/48] read file only once --- .local/bin/statusbar/sb-forecast | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 8aab1441..e28f22f8 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -3,39 +3,42 @@ # Displays today's precipication chance (β˜”), and daily low (πŸ₯Ά) and high (🌞). # Usually intended for the statusbar. -weather_report="${XDG_CACHE_HOME:-$HOME/.cache}/weather-report" +weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" # Get a weather report from 'wttr.in' and save it locally. -get_forecast() { curl -sf "wttr.in/$LOCATION" > "$weather_report" || exit 1; } +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1; } -# Forecast should be updated only once a day -check_forecast() { - [ -s "$weather_report" ] && [ "$(stat -c %y "$weather_report" 2>/dev/null | +# Forecast should be updated only once a day. +checkforecast() { + [ -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] } -get_precip_chance() { - sed '16q;d' "$weather_report" | # Extract line 16 from file +getprecipchance() { + echo "$weatherdata" | sed '16q;d' | # Extract line 16 from file grep -wo "[0-9]*%" | # Find a sequence of digits followed by '%' sort -rn | # Sort in descending order head -1q # Extract first line } -get_daily_high_low() { - sed '13q;d' "$weather_report" | # Extract line 13 from file +getdailyhighlow() { + echo "$weatherdata" | sed '13q;d' | # Extract line 13 from file grep -o "m\\([-+]\\)*[0-9]\\+" | # Find temperatures in the format "m" sed 's/[+m]//g' | # Remove '+' and 'm' sort -n -k 2n | # Sort in ascending order sed -e 1b -e '$!d' # Extract the first and last lines } -show_weather() { - printf "β˜”%s πŸ₯Ά%sΒ° 🌞%sΒ°\n" "$(get_precip_chance)" $(get_daily_high_low) +readfile() { weatherdata="$(cat "$weatherreport")" ;} + +showweather() { + readfile + printf "β˜”%s πŸ₯Ά%sΒ° 🌞%sΒ°\n" "$(getprecipchance)" $(getdailyhighlow) } case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e less -Srf "$weather_report" ;; - 2) get_forecast && show_weather ;; + 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; + 2) getforecast && showweather ;; 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. β˜”: Chance of rain/snow @@ -44,6 +47,6 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -check_forecast || get_forecast +checkforecast || getforecast -show_weather +showweather From 12167f3dda4a4fc58f7aa441ad93cfa3bb446dbb Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 13 Feb 2023 08:12:40 -0500 Subject: [PATCH 48/48] fix #1268, use sudo -A, var rename --- .local/bin/mounter | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index 38da0df6..edab8af1 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -12,11 +12,11 @@ set -e # Check for phones. phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/πŸ“±/")" # Check for drives. -alldrives="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" +lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")" # Get all LUKS drives -allluks="$(echo "$alldrives" | grep crypto_LUKS)" || true +allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)" || true # Get a list of the LUKS drive UUIDs already decrypted. -decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" +decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" || true # Functioning for formatting drives correctly for dmenu: filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; } @@ -33,7 +33,7 @@ unopenedluks="$(for drive in $allluks; do done | filter)" # Get all normal, non-encrypted or decrypted partitions that are not mounted. -normalparts="$(echo "$alldrives"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/πŸ’Ύ /" | filter )" +normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/πŸ’Ύ /" | filter )" # Add all to one variable. If no mountable drives found, exit. alldrives="$(echo "$phones @@ -59,7 +59,7 @@ case "$chosen" in chosen="${chosen%% *}" chosen="${chosen:1}" # This is a bashism. getmount - sudo mount "$chosen" "$mp" + sudo -A mount "$chosen" "$mp" notify-send "πŸ’ΎDrive Mounted." "$chosen mounted to $mp." ;; @@ -78,7 +78,7 @@ case "$chosen" in test -b "/dev/mapper/usb$num" getmount - sudo mount "/dev/mapper/usb$num" "$mp" + sudo -A mount "/dev/mapper/usb$num" "$mp" notify-send "πŸ”“Decrypted drive Mounted." "$chosen decrypted and mounted to $mp." ;;