diff --git a/iso-profiles/antergos/root-overlay/etc/skel/.config/autostart/antergos-wallpaper.desktop b/iso-profiles/antergos/root-overlay/etc/skel/.config/autostart/antergos-wallpaper.desktop new file mode 100644 index 0000000..ceb2b26 --- /dev/null +++ b/iso-profiles/antergos/root-overlay/etc/skel/.config/autostart/antergos-wallpaper.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Set Antergos NeXT Wallpaper +Comment=Apply Antergos NeXT default wallpaper on first login +Exec=/usr/local/bin/set-antergos-wallpaper.sh +Terminal=false +X-KDE-autostart-phase=2 +NoDisplay=true diff --git a/iso-profiles/antergos/root-overlay/usr/local/bin/set-antergos-wallpaper.sh b/iso-profiles/antergos/root-overlay/usr/local/bin/set-antergos-wallpaper.sh index 6b364d2..92e6cce 100755 --- a/iso-profiles/antergos/root-overlay/usr/local/bin/set-antergos-wallpaper.sh +++ b/iso-profiles/antergos/root-overlay/usr/local/bin/set-antergos-wallpaper.sh @@ -2,16 +2,36 @@ # One-shot wallpaper setter for Antergos NeXT # Runs at first login via autostart, then disables itself +LOG="/tmp/antergos-wallpaper.log" MARKER="$HOME/.config/antergos-wallpaper-set" +WALLPAPER="/usr/share/wallpapers/antergos-wallpaper/contents/images/adwaita-morning.webp" + +echo "[$(date)] Starting" > "$LOG" if [[ -f "$MARKER" ]]; then + echo "[$(date)] Marker exists, exiting" >> "$LOG" exit 0 fi -WALLPAPER="/usr/share/wallpapers/antergos-wallpaper/contents/images/adwaita-morning.webp" - -if [[ -f "$WALLPAPER" ]]; then - plasma-apply-wallpaperimage "$WALLPAPER" 2>/dev/null +if [[ ! -f "$WALLPAPER" ]]; then + echo "[$(date)] Wallpaper not found: $WALLPAPER" >> "$LOG" + ls -la /usr/share/wallpapers/antergos-wallpaper/contents/images/ >> "$LOG" 2>&1 + touch "$MARKER" + exit 1 fi +echo "[$(date)] Wallpaper found, applying..." >> "$LOG" + +# Retry a few times in case desktop isn't ready yet +for i in 1 2 3; do + /usr/bin/plasma-apply-wallpaperimage "$WALLPAPER" >> "$LOG" 2>&1 + RC=$? + echo "[$(date)] plasma-apply-wallpaperimage attempt $i exit code: $RC" >> "$LOG" + if [[ $RC -eq 0 ]]; then + break + fi + sleep 2 +done + touch "$MARKER" +echo "[$(date)] Done" >> "$LOG"