swww: add systemd service and wallpaper setter

This commit is contained in:
s0wlz (Matthias Puchstein)
2026-01-01 18:30:50 +01:00
parent 389164a582
commit 0825408ddf
3 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1 @@
../swww.service

View File

@@ -0,0 +1,14 @@
[Unit]
Description=swww wallpaper daemon
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/bin/swww-daemon
ExecStartPost=%h/.local/bin/set-wallpapers
Restart=on-failure
RestartSec=1
[Install]
WantedBy=graphical-session.target

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
if ! command -v swww >/dev/null 2>&1; then
echo "swww not found in PATH" >&2
exit 1
fi
for _ in {1..50}; do
if swww query >/dev/null 2>&1; then
break
fi
sleep 0.1
done
if ! swww query >/dev/null 2>&1; then
echo "swww-daemon not responding" >&2
exit 1
fi
{{- range .monitors }}
{{- if .wallpaper }}
swww img -o {{ .name }} "{{ .wallpaper }}"
{{- end }}
{{- end }}