mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Merge branch 'LukeSmithxyz:master' into profile-cleanup
This commit is contained in:
commit
aa92a85126
@ -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 ${{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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" \
|
||||
|
||||
@ -4,13 +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 --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' ;;
|
||||
"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 ;;
|
||||
|
||||
@ -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 - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
|
||||
@ -9,31 +9,29 @@
|
||||
# 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}"
|
||||
|
||||
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
|
||||
|
||||
@ -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
|
||||
@ -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"
|
||||
|
||||
@ -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" ;;
|
||||
|
||||
@ -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
|
||||
@ -55,7 +56,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
|
||||
@ -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 🌅
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")"
|
||||
|
||||
@ -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%"
|
||||
|
||||
@ -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,38 +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" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user