diff --git a/states/kitty/config.sls b/states/kitty/config.sls new file mode 100644 index 0000000..eb137db --- /dev/null +++ b/states/kitty/config.sls @@ -0,0 +1,24 @@ +--- +{%- 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 %} diff --git a/states/kitty/defaults.yaml b/states/kitty/defaults.yaml new file mode 100644 index 0000000..e14dc4b --- /dev/null +++ b/states/kitty/defaults.yaml @@ -0,0 +1,7 @@ +--- +kitty: + config: + term: "xterm-256color" + foreground: "#55ee55" + detect_urls: "no" + mouse_map: "left click ungrabbed no_op" diff --git a/states/kitty/init.sls b/states/kitty/init.sls new file mode 100644 index 0000000..5bacd97 --- /dev/null +++ b/states/kitty/init.sls @@ -0,0 +1,5 @@ +--- +include: + - users + - .install + - .config diff --git a/states/kitty/install.sls b/states/kitty/install.sls new file mode 100644 index 0000000..727c7ba --- /dev/null +++ b/states/kitty/install.sls @@ -0,0 +1,5 @@ +--- +{%- from "kitty/map.jinja" import kitty with context %} +kitty-pkg: + pkg.latest: + - name: kitty diff --git a/states/kitty/kitty.conf.j2 b/states/kitty/kitty.conf.j2 new file mode 100644 index 0000000..504263b --- /dev/null +++ b/states/kitty/kitty.conf.j2 @@ -0,0 +1,4 @@ +{%- from "kitty/map.jinja" import kitty with context %} +{%- for key, value in kitty.config.items() %} +{{ key }} {{ value }} +{%- endfor %} diff --git a/states/kitty/map.jinja b/states/kitty/map.jinja new file mode 100644 index 0000000..9abe778 --- /dev/null +++ b/states/kitty/map.jinja @@ -0,0 +1,4 @@ +{%- import_yaml "kitty/defaults.yaml" as defaults -%} + +{%- set kitty = salt['pillar.get']('kitty', default=defaults.kitty, merge=True) -%} +{%- set users = salt['pillar.get']('users') -%}