diff options
35 files changed, 170 insertions, 90 deletions
diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf index 6ac7b58..a91f201 100644 --- a/.config/fontconfig/fonts.conf +++ b/.config/fontconfig/fonts.conf @@ -33,7 +33,7 @@ <prefer> <family>Terminus</family> <family>Noto Sans Mono</family> - <family>Liberation Mono</family> + <family>Libertinus Mono</family> <family>FontAwesome</family> <family>Braille</family> </prefer> diff --git a/.config/lf/lfrc b/.config/lf/lfrc index b904b8f..e104591 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -24,7 +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 +set autoquit true # cmds/functions cmd open ${{ @@ -45,12 +45,7 @@ cmd open ${{ video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; - application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; - application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;; + application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; esac }} @@ -63,7 +58,22 @@ cmd extract ${{ printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans - [ $ans = "y" ] && aunpack $fx + [ $ans = "y" ] && { + case $fx in + *.tar.bz2) tar xjf $fx ;; + *.tar.gz) tar xzf $fx ;; + *.bz2) bunzip2 $fx ;; + *.rar) unrar e $fx ;; + *.gz) gunzip $fx ;; + *.tar) tar xf $fx ;; + *.tbz2) tar xjf $fx ;; + *.tgz) tar xzf $fx ;; + *.zip) unzip $fx ;; + *.Z) uncompress $fx ;; + *.7z) 7z x $fx ;; + *.tar.xz) tar xf $fx ;; + esac + } }} cmd delete ${{ @@ -98,7 +108,27 @@ cmd copyto ${{ }} cmd setbg "$1" -cmd bulkrename $vidir + +cmd bulkrename ${{ + tmpfile_old="$(mktemp)" + tmpfile_new="$(mktemp)" + + [ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls) + + echo "$fs" > "$tmpfile_old" + echo "$fs" > "$tmpfile_new" + $EDITOR "$tmpfile_new" + + [ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; } + + paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst + do + [ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst" + done + + rm -f "$tmpfile_old" "$tmpfile_new" + lf -remote "send $id unselect" +}} # Bindings map <c-f> $lf -remote "send $id select \"$(fzf)\"" @@ -118,11 +148,11 @@ map X !$f map o &mimeopen "$f" map O $mimeopen --ask "$f" -map A rename # at the very end +map A :rename; cmd-end # at the very end map c push A<c-u> # new rename -map I push A<c-a> # at the very beginning -map i push A<a-b><a-b><a-f> # before extension -map a push A<a-b> # after extension +map I :rename; cmd-home # at the very beginning +map i :rename # before extension +map a :rename; cmd-right # after extension map B bulkrename map b $setbg $f diff --git a/.config/lf/scope b/.config/lf/scope index 87b560a..cc55669 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -25,10 +25,14 @@ 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/vnd.djvu) + 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" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1 + 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 ;; - text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; + text/* | */xml | application/json | application/x-ndjson) bat --terminal-width "$(($4-2))" -f "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" diff --git a/.config/mimeapps.list b/.config/mimeapps.list index 30988cc..9124fce 100644 --- a/.config/mimeapps.list +++ b/.config/mimeapps.list @@ -15,5 +15,6 @@ image/jpeg=img.desktop; image/gif=img.desktop; application/rss+xml=rss.desktop video/x-matroska=video.desktop +video/mp4=video.desktop x-scheme-handler/lbry=lbry.desktop inode/directory=file.desktop diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index a89ba15..279a03d 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -41,3 +41,5 @@ progressbar_color = black:b progressbar_elapsed_color = blue:b statusbar_color = red statusbar_time_color = cyan:b +execute_on_song_change="pkill -RTMIN+11 dwmblocks" +execute_on_player_state_change="pkill -RTMIN+11 dwmblocks" diff --git a/.config/newsboat/urls b/.config/newsboat/urls index 8de7793..497e494 100644 --- a/.config/newsboat/urls +++ b/.config/newsboat/urls @@ -6,6 +6,5 @@ https://notrelated.xyz/rss https://landchad.net/rss.xml https://based.cooking/index.xml https://artixlinux.org/feed.php "tech" -https://www.archlinux.org/feeds/news "tech" -https://sheriffmediocre.xyz/rss.xml -https://lukebubar.xyz/rss.xml +https://www.archlinux.org/feeds/news/ "tech" +https://github.com/LukeSmithxyz/voidrice/commits/master.atom "~LARBS dotfiles" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 09ffdb4..255ca27 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -121,6 +121,8 @@ set noshowcmd autocmd BufWritePre * let currPos = getpos(".") autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\n\+\%$//e + autocmd BufWritePre *.[ch] %s/\%$/\r/e " add trailing newline for ANSI C standard + autocmd BufWritePre *neomutt* %s/^--$/-- /e " dash-dash-space signature delimiter in emails autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) " When shortcut files are updated, renew bash and ranger configs with new material: diff --git a/.config/shell/bm-files b/.config/shell/bm-files index 7acbb66..2e8864b 100644 --- a/.config/shell/bm-files +++ b/.config/shell/bm-files @@ -20,4 +20,4 @@ cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings # ncmpcpp (music player) cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config # ncmpcpp (music player) config cfl ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc # lf (file browser) config cfL ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope # lf's scope/preview file -cfX ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler # sxiv (image viewer) key/script handler +cfX ${XDG_CONFIG_HOME:-$HOME/.config}/nsxiv/exec/key-handler # nsxiv (image viewer) key/script handler diff --git a/.config/shell/profile b/.config/shell/profile index 78a1fe0..1eae7d7 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -16,6 +16,10 @@ export TERMINAL="st" export TERMINAL_PROG="st" export BROWSER="librewolf" +# Change the default crypto/weather monitor sites. +# export CRYPTOURL="rate.sx" +# export WTTRURL="wttr.in" + # ~/ Clean-up: export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" @@ -35,6 +39,7 @@ export TMUX_TMPDIR="$XDG_RUNTIME_DIR" export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android" export CARGO_HOME="$XDG_DATA_HOME/cargo" export GOPATH="$XDG_DATA_HOME/go" +export GOMODCACHE="$XDG_CACHE_HOME/go/mod" export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg" export UNISON="$XDG_DATA_HOME/unison" export HISTFILE="$XDG_DATA_HOME/history" diff --git a/.config/sxiv b/.config/sxiv new file mode 120000 index 0000000..4252964 --- /dev/null +++ b/.config/sxiv @@ -0,0 +1 @@ +nsxiv
\ No newline at end of file diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 2debc01..e99da8c 100755 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -13,5 +13,6 @@ if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then else . "$HOME/.xprofile" fi - +# Activate dbus variables +dbus-update-activation-environment --all ssh-agent dwm diff --git a/.config/x11/xprofile b/.config/x11/xprofile index 60a47da..58dd00f 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -12,7 +12,7 @@ screenset & # sets the screen resolution and starts picom autostart="mpd dunst unclutter pipewire remapd" for program in $autostart; do - pidof -s "$program" || "$program" & + pidof -sx "$program" || "$program" & done >/dev/null 2>&1 # Ensure that xrdb has finished running before moving on to start the WM/DE. diff --git a/.local/bin/arkenfox-auto-update b/.local/bin/arkenfox-auto-update index 05f4ca7..7664a4f 100755 --- a/.local/bin/arkenfox-auto-update +++ b/.local/bin/arkenfox-auto-update @@ -16,5 +16,8 @@ IFS=' # Update each found profile. for profile in $profiles; do - arkenfox-updater -p "${profile%%/user.js*}" -s + userjs=${profile%%/user.js*} + user=$(stat -c '%U' "$userjs") || continue + + su -l "$user" -c "arkenfox-updater -c -p $userjs -s" done diff --git a/.local/bin/booksplit b/.local/bin/booksplit index a6845f7..079d85f 100755 --- a/.local/bin/booksplit +++ b/.local/bin/booksplit @@ -12,7 +12,7 @@ inputaudio="$1" ext="${1##*.}" # Get a safe file name from the book. -escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" +escbook="$(echo "$booktitle" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" ! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && @@ -31,7 +31,7 @@ do cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -metadata total=\"$total\" -ss \"$start\" -to \"$end\" -vn -c:a copy \"$file\" " fi title="$(echo "$x" | cut -d' ' -f2-)" - esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" + esctitle="$(echo "$title" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" track="$((track+1))" start="$end" done < "$2" diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 0b3c713..e50178a 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -2,9 +2,9 @@ # Feed this script a link and it will give dmenu # some choice programs to use to open it. -feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" +feed="${1:-$(true | 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 +case "$(printf "copy url\\nnsxiv\\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 ;; @@ -13,7 +13,7 @@ case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv "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 ;; + nsxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord index 990b7b3..ca6b011 100755 --- a/.local/bin/dmenurecord +++ b/.local/bin/dmenurecord @@ -9,7 +9,7 @@ # # 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" ;} +getdim() { xrandr | grep -oP '(?<=current ).*(?=,)' | tr -d ' ' ;} updateicon() { \ echo "$1" > /tmp/recordingicon diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode index 704c809..dd12bc3 100755 --- a/.local/bin/dmenuunicode +++ b/.local/bin/dmenuunicode @@ -13,6 +13,6 @@ chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -i -l 30 | sed "s/ if [ -n "$1" ]; then xdotool type "$chosen" else - printf "$chosen" | xclip -selection clipboard + printf "%s" "$chosen" | xclip -selection clipboard notify-send "'$chosen' copied to clipboard." & fi diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index f62b581..d372d84 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -1,7 +1,7 @@ #!/bin/sh # Feed script a url or file location. -# If an image, it will view in sxiv, +# If an image, it will view in nsxiv, # if a video or gif, it will view in mpv # if a music file or pdf, it will download, # otherwise it opens link in browser. @@ -15,8 +15,8 @@ fi case "$url" in *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; - *png|*jpg|*jpe|*jpeg|*gif) - curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *png|*jpg|*jpe|*jpeg|*gif|*webp) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; *pdf|*cbz|*cbr) curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) diff --git a/.local/bin/mounter b/.local/bin/mounter index b532e08..756d04d 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -36,7 +36,7 @@ filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6 unopenedluks="$(for drive in $allluks; do uuid="${drive%% *}" uuid="${uuid//-}" # This is a bashism. - for open in $decrypted; do + [ -n "$decrypted" ] && for open in $decrypted; do [ "$uuid" = "$open" ] && break 1 done && continue 1 echo "🔒 $drive" diff --git a/.local/bin/rotdir b/.local/bin/rotdir index 86da6db..d171f29 100755 --- a/.local/bin/rotdir +++ b/.local/bin/rotdir @@ -1,11 +1,11 @@ #!/bin/sh -# When I open an image from the file manager in sxiv (the image viewer), I want +# When I open an image from the file manager in nsxiv (the image viewer), I want # to be able to press the next/previous keys to key through the rest of the # images in the same directory. This script "rotates" the content of a # directory based on the first chosen file, so that if I open the 15th image, # if I press next, it will go to the 16th etc. Autistic, I know, but this is -# one of the reasons that sxiv is great for being able to read standard input. +# one of the reasons that nsxiv is great for being able to read standard input. [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 base="$(basename "$1")" diff --git a/.local/bin/setbg b/.local/bin/setbg index 281bc36..44945f3 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -13,11 +13,18 @@ bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg" dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" +# Give -s as parameter to make notifications silent. +while getopts "s" o; do case "${o}" in + s) silent='1' ;; +esac done + +shift $((OPTIND - 1)) + trueloc="$(readlink -f "$1")" && case "$(file --mime-type -b "$trueloc")" in - image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;; - inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;; - *) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;; + image/* ) ln -sf "$trueloc" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Changing wallpaper..." ;; + inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Random Wallpaper chosen." ;; + *) [ -z "$silent" ] && notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;; esac # If pywal is installed, use it. diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index 488d2b4..940fefc 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -19,7 +19,7 @@ case "$clock" in esac case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s|..27m|</span></b>|")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; 2) setsid -f "$TERMINAL" -e calcurse ;; 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 2a6440b..d8a16aa 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -3,10 +3,11 @@ # Displays today's precipication chance (☔), and daily low (🥶) and high (🌞). # Usually intended for the statusbar. +url="${WTTRURL:-wttr.in}" weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" # Get a weather report from 'wttr.in' and save it locally. -getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1; } +getforecast() { timeout --signal=1 2s curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; } # Forecast should be updated only once a day. checkforecast() { @@ -37,7 +38,7 @@ showweather() { } case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; + 1) setsid -f "$TERMINAL" -e less -Sf "$weatherreport" ;; 2) getforecast && showweather ;; 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index 94b7da2..5440a52 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -17,10 +17,17 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then +# Wifi +if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" -elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then - grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ " +elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then + [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ " fi -printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" +# Ethernet +[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="🌐" || ethericon="❎" + +# TUN +[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon=" 🔒" + +printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon" diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate index 02adab8..a9043e3 100755 --- a/.local/bin/statusbar/sb-iplocate +++ b/.local/bin/statusbar/sb-iplocate @@ -5,6 +5,11 @@ # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoip" || exit -addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" +set -e + +ifinstalled "geoip" +addr="$(geoiplookup "$(curl -sfm 1 ifconfig.me 2>/dev/null)")" +name="${addr##*, }" +flag="$(grep "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")" +flag="${flag%% *}" +printf "%s %s\\n" "$flag" "$name" diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox index 2132184..88522f2 100755 --- a/.local/bin/statusbar/sb-mailbox +++ b/.local/bin/statusbar/sb-mailbox @@ -4,7 +4,7 @@ # When clicked, brings up `neomutt`. case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e neomutt ;; + 1) setsid -w -f "$TERMINAL" -e neomutt; pkill -RTMIN+12 "${STATUSBAR:-dwmblocks}" ;; 2) setsid -f mw -Y >/dev/null ;; 3) notify-send "📬 Mail module" "\- Shows unread mail - Shows 🔃 if syncing mail diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music index d164b4b..266b916 100755 --- a/.local/bin/statusbar/sb-music +++ b/.local/bin/statusbar/sb-music @@ -1,6 +1,6 @@ #!/bin/sh -filter() { sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} +filter() { sed "/^volume:/d;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price index 42c84c1..f95c815 100755 --- a/.local/bin/statusbar/sb-price +++ b/.local/bin/statusbar/sb-price @@ -1,37 +1,44 @@ #!/bin/sh # Usage: -# price <url> <Name of currency> <icon> <Price to show in> -# price bat "Basic Attention Token" 🦁 +# price <currency-base currency> <name of currency> <icon> <signal> +# price bat-btc "Basic Attention Token" 🦁 24 +# This will give the price of BAT denominated in BTC and will update on +# signal 24. # When the name of the currency is multi-word, put it in quotes. -[ -z "$3" ] && exit 1 +[ -z "$1" ] && exit 1 -# use $4 as currency, if not passed in use "usd" as default -currency="${4:-usd}" +url="${CRYPTOURL:-rate.sx}" +target="${1%%-*}" +denom="${1##*-}" +name="${2:-$1}" +icon="${3:-💰}" +case "$denom" in + "$target"|usd) denom="usd"; symb="$" ;; + gbp) symb="£" ;; + eur) symb="€" ;; + btc) symb="" ;; +esac interval="@14d" # History contained in chart preceded by '@' (7d = 7 days) -dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" -pricefile="$dir/$1-$currency" -chartfile="$dir/$1-$currency-chart" - -updateprice() { temp="$(mktemp)" - curl -s "$currency.rate.sx/1$1" > "$temp" && - mv -f "$temp" "$pricefile" && - curl -s "$currency.rate.sx/$1$interval" > "$temp" && - mv -f "$temp" "$chartfile" ;} +dir="${XDG_CACHE_HOME:-$HOME/.cache}/crypto-prices" +pricefile="$dir/$target-$denom" +chartfile="$dir/$target-$denom-chart" +filestat="$(stat -c %x "$pricefile" 2>/dev/null)" [ -d "$dir" ] || mkdir -p "$dir" -[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - updateprice "$1" +updateprice() { curl -sf -m 1 --fail-early $denom.$url/{1$target,$target$interval} --output "$pricefile" --output "$chartfile" || + rm -f "$pricefile" "$chartfile" ;} + +[ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] && + updateme="1" case $BLOCK_BUTTON in 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;; - 2) notify-send -u low "$3 Updating..." "Updating $2 price..." - updateprice "$1" && notify-send "$3 Update complete." "$2 price is now -\$$(cat "$pricefile")" ;; - 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" - notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b> + 2) notify-send -u low "$icon Updating..." "Updating $name price..." ; updateme="1" ; showupdate="1" ;; + 3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")" + notify-send "$icon $name module" "\- <b>Exact price: \$$(cat "$pricefile")</b> - Left click for chart of changes. - Middle click to update. - Shows 🔃 if updating prices. @@ -40,11 +47,10 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -case "$currency" in - usd) symb="$" ;; - gbp) symb="£" ;; - eur) symb="€" ;; - btc) symb="₿" ;; -esac +[ -n "$updateme" ] && + updateprice "$target" && + [ -n "$showupdate" ] && + notify-send "$icon Update complete." "$name price is now +\$$(cat "$pricefile")" -printf "$3$symb%0.2f$after" "$(cat "$pricefile")" +[ -f "$pricefile" ] && printf "%s%s%0.2f" "$icon" "$symb" "$(cat "$pricefile")" diff --git a/.local/bin/statusbar/sb-torrent b/.local/bin/statusbar/sb-torrent index 6527005..08c9173 100755 --- a/.local/bin/statusbar/sb-torrent +++ b/.local/bin/statusbar/sb-torrent @@ -11,9 +11,9 @@ transmission-remote -l | grep % | sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' - case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e tremc ;; + 1) setsid -f "$TERMINAL" -e stig ;; 2) td-toggle ;; - 3) notify-send "🌱 Torrent module" "\- Left click to open tremc. + 3) notify-send "🌱 Torrent module" "\- Left click to open stig. - Middle click to toggle transmission. - Shift click to edit script. Module shows number of torrents: diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index acdf7a9..fa0abcd 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -3,7 +3,7 @@ # Prints the current volume or 🔇 if muted. case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; + 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; diff --git a/.local/bin/tutorialvids b/.local/bin/tutorialvids index 8d1dc47..1bac3df 100755 --- a/.local/bin/tutorialvids +++ b/.local/bin/tutorialvids @@ -8,7 +8,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 -sxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2 +sxiv/nsxiv (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 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 diff --git a/.local/bin/xdg-terminal-exec b/.local/bin/xdg-terminal-exec new file mode 100755 index 0000000..12b18ff --- /dev/null +++ b/.local/bin/xdg-terminal-exec @@ -0,0 +1,3 @@ +#!/bin/sh + +"$TERMINAL" -e "$@" diff --git a/.local/share/applications/video.desktop b/.local/share/applications/video.desktop new file mode 100644 index 0000000..a29a0b1 --- /dev/null +++ b/.local/share/applications/video.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Video viewer +Exec=/usr/bin/mpv -quiet %f diff --git a/.local/share/larbs/getkeys/sxiv b/.local/share/larbs/getkeys/nsxiv index df5cb1e..176a65a 100644 --- a/.local/share/larbs/getkeys/sxiv +++ b/.local/share/larbs/getkeys/nsxiv @@ -1,9 +1,8 @@ - _ - _____ _(_)_ __ -/ __\ \/ / \ \ / / -\__ \> <| |\ V / -|___/_/\_\_| \_/ -sxiv is the image viewer. + _ __ _____ _(_)_ __ +| '_ \/ __\ \/ / \ \ / / +| | | \__ \> <| |\ V / +|_| |_|___/_/\_\_| \_/ +nsxiv is the image viewer. h/j/k/l - Pan image -/+ - Zoom out/in Enter - Toggle thumbnail mode @@ -12,4 +11,4 @@ sxiv is the image viewer. r - Reload image if changed m - Mark/unmark image w - Zoom to fit window - ctrl-x - Run external command (see ~/.config/sxiv/exec/key-handler for options) + ctrl-x - Run external command (see ~/.config/nsxiv/exec/key-handler for options) @@ -9,7 +9,7 @@ These are the dotfiles deployed by [LARBS](https://larbs.xyz) and as seen on - zsh (shell) - lf (file manager) - mpd/ncmpcpp (music) - - sxiv (image/gif viewer) + - nsxiv (image/gif viewer) - mpv (video player) - other stuff like xdg default programs, inputrc and more, etc. - I try to minimize what's directly in `~` so: |