diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-07-10 11:21:24 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-07-10 11:21:24 -0700 |
| commit | 24de2a31a52d17b6f7214197bdbfeab7428742dd (patch) | |
| tree | f7736c4712d5a394525a3da2f2b4294e81ba9540 /config/hypr/scripts/WallpaperAutoChange.sh | |
| parent | 861bf5be200bfcf2440fec4cda911d29ec18493f (diff) | |
| parent | bca86bbec4757cec1f6f5bdea2ed210542f10fae (diff) | |
Merge remote-tracking branch 'upstream'
Diffstat (limited to 'config/hypr/scripts/WallpaperAutoChange.sh')
| -rwxr-xr-x | config/hypr/scripts/WallpaperAutoChange.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/config/hypr/scripts/WallpaperAutoChange.sh b/config/hypr/scripts/WallpaperAutoChange.sh new file mode 100755 index 00000000..a12e90d8 --- /dev/null +++ b/config/hypr/scripts/WallpaperAutoChange.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# ================================================== +# KoolDots (2026) +# Project URL: https://github.com/LinuxBeginnings +# License: GNU GPLv3 +# SPDX-License-Identifier: GPL-3.0-or-later +# ================================================== +# source https://wiki.archlinux.org/title/Hyprland#Using_a_script_to_change_wallpaper_every_X_minutes + +# This script will randomly go through the files of a directory, setting it +# up as the wallpaper at regular intervals +# +# NOTE: this script uses bash (not POSIX shell) for the RANDOM variable + +wallust_refresh=${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts/RefreshNoWaybar.sh +SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts" +# shellcheck source=/dev/null +. "$SCRIPTSDIR/WallpaperCmd.sh" + +focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}') +wallpaper_base="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallpaper_effects/.wallpaper_base_${focused_monitor}" + +if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then + echo "Usage: + $0 <dir containing images>" + exit 1 +fi + +# Edit below to control the images transition (swww/awww) +export SWWW_TRANSITION_FPS=60 +export SWWW_TRANSITION_TYPE=simple + +# This controls (in seconds) when to switch to the next image +INTERVAL=1800 + +while true; do + find "$1" \ + | while read -r img; do + echo "$((RANDOM % 1000)):$img" + done \ + | sort -n | cut -d':' -f2- \ + | while read -r img; do + resize_mode="$(wallpaper_resize_mode "$img" "$focused_monitor")" + "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$img" + mkdir -p "$(dirname "$wallpaper_base")" + cp -f "$img" "$wallpaper_base" || true + # Regenerate colors from the exact image path to avoid cache races + ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts/WallustSwww.sh "$img" + # Refresh UI components that depend on wallust output + $wallust_refresh + sleep $INTERVAL + + done +done |
