fix: robust wallpaper script with logging + skel autostart
This commit is contained in:
+8
@@ -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
|
||||||
@@ -2,16 +2,36 @@
|
|||||||
# One-shot wallpaper setter for Antergos NeXT
|
# One-shot wallpaper setter for Antergos NeXT
|
||||||
# Runs at first login via autostart, then disables itself
|
# Runs at first login via autostart, then disables itself
|
||||||
|
|
||||||
|
LOG="/tmp/antergos-wallpaper.log"
|
||||||
MARKER="$HOME/.config/antergos-wallpaper-set"
|
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
|
if [[ -f "$MARKER" ]]; then
|
||||||
|
echo "[$(date)] Marker exists, exiting" >> "$LOG"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
WALLPAPER="/usr/share/wallpapers/antergos-wallpaper/contents/images/adwaita-morning.webp"
|
if [[ ! -f "$WALLPAPER" ]]; then
|
||||||
|
echo "[$(date)] Wallpaper not found: $WALLPAPER" >> "$LOG"
|
||||||
if [[ -f "$WALLPAPER" ]]; then
|
ls -la /usr/share/wallpapers/antergos-wallpaper/contents/images/ >> "$LOG" 2>&1
|
||||||
plasma-apply-wallpaperimage "$WALLPAPER" 2>/dev/null
|
touch "$MARKER"
|
||||||
|
exit 1
|
||||||
fi
|
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"
|
touch "$MARKER"
|
||||||
|
echo "[$(date)] Done" >> "$LOG"
|
||||||
|
|||||||
Reference in New Issue
Block a user