|
|
@@ -1,39 +1,28 @@
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
-# Kill any existing swaybg or feh instances
|
|
|
-pkill swaybg
|
|
|
-pkill feh
|
|
|
-
|
|
|
-# 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'"
|
|
|
+# Initialize swww daemon if not running
|
|
|
+if ! pgrep -x "swww-daemon" >/dev/null; then
|
|
|
+ swww-daemon &
|
|
|
+ sleep 1
|
|
|
+fi
|
|
|
+
|
|
|
+# 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
|
|
|
-
|
|
|
- # Execute the command
|
|
|
- eval "$cmd"
|
|
|
-}
|
|
|
-
|
|
|
-set_wallpaper_sway
|
|
|
+ ;;
|
|
|
+"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
|
|
|
+
|
|
|
+wait
|