diff options
| author | Don Williams <don.e.williams@gmal.com> | 2026-07-24 17:04:04 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:41:34 -0700 |
| commit | beceab7fb97654483b5d505ee6d251b206143aed (patch) | |
| tree | 28993072f211310d366a2a0110fedc2c2ff47b07 /config/hypr/scripts/WallpaperDaemon.sh | |
| parent | 84ed728735d7d2d550675a072879e285a6ebf9f8 (diff) | |
copy.sh was enablling lua workflow
Added additional checks
Signed-off-by: Don Williams <don.e.williams@gmal.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: config/hypr/UserConfigs/01-UserDefaults.conf
modified: config/hypr/configs/Startup_Apps.conf
modified: config/hypr/lua/startup.lua
modified: config/hypr/scripts/WallpaperDaemon.sh
modified: config/hypr/scripts/WaybarStartup.sh
modified: config/rofi/.current_wallpaper
modified: copy.sh
modified: scripts/lib_copy.sh
Diffstat (limited to 'config/hypr/scripts/WallpaperDaemon.sh')
| -rwxr-xr-x | config/hypr/scripts/WallpaperDaemon.sh | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/config/hypr/scripts/WallpaperDaemon.sh b/config/hypr/scripts/WallpaperDaemon.sh index aeb6c397..4725bc6b 100755 --- a/config/hypr/scripts/WallpaperDaemon.sh +++ b/config/hypr/scripts/WallpaperDaemon.sh @@ -38,6 +38,32 @@ get_monitors() { fi } +wait_for_monitors() { + local monitors="" + for _ in {1..120}; do + monitors="$(get_monitors 2>/dev/null | awk 'NF')" + if [ -n "$monitors" ]; then + printf '%s\n' "$monitors" + return 0 + fi + sleep 0.1 + done + return 1 +} + +default_wallpaper_path() { + local pictures_dir wall_dir + pictures_dir="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" + wall_dir="$pictures_dir/wallpapers" + + [ -d "$wall_dir" ] || return 1 + + find -L "$wall_dir" -type f \( \ + -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o \ + -iname "*.gif" -o -iname "*.webp" -o -iname "*.tiff" \ + \) -print | LC_ALL=C sort | awk 'NR == 1 {print; exit}' +} + apply_wallpaper_for_monitor() { local monitor="$1" local per_monitor_link="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/.current_wallpaper_${monitor}" @@ -91,6 +117,11 @@ apply_wallpaper_for_monitor() { fi fi + # Final fallback: use the first available wallpaper from the wallpapers directory. + if [ -z "$wallpaper_path" ]; then + wallpaper_path="$(default_wallpaper_path 2>/dev/null || true)" + fi + if [ -n "$wallpaper_path" ] && [ -f "$wallpaper_path" ]; then local resize_mode resize_mode="$(wallpaper_resize_mode "$wallpaper_path" "$monitor")" @@ -98,10 +129,25 @@ apply_wallpaper_for_monitor() { sleep 0.3 "$WWW_CMD" img -o "$monitor" --resize "$resize_mode" "$wallpaper_path" >/dev/null 2>&1 & fi + printf '%s\n' "$wallpaper_path" + return 0 fi + + return 1 } +applied_wallpaper="" while read -r monitor; do [ -n "$monitor" ] || continue - apply_wallpaper_for_monitor "$monitor" -done < <(get_monitors) + applied_path="$(apply_wallpaper_for_monitor "$monitor" || true)" + if [ -z "$applied_wallpaper" ] && [ -n "$applied_path" ] && [ -f "$applied_path" ]; then + applied_wallpaper="$applied_path" + fi +done < <(wait_for_monitors || true) + +"$SCRIPTSDIR/RofiFocusedWallpaperLink.sh" >/dev/null 2>&1 || true + +waybar_colors="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css" +if [ ! -s "$waybar_colors" ] && [ -n "$applied_wallpaper" ] && [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then + "$SCRIPTSDIR/WallustSwww.sh" "$applied_wallpaper" >/dev/null 2>&1 || true +fi |
