diff --git a/.zshrc b/.zshrc index 3e4ccb4..18a53d3 100644 --- a/.zshrc +++ b/.zshrc @@ -147,6 +147,7 @@ unset key # https://unix.stackexchange.com/questions/608842/zshrc-export-gpg-tty-tty-says-not-a-tty export GPG_TTY=$TTY +alias uvenv='source .venv/bin/activate' alias noproxy='env -u http_proxy -u https_proxy' export NVM_DIR="$HOME/.nvm" diff --git a/bin/chbg b/bin/chbg index f4eee24..69b5feb 100755 --- a/bin/chbg +++ b/bin/chbg @@ -2,22 +2,21 @@ # to change wallpapers both niri workspace and niri tab view [ -z "$1" ] && { echo "Usage: $0 "; exit 1; } -WP_DIR="$HOME/.local/share" +WP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}" finput=$1 -fw=$(magick identify -format "%w\n" $1) -fh=$(magick identify -format "%h\n" $1) -if [[ $((fw)) > 3840 && $((fh)) > 2160 ]] -then - finput="/tmp/${finput##*/}" +read -r fw fh < <(magick identify -format "%w %h" -- "$1") +(( fw > 3840 && fh > 2160 )) && { + finput="${XDG_CACHE_HOME:-$HOME/.cache}/${finput##*/}" echo "WARNING: image too large, resizing ..." magick $1 -resize "3840x2160^" $finput -fi +} echo -n "making blurred version of $finput ... " mkdir -p $WP_DIR cp $finput $WP_DIR/.wallpaper magick $WP_DIR/.wallpaper -filter Gaussian -blur 0x30 $WP_DIR/.wallpaper_blur +[[ $finput == "${XDG_CACHE_HOME:-$HOME/.cache}"* ]] && rm -f $finput echo "Done." swww img $WP_DIR/.wallpaper