Files
quickshell/modules/wp/set-wallpaper.sh
T

65 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Path to the image is the first argument
IMAGE="$1"
image_name=$(basename "$IMAGE")
image="$HOME/Pictures/Wallpapers/$image_name"
echo "start"
# Check if an image was provided
if [[ -z "$IMAGE" ]]; then
echo "Usage: $0 /path/to/image"
exit 1
fi
if [ -x "/usr/bin/swww-daemon" ]; then
echo "swww-daemon exists and is executable"
# Check if swww daemon is running
if ! pgrep -x "swww-daemon" > /dev/null; then
echo "Starting swww daemon..."
swww-daemon &
# Give the daemon a moment to start
sleep 0.2
echo "daemon started"
fi
# Set the wallpaper
echo "running"
swww img "$image" -t grow --transition-duration 1
elif [ -x "/usr/bin/hyprpaper" ]; then
echo "hyprpaper exists and is executable"
if ! pgrep -x "hyprpaper" > /dev/null; then
echo "Starting hyprpaper daemon..."
hyprpaper &
# Give the daemon a moment to start
sleep 0.2
echo "daemon started"
fi
hyprctl hyprpaper wallpaper ", $image"
fi
### Blured Wallpaper for wlogout
blur="50x30"
static_wallpaper_dir="$HOME/Pictures/Wallpapers/Static"
if [ ! -d $static_wallpaper_dir ]; then
mkdir -p $static_wallpaper_dir;
fi
current_wallpaper="$static_wallpaper_dir/current"
echo "$image" > $current_wallpaper
blurred_wp="$static_wallpaper_dir/blurred.jpg"
magick $image -blur $blur $blurred_wp
echo "test"