39 lines
1.1 KiB
Bash
Executable file
39 lines
1.1 KiB
Bash
Executable file
#!/bin/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/forbi/Pictures/nord-balloons.png"
|
|
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'"
|
|
done
|
|
|
|
# Execute the command
|
|
eval "$cmd"
|
|
}
|
|
|
|
set_wallpaper_sway
|