Files
aglab.dotfiles/bin/chbg
SilverAg.L fc8a0ee32a chbg: to shrink image when too large (i.e. bigger than 3840x2160).
- images too large may cause lagging, especially gtklock.
2025-11-09 02:56:04 +08:00

25 lines
685 B
Bash
Executable File

#!/bin/bash
# to change wallpapers both niri workspace and niri tab view
[ -z "$1" ] && { echo "Usage: $0 <image-file>"; exit 1; }
WP_DIR="$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##*/}"
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
echo "Done."
swww img $WP_DIR/.wallpaper
swww img $WP_DIR/.wallpaper_blur --namespace blur