From 5d5e3b655ef01973419ac0def58123946b0d569a Mon Sep 17 00:00:00 2001 From: ryan-c-dev Date: Mon, 12 Sep 2022 16:31:07 -0700 Subject: [PATCH 01/21] remove spacing from saved audio for tsp/newsboat (#1184) The --restrict-filenames parameter will automatically replace spaces with underlines. --- .config/newsboat/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/newsboat/config b/.config/newsboat/config index b7a78dae..d8dbecd5 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -32,7 +32,7 @@ color article white default bold browser linkhandler macro , open-in-browser macro t set browser "qndl" ; open-in-browser ; set browser linkhandler -macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler +macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler macro w set browser "lynx" ; open-in-browser ; set browser linkhandler macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler From ae0ad289a10e0cd911489ce08f8d0fed6332d348 Mon Sep 17 00:00:00 2001 From: ryan-c-dev Date: Mon, 19 Sep 2022 16:50:45 -0700 Subject: [PATCH 02/21] underscore vs spaces, and naming convention (#1189) the title then extension format with the --restrict-filenames again for underscores instead of spaces. Works typically well as music will have Artist name first usually followed by song title so no need to format. haven't looked into the --embed-metadata parameter, only imagine it could be useful if it saves the url suffix for youtube link (which you don't want in your filename hopefully) for my video downloads, i just use this. alias ydl='yt-dlp -o '%(title)s.%(ext)s' -f bv+ba/b --restrict-filenames' alias mp3='yt-dlp -o '%(title)s.%(ext)s' -f bestaudio -x --audio-format mp3 --embed-thumbnail --restrict-filenames' Probably bad practice to have single quotes within more single quotes but ran into issues with yt-dlp over using double quotes. -Ryan --- .local/bin/dmenuhandler | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 1c48f3ac..1cd1b297 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -10,7 +10,8 @@ case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;; - "queue yt-dlp audio") qndl "$feed" 'yt-dlp --embed-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; + "queue yt-dlp audio") qndl "$feed" 'yt-dlp -o '%(title)s.%(ext)s' -f bestaudio --embed-metadata --restrict-filenames' +' >/dev/null 2>&1 ;; "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; From 7871fd80b29afa3fbab9bbecd6092b303b07c29f Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Tue, 20 Sep 2022 11:42:54 +0000 Subject: [PATCH 03/21] Make otp script more secure + other improvements (#1190) Make a temporary directory in $XDG_RUNTIME_DIR instead of $PASSWORD_STORE_DIR. $XDG_RUNTIME_DIR defaults to /run/user/$uid/. This directory has the security advantage of only being readable and writable by the current user and being mounted in RAM, causing the screenshot to be fully wiped on shutdown and not needing shred, which doesn't work reliably on SSD's. Also quoted $dir, for the off chance someone has spaces in their $PASSWORD_STORE_DIR. Removed the check for xclip and the $issuer and $name variables, as they are unused. If you're wondering why echo is piped into dmenu, on my system dmenu hung when called without the pipe, causing the whole script to freeze. --- .local/bin/otp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.local/bin/otp b/.local/bin/otp index 1726b1a6..a40c1984 100755 --- a/.local/bin/otp +++ b/.local/bin/otp @@ -13,27 +13,25 @@ ifinstalled pass pass-otp dir="${PASSWORD_STORE_DIR}" -choice="$({ echo "πŸ†•add" ; echo "πŸ•™sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")" +choice="$({ echo "πŸ†•add" ; echo "πŸ•™sync-time" ; ls "$dir"/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")" case $choice in πŸ†•add ) - ifinstalled maim zbar xclip || exit 1 + ifinstalled maim zbar || exit 1 - temp="$dir/temp.png" + temp=$(mktemp -p "$XDG_RUNTIME_DIR" --suffix=.png) otp="otp-test-script" - trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT + trap 'rm -f $temp; pass rm -f $otp' HUP INT QUIT TERM PWR EXIT notify-send "Scan the image." "Scan the OTP QR code." maim -s "$temp" || exit 1 info="$(zbarimg -q "$temp")" info="${info#QR-Code:}" - issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")" - name="${issuer#issuer=}" if echo "$info" | pass otp insert "$otp"; then while true ; do - export name="$(dmenu -p "Give this One Time Password a one-word name:")" + export name="$(echo | dmenu -p "Give this One Time Password a one-word name:")" echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break done pass mv "$otp" "$name-otp" @@ -41,7 +39,6 @@ case $choice in else notify-send "No OTP data found." "Try to scan the image again more precisely." fi - ;; πŸ•™sync-time ) ifinstalled ntp || exit 1 From 5ff7f70b64214beafc9146717d6a766d721b9786 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:50:58 +0000 Subject: [PATCH 04/21] otp: exit if pass or pass-otp are not installed (#1191) --- .local/bin/otp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/otp b/.local/bin/otp index a40c1984..7e471db5 100755 --- a/.local/bin/otp +++ b/.local/bin/otp @@ -9,7 +9,7 @@ # computer to have its time properly synced. This can be done with the command # below which requires the package `ntp`. -ifinstalled pass pass-otp +ifinstalled pass pass-otp || exit 1 dir="${PASSWORD_STORE_DIR}" From 41b729acd303ff1180ca2e1a9ab9e0b05a0e4c29 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:52:04 +0000 Subject: [PATCH 05/21] Fix tag script mp3 issue (#1182) * Fix tag script mp3 issue When you don't manually specify $total and $date with an mp3 file the eyeD3 command tries tagging with an empty variable, which causes it to error. This fixes it by only passing the parameter to the command if the variable is set. This pull request also adds support for the $genre and $comment variable. * Remove double backslash --- .local/bin/tag | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.local/bin/tag b/.local/bin/tag index 8462b99a..11a5b8ed 100755 --- a/.local/bin/tag +++ b/.local/bin/tag @@ -54,7 +54,11 @@ Total=$total Date=$date Genre=$genre Comment=$comment" | opustags -i -S "$file" ;; - *.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;; + *.mp3) eyeD3 -Q --remove-all -a "$artist" -t "$title" -A "$album" -n "$track" \ + ${total:+-N "$total"} \ + ${date:+-Y "$date"} \ + ${genre:+-G "$genre"} \ + ${comment:+-c "$comment"} "$file" ;; *.flac) echo "TITLE=$title ARTIST=$artist ALBUM=$album From 21e08299b1709c6051a42560ca89967894d5c962 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Fri, 23 Sep 2022 14:55:42 +0000 Subject: [PATCH 06/21] Use ffmpeg for tag script (#1193) eyeD3 got orphaned in the AUR, so I looked for an alternative. Apparently ffmpeg also supports the ability to tag audio files, so this pull request replaces all the helper applications with ffmpeg --- .local/bin/tag | 56 +++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/.local/bin/tag b/.local/bin/tag index 11a5b8ed..92d6323d 100755 --- a/.local/bin/tag +++ b/.local/bin/tag @@ -13,7 +13,7 @@ Options: -c: comment You will be prompted for title, artist, album and track if not given." && exit 1 ;} -while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in +while getopts "a:t:A:n:N:d:g:c:" o; do case "${o}" in a) artist="${OPTARG}" ;; t) title="${OPTARG}" ;; A) album="${OPTARG}" ;; @@ -22,7 +22,6 @@ while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in d) date="${OPTARG}" ;; g) genre="${OPTARG}" ;; c) comment="${OPTARG}" ;; - f) file="${OPTARG}" ;; *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;; esac done @@ -30,42 +29,21 @@ shift $((OPTIND - 1)) file="$1" -[ ! -f "$file" ] && echo "Provide file to tag." && err +temp="$(mktemp -p "$(dirname "$file")")" +trap 'rm -f $temp' HUP INT QUIT TERM PWR EXIT -[ -z "$title" ] && echo "Enter a title." && read -r title -[ -z "$artist" ] && echo "Enter an artist." && read -r artist -[ -z "$album" ] && echo "Enter an album." && read -r album -[ -z "$track" ] && echo "Enter a track number." && read -r track +[ ! -f "$file" ] && echo 'Provide file to tag.' && err -case "$file" in - *.ogg) echo "Title=$title -Artist=$artist -Album=$album -Track=$track -Total=$total -Date=$date -Genre=$genre -Comment=$comment" | vorbiscomment -w "$file" ;; - *.opus) echo "Title=$title -Artist=$artist -Album=$album -Track=$track -Total=$total -Date=$date -Genre=$genre -Comment=$comment" | opustags -i -S "$file" ;; - *.mp3) eyeD3 -Q --remove-all -a "$artist" -t "$title" -A "$album" -n "$track" \ - ${total:+-N "$total"} \ - ${date:+-Y "$date"} \ - ${genre:+-G "$genre"} \ - ${comment:+-c "$comment"} "$file" ;; - *.flac) echo "TITLE=$title -ARTIST=$artist -ALBUM=$album -TRACKNUMBER=$track -TOTALTRACKS=$total -DATE=$date -GENRE=$genre -DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;; - *) echo "File type not implemented yet." ;; -esac +[ -z "$title" ] && echo 'Enter a title.' && read -r title +[ -z "$artist" ] && echo 'Enter an artist.' && read -r artist +[ -z "$album" ] && echo 'Enter an album.' && read -r album +[ -z "$track" ] && echo 'Enter a track number.' && read -r track + +cp -f "$file" "$temp" && ffmpeg -i "$temp" -map 0 -y -codec copy \ + -metadata title="$title" \ + -metadata album="$album" \ + -metadata artist="$artist" \ + -metadata track="${track}${total:+/"$total"}" \ + ${date:+-metadata date="$date"} \ + ${genre:+-metadata genre="$genre"} \ + ${comment:+-metadata comment="$comment"} "$file" From 3901bc0f1b780e3bbb8cd8d66d2e19c62c01ce4d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 27 Sep 2022 21:32:47 -0400 Subject: [PATCH 07/21] set autoquit --- .config/lf/lfrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 1d529498..0d534568 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -24,6 +24,7 @@ set period 1 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" set cleaner '~/.config/lf/cleaner' set previewer '~/.config/lf/scope' +set autoquit on # cmds/functions cmd open ${{ From 2e7fc9cfb7f755a9c0341f9f9ae7263ba93911aa Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 29 Sep 2022 16:33:21 -0400 Subject: [PATCH 08/21] fix #1196 --- .local/bin/dmenuhandler | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 1cd1b297..0b3c7138 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -4,14 +4,13 @@ # some choice programs to use to open it. feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" -case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in - "Copy URL") echo "$feed" | xclip -selection clipboard ;; +case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in + "copy url") echo "$feed" | xclip -selection clipboard ;; mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;; - "queue yt-dlp audio") qndl "$feed" 'yt-dlp -o '%(title)s.%(ext)s' -f bestaudio --embed-metadata --restrict-filenames' -' >/dev/null 2>&1 ;; + "queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;; "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; From be7ed1516b6bb9f11fbdc1a1c82627a82544cff6 Mon Sep 17 00:00:00 2001 From: "M.Zeinali" Date: Fri, 30 Sep 2022 17:52:33 +0330 Subject: [PATCH 09/21] Add `s` to OPTARGS (#1174) --- .local/bin/slider | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/slider b/.local/bin/slider index 674781a4..3460c777 100755 --- a/.local/bin/slider +++ b/.local/bin/slider @@ -9,7 +9,7 @@ # Application cache if not stated elsewhere. cache="${XDG_CACHE_HOME:-$HOME/.cache}/slider" -while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in +while getopts "hvrpi:c:a:o:d:f:t:e:x:s:" o; do case "${o}" in c) bgc="$OPTARG" ;; t) fgc="$OPTARG" ;; f) font="$OPTARG" ;; From 1804d4c7f0d098517e741a134f9c0fa8583002fb Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:11:00 +0000 Subject: [PATCH 10/21] Delete prompt (#1200) --- .local/bin/prompt | 8 -------- 1 file changed, 8 deletions(-) delete mode 100755 .local/bin/prompt diff --git a/.local/bin/prompt b/.local/bin/prompt deleted file mode 100755 index 666434fb..00000000 --- a/.local/bin/prompt +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# A dmenu binary prompt script. -# Gives a dmenu prompt labeled with $1 to perform command $2. -# For example: -# `./prompt "Do you want to shutdown?" "shutdown -h now"` - -[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 From 92de5e82b365dc027bf10f1f28e77b5e784e9992 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:11:17 +0000 Subject: [PATCH 11/21] weatherreport is stored in cache (#1201) --- .config/shell/aliasrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 8273a2f1..0541d0f1 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -51,4 +51,4 @@ alias \ lf="lfub" \ magit="nvim -c MagitOnly" \ ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ - weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \ + weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \ From 7d7872b602adc8be021bf25b02f2372e87290aa2 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:22:00 +0000 Subject: [PATCH 12/21] Make sb-forecast and sb-moonphase more robust (#1198) * Make sb-forecast more robust * Make sb-moonphase more robust --- .local/bin/statusbar/sb-forecast | 2 +- .local/bin/statusbar/sb-moonphase | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 45584c52..af77d2c4 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -29,7 +29,7 @@ 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. -[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || +[ ! -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getforecast showweather diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase index fab8b4da..5eb1875c 100755 --- a/.local/bin/statusbar/sb-moonphase +++ b/.local/bin/statusbar/sb-moonphase @@ -4,7 +4,7 @@ moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" -[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || +[ ! -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} icon="$(cat "$moonfile")" From 28a57eb59ec33308ab0e835429e9a0dcb054d07e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 2 Oct 2022 15:25:29 -0400 Subject: [PATCH 13/21] volume bar more efficient --- .local/bin/statusbar/sb-volume | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index 3cfdc457..d17ce666 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -13,18 +13,26 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -[ $(pamixer --get-mute) = true ] && echo πŸ”‡ && exit +vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" -vol="$(pamixer --get-volume)" +# If muted, print πŸ”‡ and exit. +[ "$vol" != "${vol%\[MUTED\]}" ] && echo πŸ”‡ && exit -if [ "$vol" -gt "70" ]; then - icon="πŸ”Š" -elif [ "$vol" -gt "30" ]; then - icon="πŸ”‰" -elif [ "$vol" -gt "0" ]; then - icon="πŸ”ˆ" -else - echo πŸ”‡ && exit -fi +vol="${vol#Volume: }" +split() { + # For ommiting the . without calling and external program. + IFS=$2 + set -- $1 + printf '%s' "$@" +} +vol="$(split "$vol" ".")" +vol="${vol##0}" + +case 1 in + $((vol >= 70)) ) icon="πŸ”Š" ;; + $((vol >= 30)) ) icon="πŸ”‰" ;; + $((vol >= 1)) ) icon="πŸ”ˆ" ;; + * ) echo πŸ”‡ && exit ;; +esac echo "$icon$vol%" From b8234faadbe9df90676da79897bb6093dc690653 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 7 Oct 2022 11:57:01 -0400 Subject: [PATCH 14/21] close #1207 --- .local/bin/getbib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/getbib b/.local/bin/getbib index 8675aae8..1d56dc8d 100755 --- a/.local/bin/getbib +++ b/.local/bin/getbib @@ -4,7 +4,7 @@ if [ -f "$1" ]; then # Try to get DOI from pdfinfo or pdftotext output. doi=$(pdfinfo "$1" | grep -io "doi:.*") || - doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) || + doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:\s*\S*" -m 1) || exit 1 else doi="$1" From 228cc6cfdbdca5a04cc7e98289b447ab100d8133 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 7 Oct 2022 16:38:19 -0400 Subject: [PATCH 15/21] doi must terminate in alphanumeric char --- .local/bin/getbib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/getbib b/.local/bin/getbib index 1d56dc8d..bedc2568 100755 --- a/.local/bin/getbib +++ b/.local/bin/getbib @@ -4,7 +4,7 @@ if [ -f "$1" ]; then # Try to get DOI from pdfinfo or pdftotext output. doi=$(pdfinfo "$1" | grep -io "doi:.*") || - doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:\s*\S*" -m 1) || + doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:\s*\S\+[[:alnum:]]" -m 1) || exit 1 else doi="$1" From b1377913e65b0052ccd36329cb9b4c9d73f9f3d3 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sat, 8 Oct 2022 11:18:04 +0000 Subject: [PATCH 16/21] Fix forecast and moonphase (#1211) --- .local/bin/statusbar/sb-forecast | 2 +- .local/bin/statusbar/sb-moonphase | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index af77d2c4..9744ea42 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -29,7 +29,7 @@ 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')" ] || +[ -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getforecast showweather diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase index 5eb1875c..99adaee8 100755 --- a/.local/bin/statusbar/sb-moonphase +++ b/.local/bin/statusbar/sb-moonphase @@ -4,7 +4,7 @@ moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" -[ ! -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || +[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} icon="$(cat "$moonfile")" From 44d740bd44cff63ab74ca44a4b2fb9453d9adb59 Mon Sep 17 00:00:00 2001 From: Nicholas Gorden Date: Mon, 10 Oct 2022 14:27:40 +0000 Subject: [PATCH 17/21] Fix Sioux Falls (#1213) Sioux Falls is in South Dakota, not Iowa --- .local/bin/statusbar/sb-doppler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index b5833a7b..eef464bd 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -55,7 +55,7 @@ US: KUDX: Rapid City, SD US: KRIW: Riverton, WY US: KSGF: Springfield, MO US: KLSX: St. LOUIS, MO -US: KFSD: Sioux Falls, IA +US: KFSD: Sioux Falls, SD US: KTWX: Topeka, KS US: KICT: Wichita, KS US: KVWX: Paducah, KY From cc7ac4619a698459da2af57bea098f646a2f3d62 Mon Sep 17 00:00:00 2001 From: Rokosun <79040025+futureisfoss@users.noreply.github.com> Date: Sat, 15 Oct 2022 01:25:19 +0000 Subject: [PATCH 18/21] Make sd script work with lf file manager too (#1212) Now sd script can open a terminal window in the same directory as the currently active lf file manager window --- .local/bin/sd | 1 + 1 file changed, 1 insertion(+) diff --git a/.local/bin/sd b/.local/bin/sd index 371ec648..7e09bf6e 100755 --- a/.local/bin/sd +++ b/.local/bin/sd @@ -5,6 +5,7 @@ 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 "$TERMINAL" From d8b5f16c2008c8dda1c924b4cce9c553c3a4eab9 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 17 Oct 2022 09:09:59 -0400 Subject: [PATCH 19/21] lf previews with gnome-epub-thumbnailer --- .config/lf/scope | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/lf/scope b/.config/lf/scope index 180c2947..f91fd84b 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -38,6 +38,11 @@ case "$(file --dereference --brief --mime-type -- "$1")" in [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + */epub+zip|*/mobi*) + 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.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; *opendocument*) odt2txt "$1" ;; application/pgp-encrypted) gpg -d -- "$1" ;; esac From 130e200da13b9322bddd89381a39ed0406a01b4b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 21 Oct 2022 07:49:40 -0400 Subject: [PATCH 20/21] url update, add cont-us, non-wide char for doppler --- .local/bin/statusbar/sb-doppler | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index eef464bd..7573c98b 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -6,7 +6,8 @@ secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs s radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" -pickloc() { chosen="$(echo "US: Northeast +pickloc() { chosen="$(echo "US: CONUS: Continental United States +US: Northeast US: Southeast US: PacNorthWest US: PacSouthWest @@ -255,7 +256,7 @@ getdoppler() { loc=$(cut -c 4- "$radarloc") notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc." case "$cont" in - "US") curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;; + "US") curl -sL "https://radar.weather.gov/ridge/standard/${loc}_loop.gif" > "$doppler" ;; "EU") curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ;; "AF") curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ;; "DE") loc="$(echo "$loc" | tr "[:upper:]" "[:lower:]")" @@ -276,4 +277,4 @@ After $secs seconds, new clicks will also automatically update the doppler RADAR 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -echo πŸ—ΊοΈ +echo πŸŒ… From eaf4c12ee2647a2c4cbca5f3aed63a04ddf0e097 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 26 Oct 2022 16:28:38 -0400 Subject: [PATCH 21/21] fix #1219 --- .local/bin/getbib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/getbib b/.local/bin/getbib index bedc2568..121dd6ee 100755 --- a/.local/bin/getbib +++ b/.local/bin/getbib @@ -4,7 +4,7 @@ if [ -f "$1" ]; then # Try to get DOI from pdfinfo or pdftotext output. doi=$(pdfinfo "$1" | grep -io "doi:.*") || - doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:\s*\S\+[[:alnum:]]" -m 1) || + doi=$(pdftotext "$1" 2>/dev/null - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') || exit 1 else doi="$1"