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 01/51] 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 02/51] 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 03/51] 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 04/51] 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 05/51] 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 06/51] 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 07/51] 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 08/51] 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 09/51] 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 10/51] 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 11/51] 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 12/51] 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 13/51] 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 14/51] 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 15/51] 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 16/51] 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 17/51] 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 18/51] 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 19/51] 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 20/51] 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 21/51] 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 22/51] 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 23/51] 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 24/51] 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 25/51] 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 26/51] 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 27/51] 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 28/51] 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 29/51] 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 30/51] 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 31/51] 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 32/51] 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 33/51] 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 34/51] 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 35/51] 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 36/51] 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 37/51] 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 38/51] 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 39/51] 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 40/51] 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." ;; From 335c1bc8affbe8cb6afbd1148c73caa1796617b0 Mon Sep 17 00:00:00 2001 From: Stagnant <82290573+iStagnant@users.noreply.github.com> Date: Fri, 17 Feb 2023 14:31:44 +0000 Subject: [PATCH 41/51] Fixed android device not mounting to root owned directories (#1273) --- .local/bin/mounter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index edab8af1..d7c1b06e 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -87,7 +87,7 @@ case "$chosen" in 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" + sudo -A simple-mtpfs -o allow_other --device "$chosen" "$mp" notify-send "๐Ÿค– Android Mounted." "Android device mounted to $mp." ;; esac From 185ac25e52069cab8144d0aea820c056544dfec2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 17 Feb 2023 10:17:35 -0500 Subject: [PATCH 42/51] mount drives with user's ownership --- .local/bin/mounter | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/mounter b/.local/bin/mounter index d7c1b06e..059043be 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -59,7 +59,7 @@ case "$chosen" in chosen="${chosen%% *}" chosen="${chosen:1}" # This is a bashism. getmount - sudo -A mount "$chosen" "$mp" + sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "๐Ÿ’พDrive Mounted." "$chosen mounted to $mp." ;; @@ -78,7 +78,7 @@ case "$chosen" in test -b "/dev/mapper/usb$num" getmount - sudo -A mount "/dev/mapper/usb$num" "$mp" + sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "๐Ÿ”“Decrypted drive Mounted." "$chosen decrypted and mounted to $mp." ;; From a2e767e4f4224cb74b2159833bec598e2e9b72e2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 17 Feb 2023 10:18:01 -0500 Subject: [PATCH 43/51] other aliases --- .config/shell/aliasrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 0541d0f1..09f9a327 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -6,12 +6,17 @@ # Use $XINITRC variable if file exists. [ -f "$XINITRC" ] && alias startx="startx $XINITRC" +[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" + # sudo not required for some system commands for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do alias $command="sudo $command" done; unset command -se() { cd ~/.local/bin; $EDITOR $(fzf) ;} +se() { + choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)" + [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" + ;} # Verbosity and settings that you pretty much just always are going to want. alias \ @@ -19,9 +24,11 @@ alias \ mv="mv -iv" \ rm="rm -vI" \ bc="bc -ql" \ + rsync="rsync -vrPlu" \ mkd="mkdir -pv" \ yt="yt-dlp --embed-metadata -i" \ yta="yt -x -f bestaudio/best" \ + ytt="yt --skip-download --write-thumbnail" \ ffmpeg="ffmpeg -hide_banner" # Colorize commands when possible. From 8dce96b986f5b4401ed81d9575e9590e8636157d Mon Sep 17 00:00:00 2001 From: sudo-Tiz <72883092+sudo-Tiz@users.noreply.github.com> Date: Fri, 17 Feb 2023 15:32:44 +0000 Subject: [PATCH 44/51] add dwmblock tutorial video to tutorialvids script (#1274) --- .local/bin/tutorialvids | 1 + 1 file changed, 1 insertion(+) diff --git a/.local/bin/tutorialvids b/.local/bin/tutorialvids index 6d4914bd..1ea734f8 100755 --- a/.local/bin/tutorialvids +++ b/.local/bin/tutorialvids @@ -6,6 +6,7 @@ vidlist=" dwm (window manager) https://videos.lukesmith.xyz/videos/watch/f6b78db7-b368-4647-bc64-28c08fff1988 +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 From b04d4c9ac83ecf8a5f26ec85e368ed234ca52eec Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 17 Feb 2023 11:01:07 -0500 Subject: [PATCH 45/51] mounter improvements, old scripts removed now checks fstab for info, also one less android prompt --- .local/bin/dmenumount | 67 ------------------------------------------ .local/bin/dmenuumount | 21 ------------- .local/bin/mounter | 15 +++++++--- 3 files changed, 11 insertions(+), 92 deletions(-) delete mode 100755 .local/bin/dmenumount delete mode 100755 .local/bin/dmenuumount diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount deleted file mode 100755 index 8cf4a6b5..00000000 --- a/.local/bin/dmenumount +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -# Gives a dmenu prompt to mount unmounted drives and Android phones. If -# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll -# be prompted to give a mountpoint from already existsing directories. If you -# input a novel directory, it will prompt you to create that directory. - -getmount() { \ - [ -z "$chosen" ] && exit 1 - # shellcheck disable=SC2086 - mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 - test -z "$mp" && exit 1 - if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 - [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") - fi - } - -mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 - chosen="$(echo "$chosen" | awk '{print $1}')" - sudo -A mount "$chosen" 2>/dev/null && notify-send "๐Ÿ’ป USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') - getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" - partitiontype="$(lsblk -no "fstype" "$chosen")" - case "$partitiontype" in - "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." || - 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" - 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." || - notify-send "๐Ÿค– Android failed mounting." "Probably a permissions issue or phone is already mounted." - } - -asktype() { \ - choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 - case $choice in - USB) mountusb ;; - Android) mountandroid ;; - esac - } - -anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,label,mountpoint,fstype" | grep -v crypto_LUKS | grep 'part\|rom' | sed 's/ /:/g' | awk -F':' '$5==""{printf "%s (%s) %s\n",$1,$3,$4}')" - -if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid -else - if [ -z "$anddrives" ]; then - echo "USB drive(s) detected." - mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount deleted file mode 100755 index 656d1f12..00000000 --- a/.local/bin/dmenuumount +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# A dmenu prompt to unmount drives. -# Provides you with mounted partitions, select one to unmount. -# Drives mounted at /, /boot and /home will not be options to unmount. - -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)" - -chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 - -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." diff --git a/.local/bin/mounter b/.local/bin/mounter index 059043be..3b2a314f 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -4,7 +4,7 @@ # 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: Try decrypt for drives in crtypttab # TODO: Add some support for connecting iPhones (although they are annoying). set -e @@ -54,11 +54,18 @@ getmount(){ fi } +attemptmount(){ + # Attempt to mount without a mountpoint, to see if drive is in fstab. + sudo -A mount "$chosen" || return 1 + notify-send "๐Ÿ’พDrive Mounted." "$chosen mounted." + exit +} + case "$chosen" in ๐Ÿ’พ*) chosen="${chosen%% *}" chosen="${chosen:1}" # This is a bashism. - getmount + attemptmount || getmount sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "๐Ÿ’พDrive Mounted." "$chosen mounted to $mp." ;; @@ -77,14 +84,14 @@ case "$chosen" in # Check if now decrypted. test -b "/dev/mapper/usb$num" - getmount + attemptmount || getmount sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "๐Ÿ”“Decrypted drive Mounted." "$chosen decrypted and mounted to $mp." ;; ๐Ÿ“ฑ*) + notify-send "โ—Note" "Remember to allow file access on your phone now." 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. sudo -A simple-mtpfs -o allow_other --device "$chosen" "$mp" From 762eadd9d19e1433a6552e86ec6a68b9f4413dc2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 17 Feb 2023 12:12:10 -0500 Subject: [PATCH 46/51] fix #1275 --- .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 e28f22f8..2a6440be 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -25,7 +25,7 @@ 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 + sort -g | # Sort in ascending order sed -e 1b -e '$!d' # Extract the first and last lines } 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 47/51] 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 1ea734f8..8d1dc471 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 48/51] 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 3b2a314f..7eec8aa5 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 49/51] 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 7eec8aa5..b532e08f 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 From 2e5226545b1a5e84259c3bde34c2410b9b653a54 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Wed, 22 Feb 2023 22:21:55 +0000 Subject: [PATCH 50/51] maimpick: hide cursor when selecting area (#1282) Normally when making a screenshot of an area there's still a bit of the cursor that can be seen, this hides it. --- .local/bin/maimpick | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/maimpick b/.local/bin/maimpick index 8ea9f5ec..5de26c17 100755 --- a/.local/bin/maimpick +++ b/.local/bin/maimpick @@ -9,10 +9,10 @@ output="$(date '+%y%m%d-%H%M-%S').png" xclip_cmd="xclip -sel clip -t image/png" case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in - "a selected area") maim -s pic-selected-"${output}" ;; + "a selected area") maim -u -s pic-selected-"${output}" ;; "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; "full screen") maim -q -d 0.2 pic-full-"${output}" ;; - "a selected area (copy)") maim -s | ${xclip_cmd} ;; + "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; esac From 2062e8110cc6b4479417ff5c5f966aebe337a6da Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Thu, 23 Feb 2023 14:33:45 +0200 Subject: [PATCH 51/51] SQLite ~/ cleanup (#1283) --- .config/shell/profile | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/shell/profile b/.config/shell/profile index c28f5a4b..26f82415 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -41,6 +41,7 @@ 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" +export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" # Other program settings: export DICS="/usr/share/stardict/dic/"