Order sway configuration file

This commit is contained in:
Yorick Barbanneau 2022-11-18 22:07:09 +01:00
parent b745ea72f1
commit 50c485a8cf
6 changed files with 69 additions and 5 deletions

View file

@ -14,7 +14,7 @@
- name: Create Sway config dirs
ansible.builtin.file:
path: '{{ ansible_user_dir ~ "/.config/sway/test.d" }}'
path: '{{ ansible_user_dir ~ "/.config/sway/conf.d" }}'
state: directory
mode: 0750
owner: '{{ ansible_user_uid }}'
@ -38,8 +38,9 @@
validate: >-
sh -c "if sway --config %s --validate 2>&1 | grep -q sway/config.c; then >&2 echo \"Error validating sway configuration\"; exit 1; else exit 0; fi"
loop:
- keybindings
- theme
- output
- input
- 10-input
- 20-output
- 30-theme
- 40-workspaces
- 50-keybindings
any_errors_fatal: true

View file

@ -0,0 +1,9 @@
{% if sway_inputs is defined %}
{% for input in sway_inputs %}
input {{ input.name }} {
{% for option in input.options %}
{{ option.option }} {{ option.value }}
{% endfor %}
}
{% endfor %}
{% endif %}

View file

@ -0,0 +1,9 @@
{% if sway_outputs %}
{% for output in sway_outputs %}
output {{ output.name ~ " " }}
{%- for option in output.options %}
{{ option.option }} {{ option.value }}
{% endfor %}
{% endfor %}
{% endif %}

View file

@ -0,0 +1,11 @@
{% for k,v in sway_theme_parameters.items() %}
{{ k }} {{ v }}
{% endfor %}
{% for client, c in sway_theme_colors.items() %}
client.{{ client }} {{ c.border }} {{ c.backgound}} {{ c.text }}
{%- if c.indicator is defined %} {{ c.indicator }}
{%- if c.child_border is defined %} {{ c.child_border }}{% endif %}
{% endif %}
{% endfor %}

View file

@ -0,0 +1,9 @@
{% for k,v in sway_workspaces.items() %}
set $ws{{ k }} {{ v }}
{% endfor %}
{% if sway_rules is defined %}
{% for i in rules %}
{{ i.verb }} {{ i.query }} {% if i.verb == 'assign' %}$ws{% endif %}{{ i.action }}
{% endfor %}
{% endif %}

View file

@ -0,0 +1,25 @@
set $mod Mod4
set $left h
set $down j
set $up k
set $right l
# Dynamic workspace keybindings
{% for k,v in sway_workspaces.items() %}
bindsym $mod+{{ k }} workspace $ws{{ k }}
bindsym $mod+Shift+{{ k }} move container to workspace $ws{{ k }}
{% endfor %}
{% for section in sway_keybindings %}
{% if section.mode != "normal" %}
mode {{ section.mode }} {
{% endif %}
{% for bind in section.bindings %}
bindsym {{ bind.bindsym }} {{ bind.action}}
{% endfor %}
{% if section.mode != "normal" %}
}
{% endif %}
{% endfor %}