]> git.friedersdorff.com Git - max/saltfiles.git/commitdiff
Configure conky
authorMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 4 Jun 2019 10:07:22 +0000 (11:07 +0100)
committerMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 4 Jun 2019 10:07:22 +0000 (11:07 +0100)
states/conky/files/conkyrc [new file with mode: 0644]
states/conky/gentoo.sls [new file with mode: 0644]
states/conky/init.sls

diff --git a/states/conky/files/conkyrc b/states/conky/files/conkyrc
new file mode 100644 (file)
index 0000000..17fc2dd
--- /dev/null
@@ -0,0 +1,72 @@
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+{% if grains['host'] == 'magnesium' %}
+       {% set ifdev = 'br0' %}
+{% elif grains['host'] == 'platinum' %}
+       {% set ifdev = 'wlp2s0' %}
+{% else %}
+       {% set ifdev = 'eth0' %}
+{% endif %}
+
+conky.config = {
+       out_to_x = false,
+       own_window = false,
+       out_to_console = true,
+       short_units = true,
+       update_interval = 0.5,
+       background = false,
+       max_text_width = 0,
+       total_run_times = 0,
+       short_units = true,
+       if_up_strictness = 'address',
+       use_spacer = 'left',
+
+       cpu_avg_samples = 2,
+};
+
+conky.text = [[
+[
+  ${if_running mutt} 
+    {"full_text": "${new_mails mail_aber/Inbox} new mails", "color": "\#ffa500"},
+  ${endif}
+  {"full_text": "Home ${fs_free /home} Free", "color": "\#ffffff"},
+  {"full_text": "Root ${fs_free /root} Free", "color": "\#ffffff"},
+  {"full_text": "Disk r:${diskio_read} w:${diskio_write}", "color": "\#ffffff"},
+  {"full_text": "CPU ${cpu cpu0}%", "color": "\#ffffff"},
+  {
+      "full_text": 
+               "d:${downspeed {{ ifdev }}} u:${upspeed {{ ifdev }}} ${addr {{ ifdev }}}", 
+      "color":
+        ${if_match "${addr {{ ifdev }}}"=="No Address"}
+          "\#ff0000"
+        ${else}
+         "\#00ff00"
+        ${endif}
+  },
+  ${if_match "${addr tun0}"!="No Address"}
+       {"full_text": "VPN", "color": "\#00ff00"},
+  ${endif}
+  {
+       "full_text": "RAM ${memperc}%", 
+       "color": 
+         ${if_match ${memperc}<90}
+           "\#ffffff"
+         ${else}
+               "\#ff0000"
+         ${endif} 
+  },
+{% if grains['host'] == 'platinum' %}
+       {
+         "full_text": "BAT ${battery_short} ${battery_time}", 
+         "color": 
+         ${if_match ${battery_percent}<20}
+           "\#ff0000"
+         ${else}
+               "\#00ff00"
+         ${endif}
+       },
+{% endif %}
+  {"full_text": "${time}", "color": "\#ffffff"}
+],
+]];
+
diff --git a/states/conky/gentoo.sls b/states/conky/gentoo.sls
new file mode 100644 (file)
index 0000000..d6c7b17
--- /dev/null
@@ -0,0 +1,14 @@
+install conky:
+  pkg.installed:
+    - name: app-admin/conky
+    - require:
+      - file: conky useflags
+
+conky useflags:
+  file.managed:
+    - name: /etc/portage/package.use/conky-salt
+    - contents:
+      - app-admin/conky hddtemp iostats
+    - user: root
+    - group: root
+    - mode: 644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d541860e64e32a0b3fbbd648e7c51cd14494760b 100644 (file)
@@ -0,0 +1,11 @@
+include:
+  - conky.{{ grains['os'] | lower }}
+
+conky conf:
+  file.managed:
+    - name: {{ grains['homedir']}}/.conkyrc
+    - source: {{ grains['stateroot']}}/conky/files/conkyrc
+    - template: jinja
+    - mode: 640
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}