added creation of random wallpaper

This commit is contained in:
Hannes
2026-05-08 19:58:24 +02:00
parent e9331ba62d
commit 4a82b18433
9 changed files with 89 additions and 8 deletions
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
wallpapers_dir="$HOME/Pictures/Wallpapers/"
current_wallpaper=$(cat $wallpapers_dir"/Static/current")
# Pick a random wallpaper from the directory but not the current_wallpaper
image=$(find "$wallpapers_dir" -maxdepth 1 -type f ! -name "$(basename "$current_wallpaper")" | shuf -n 1)
echo "Image $image"
# 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
sed -i "3s|path = .*|path = ${image}|" ~/.config/hypr/hyprpaper.conf
hyprctl hyprpaper wallpaper ", $image"
echo "set Wallpaper to $image with hyprpaper"
fi
if [ -x "/usr/bin/matugen" ]; then
matugen image $image --mode dark --source-color-index 0
else
cp $HOME/.config/quickshell/colors/example_colors.qml $HOME/.config/quickshell/colors/Colors.qml
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"
if [ -x "/usr/bin/sddm" ]; then
magick $image -blur $blur $blurred_wp
else
cp $image $blurred_wp
fi
if [ -x "/usr/bin/sddm" ] && [ -d "/usr/share/backgrounds" ]; then
sddm_background="/usr/share/backgrounds/background.jpg"
cp "$image" "$sddm_background"
fi
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB