Add keybinding for sway WM

This commit is contained in:
Yorick Barbanneau 2023-04-15 01:44:46 +02:00
parent 0d1912fec1
commit 05c74dd3ba
3 changed files with 30 additions and 0 deletions

View file

@ -39,3 +39,5 @@ mako_options:
anchor: top-right
mako_rules: []
mako_keybindings: []

View file

@ -42,3 +42,18 @@
scope: user
state: started
when: service_file is change and not ansible_check_mode
- name: Render Mako keybinding for sway config file
ansible.builtin.template:
src: '{{ item }}.config.j2'
dest: '{{ ansible_user_dir ~ "/.config/sway/conf.d/" ~ item ~ ".config" }}'
owner: '{{ ansible_user_uid }}'
group: '{{ ansible_user_gid }}'
lstrip_blocks: true
trim_blocks: true
mode: 0640
validate: >-
sh -c "cat {{ansible_user_dir}}/.config/sway/conf.d/* %s > /tmp/sway; if sway --config /tmp/sway --validate 2>&1 | grep -q sway/config.c; then >&2 echo \"Error validating sway configuration\"; rm /tmp/sway; exit 1; else rm /tmp/sway; exit 0; fi"
loop:
- 51-mako_keybindings
any_errors_fatal: true

View file

@ -0,0 +1,13 @@
{% for section in mako_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 %}