swww: add systemd service and wallpaper setter
This commit is contained in:
@@ -0,0 +1 @@
|
||||
../swww.service
|
||||
14
dot_config/systemd/user/swww.service
Normal file
14
dot_config/systemd/user/swww.service
Normal 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
|
||||
25
dot_local/bin/executable_set-wallpapers.tmpl
Normal file
25
dot_local/bin/executable_set-wallpapers.tmpl
Normal 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 }}
|
||||
Reference in New Issue
Block a user