---
{%- from "kitty/map.jinja" import users with context %}
{%- for name, user in users.items() %}
{%- if user.enabled %}
kitty-config-dir-{{ name }}:
  file.directory:
    - name: {{ user.home }}/.config/kitty
    - user: {{ name }}
    - group: {{ user.gid }}
    - mode: 0755

kittyrc-user-{{ name }}:
  file.managed:
    - name: {{ user.home }}/.config/kitty/kitty.conf
    - source: salt://kitty/kitty.conf.j2
    - user: {{ name }}
    - group: {{ user.gid }}
    - mode: 0644
    - template: jinja
    - require:
      - pkg: kitty-pkg
      - file: kitty-config-dir-{{ name }}
{%- endif %}
{%- endfor %}