From beceab7fb97654483b5d505ee6d251b206143aed Mon Sep 17 00:00:00 2001 From: Don Williams Date: Fri, 24 Jul 2026 17:04:04 -0400 Subject: copy.sh was enablling lua workflow Added additional checks Signed-off-by: Don Williams 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 --- config/hypr/scripts/WallpaperDaemon.sh | 50 ++++++++++++++++++++++++++++++++-- config/hypr/scripts/WaybarStartup.sh | 44 ++++++++++++++++++++++-------- 2 files changed, 81 insertions(+), 13 deletions(-) (limited to 'config/hypr/scripts') 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 diff --git a/config/hypr/scripts/WaybarStartup.sh b/config/hypr/scripts/WaybarStartup.sh index 5691c86b..575a7a2b 100755 --- a/config/hypr/scripts/WaybarStartup.sh +++ b/config/hypr/scripts/WaybarStartup.sh @@ -10,10 +10,32 @@ runtime_dir="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" export XDG_RUNTIME_DIR="$runtime_dir" +SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts" is_waybar_running() { pgrep -x "waybar" >/dev/null 2>&1 || pgrep -x '\.waybar-wrapped' >/dev/null 2>&1 } +wait_for_waybar() { + for _ in $(seq 1 30); do + is_waybar_running && return 0 + sleep 0.1 + done + return 1 +} +ensure_wallust_waybar_colors() { + local colors_file="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css" + [ -s "$colors_file" ] && return 0 + + if [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then + "$SCRIPTSDIR/WallustSwww.sh" >/dev/null 2>&1 || true + fi + + for _ in $(seq 1 40); do + [ -s "$colors_file" ] && return 0 + sleep 0.1 + done + return 1 +} sync_portal_env() { if command -v dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment --systemd \ @@ -68,12 +90,14 @@ wait_for_wayland() { start_waybar_direct() { if command -v waybar >/dev/null 2>&1; then waybar >/dev/null 2>&1 & - return 0 + wait_for_waybar + return $? fi if command -v .waybar-wrapped >/dev/null 2>&1; then .waybar-wrapped >/dev/null 2>&1 & - return 0 + wait_for_waybar + return $? fi return 1 @@ -87,8 +111,7 @@ start_waybar_via_systemd() { [ -n "$load_state" ] && [ "$load_state" != "not-found" ] || return 1 systemctl --user start waybar.service >/dev/null 2>&1 || return 1 - sleep 0.4 - is_waybar_running + wait_for_waybar } main() { @@ -97,18 +120,17 @@ main() { wait_for_wayland || true sync_portal_env start_portal_services || true + ensure_wallust_waybar_colors || true is_waybar_running && exit 0 - if start_waybar_via_systemd; then + if start_waybar_via_systemd || start_waybar_direct; then exit 0 fi - - if is_waybar_running; then - exit 0 - fi - - start_waybar_direct || exit 1 + # One retry after attempting to refresh wallust templates. + ensure_wallust_waybar_colors || true + sleep 0.3 + start_waybar_via_systemd || start_waybar_direct || exit 1 } main -- cgit v1.2.3