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

@ -33,7 +33,7 @@
dest: "/etc/systemd/"
- src: "{{ role_path }}/files/systemd/sleep.conf.d"
dest: "/etc/systemd/"
when: hostvars[ansible_hostname]['mobile_platform']
when: "hostvars[ansible_hostname]['mobile_platform'] | default(false)"
- name: Copy static config files
copy:

View file

@ -39,7 +39,7 @@
name:
- brightnessctl
- network-manager
when: hostvars[ansible_hostname]['mobile_platform']
when: "hostvars[ansible_hostname]['mobile_platform'] | default(false)"
- name: Install brightnessctl udev rules
become: yes
@ -49,7 +49,7 @@
owner: root
group: root
mode: u=rw,g=r,o=r
when: hostvars[ansible_hostname]['mobile_platform']
when: "hostvars[ansible_hostname]['mobile_platform'] | default(false)"
- name: Install zsh
become: yes

View file

@ -1,8 +1,12 @@
# Monitor configuration (see https://wiki.hyprland.org/Configuring/Monitors/)
{% if (hostvars[ansible_hostname]['monitors'] | default([])) | length > 0 %}
{% for monitor in hostvars[ansible_hostname]['monitors'] %}
monitor=desc:{{ monitor['desc'] }}, {{ monitor['resolution'] }}, {{ monitor['position'] | default('auto') }}, 1{% if 'transform' in monitor %}, transform, {{ monitor['transform'] }}{% endif %}
monitor = desc:{{ monitor['desc'] }}, {{ monitor['resolution'] }}, {{ monitor['position'] | default('auto') }}, 1{% if 'transform' in monitor %}, transform, {{ monitor['transform'] }}{% endif %}
{% endfor %}
{% else %}
monitor = , preferred, auto, 1
{% endif %}
# Programs to use
$terminal = flatpak run --nosocket=wayland org.wezfurlong.wezterm
@ -102,7 +106,7 @@ windowrulev2 = float,title:^(Application Finder)$
windowrulev2 = size 500 500,title:^(Application Finder)$
# Workspace rules
{% for workspace in hostvars[ansible_hostname]['workspaces'] %}
{% for workspace in hostvars[ansible_hostname]['workspaces'] | default([]) %}
workspace = {{ workspace['id'] }}{% if 'monitor' in workspace %}, monitor:desc:{{ workspace['monitor'] }}{% endif %}{% if 'default' in workspace %}, default:{{ workspace['default'] | lower }}{% endif %}{% if 'layoutopt_orientation' in workspace %}, layoutopt:orientation:{{ workspace['layoutopt_orientation'] }}{% endif %}{% if 'on_created_empty' in workspace %}, on-created-empty:{{ workspace['on_created_empty'] }}{% endif %}
{% endfor %}
@ -119,7 +123,7 @@ exec-once = flatpak run com.tomjwatson.Emote
{% if 'nextcloud' in role_names %}
exec-once = nextcloud --background
{% endif %}
{% for autostart in hostvars[ansible_hostname]['autostart'] %}
{% for autostart in hostvars[ansible_hostname]['autostart'] | default([]) %}
exec-once = {% if 'workspace' in autostart %}[workspace {{ autostart['workspace'] }} {%- if (autostart['silent'] | default('false')) | bool %} silent{% endif %}] {% endif %}{{ autostart['command'] }}
{% endfor %}
@ -178,7 +182,7 @@ bind = $mainMod SHIFT, 0, movetoworkspace, 10
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
{% if hostvars[ansible_hostname]['mobile_platform'] | bool %}
{% if (hostvars[ansible_hostname]['mobile_platform'] | default(false)) | bool %}
# Backlight control
bind = , XF86MonBrightnessUp, exec, brightnessctl -d intel_backlight set +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl -d intel_backlight set 5%-

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
}