added kitty state

This commit is contained in:
Paul 2022-12-03 00:10:55 +01:00
parent 95a3b0e55d
commit 3df97e5f4e
6 changed files with 49 additions and 0 deletions

24
states/kitty/config.sls Normal file
View File

@ -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 %}

View File

@ -0,0 +1,7 @@
---
kitty:
config:
term: "xterm-256color"
foreground: "#55ee55"
detect_urls: "no"
mouse_map: "left click ungrabbed no_op"

5
states/kitty/init.sls Normal file
View File

@ -0,0 +1,5 @@
---
include:
- users
- .install
- .config

5
states/kitty/install.sls Normal file
View File

@ -0,0 +1,5 @@
---
{%- from "kitty/map.jinja" import kitty with context %}
kitty-pkg:
pkg.latest:
- name: kitty

View File

@ -0,0 +1,4 @@
{%- from "kitty/map.jinja" import kitty with context %}
{%- for key, value in kitty.config.items() %}
{{ key }} {{ value }}
{%- endfor %}

4
states/kitty/map.jinja Normal file
View File

@ -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') -%}