First commit
This commit is contained in:
commit
ea4c167527
4 changed files with 160 additions and 0 deletions
57
templates/config.j2
Normal file
57
templates/config.j2
Normal file
|
@ -0,0 +1,57 @@
|
|||
# {{ ansible_managed }}
|
||||
{% if kanshi_profiles is defined %}
|
||||
{% for p in kanshi_profiles %}
|
||||
profile {{ p.profile | default('') }} {
|
||||
{# Process screens #}
|
||||
{% for s in p.screens %}
|
||||
{% set current = (sway_outputs | selectattr('id','==', s.id))[0] %}
|
||||
{{- ' output "' ~ current['name'] | default(s.id) ~ '"' -}}
|
||||
{% if s.status is defined and s.status == 'disable' %}
|
||||
{{- ' disable' -}}
|
||||
{% else %}
|
||||
{% if s.status is defined and s.status == 'enable' %}
|
||||
{{- ' enable' -}}
|
||||
{% endif %}
|
||||
{% if s.position is defined %}
|
||||
{{- ' position ' ~ s.position -}}
|
||||
{% endif %}
|
||||
{% if s.transform is defined %}
|
||||
{#
|
||||
use sway config transform here is not a good idea because
|
||||
rotation will be applied two times
|
||||
#}
|
||||
{{- ' transform ' ~ s.transform -}}
|
||||
{% endif %}
|
||||
{% if s.scale is defined %}
|
||||
{{- ' scale ' ~ s.scale -}}
|
||||
{% elif current['options']['scale'] is defined %}
|
||||
{{- ' scale ' ~ current['options']['scale'] -}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor -%}
|
||||
|
||||
{# process options#}
|
||||
{% if p.options is defined %}
|
||||
{% for o in p.options %}
|
||||
{% set current = (sway_outputs | selectattr('id','==', o.id))[0] %}
|
||||
{{- ' output "' ~ current['name'] | default(s.id) ~ '" ' -}}
|
||||
{{ o.option }} {{ o.value }}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
|
||||
{# Process command#}
|
||||
{% if p.commands is defined %}
|
||||
{% for c in p.commands %}
|
||||
{% set cmd = namespace(cmd = c) %}
|
||||
{% if sway_outputs is defined %}
|
||||
{% for o in sway_outputs %}
|
||||
{% set cmd.cmd = ( cmd.cmd | replace('+'+o.id+'+', '"'+o.name+'"')) %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{- ' exec ' ~ cmd.cmd }}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue