dev: automated commit - 2025-10-01 20:05:45

This commit is contained in:
Mariano Z. 2025-10-01 20:05:45 -03:00
parent 8b08b8eccb
commit c011519bb0
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
5 changed files with 33 additions and 42 deletions

View file

@ -1,39 +1,28 @@
#!/usr/bin/env bash
# Kill any existing swaybg or feh instances
pkill swaybg
pkill feh
# Initialize swww daemon if not running
if ! pgrep -x "swww-daemon" >/dev/null; then
swww-daemon &
sleep 1
fi
# Function to set wallpaper using swaybg on Sway
set_wallpaper_sway() {
if [ "$(hostname)" == "main" ]; then
swaymsg -t get_outputs -r | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &'
elif [ "$(hostname)" == "fw" ]; then
swaybg -m fill -i "$HOME/Pictures/hwtioswoamne1.jpeg"
fi
}
# Function to set wallpaper using swaybg on Hyprland
set_wallpaper_hyprland() {
hyprctl monitors -j | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &'
}
# Function to set wallpaper using feh on i3
set_wallpaper_i3() {
# Count number of connected monitors
monitor_count=$(xrandr --query | grep " connected" | wc -l)
# Get random wallpapers equal to monitor count
readarray -t wallpapers < <(find ~/Pictures/* -type f | shuf -n "$monitor_count")
# Construct the feh command with multiple --bg-fill arguments
cmd="feh"
for wallpaper in "${wallpapers[@]}"; do
cmd+=" --bg-fill '$wallpaper'"
# Set wallpaper based on hostname
case "$(hostname)" in
"main")
# Get all outputs and set random wallpapers with transitions
swaymsg -t get_outputs -r | jq -r ".[].name" | while read -r output; do
random_wallpaper=$(find ~/Pictures/* -type f | shuf -n 1)
swww img "$random_wallpaper" --outputs "$output" --transition-type center --transition-step 120 --transition-fps 144 &
done
;;
"fw")
# Set specific wallpaper for fw host
swww img "$HOME/Pictures/hwtioswoamne1.jpeg" --transition-type center --transition-step 120 --transition-fps 144
;;
*)
echo "Unknown hostname: $(hostname)"
exit 1
;;
esac
# Execute the command
eval "$cmd"
}
set_wallpaper_sway
wait