Add defaults for all relevant host_vars

This commit is contained in:
Oliver Traber 2025-08-06 14:24:02 +02:00
parent dba078af88
commit 7b837afa2d
Signed by: Bluemedia
GPG key ID: C0674B105057136C
4 changed files with 19 additions and 7 deletions

View file

@ -4,10 +4,14 @@ set -eu
background() {
swaybg \
{% if (hostvars[ansible_hostname]['monitors'] | default([])) | length > 0 %}
{% for monitor in hostvars[ansible_hostname]['monitors'] %}
-o "{{ monitor['desc'] }}" -i ~/.config/background/{{ monitor['background']['file'] }} -m {{ monitor['background']['mode'] }} {%- if not loop.last %} \{% endif %}
{% endfor %}
{% else %}
-o '*' -i ~/.config/background/bg0.png -m fill
{% endif %}
}
idle() {
@ -25,10 +29,14 @@ lock() {
exit 1
else
swaylock -f -e -s fill --indicator-radius 150 \
{% if (hostvars[ansible_hostname]['monitors'] | default([])) | length > 0 %}
{% for monitor in hostvars[ansible_hostname]['monitors'] %}
-i {{ monitor['output'] }}:~/.config/background/lock-{{ monitor['background']['file'] }} {%- if not loop.last %} \{% endif %}
{% endfor %}
{% else %}
-i ~/.config/background/lock-bg0.png
{% endif %}
fi
}