From afe2f2faf24a7dff063cdf4684dcf8a67c938852 Mon Sep 17 00:00:00 2001 From: Simon Rieger Date: Wed, 31 May 2023 09:44:30 +0200 Subject: [PATCH] add new waybar config --- dot_config/waybar/config | 11 +++++++++++ dot_config/waybar/executable_waybar-khal.py | 18 ++++++++++++++++++ dot_config/waybar/style.css | 2 ++ 3 files changed, 31 insertions(+) create mode 100644 dot_config/waybar/executable_waybar-khal.py diff --git a/dot_config/waybar/config b/dot_config/waybar/config index 651df0f..3117ffa 100644 --- a/dot_config/waybar/config +++ b/dot_config/waybar/config @@ -29,6 +29,7 @@ "battery", "battery#bat2", "clock", + "custom/events", "tray" ], // Modules configuration @@ -235,5 +236,15 @@ "on-scroll-up": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateGamma d +0.02", "on-scroll-down": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateGamma d -0.02", "on-click": "busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Gamma d 1" + }, + "custom/events": { + "format": "{}", + "tooltip": true, + "interval": 300, + "format-icons": { + "default": "" + }, + "exec": "~/.config/waybar/waybar-khal.py", + "return-type": "json" } } diff --git a/dot_config/waybar/executable_waybar-khal.py b/dot_config/waybar/executable_waybar-khal.py new file mode 100644 index 0000000..33c6679 --- /dev/null +++ b/dot_config/waybar/executable_waybar-khal.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +import json +import subprocess +data = {} +output = subprocess.check_output("khal list now 7days --format \"{start-end-time-style} {title}\"", shell=True).decode("utf-8") +lines = output.split("\n") +new_lines = [] +for line in lines: + if len(line) and line[0].isalpha(): + line = "\n"+line+"" + new_lines.append(line) +output = "\n".join(new_lines).strip() +if "Today" in output: + data['text'] = " " + output.split('\n')[1] +else: + data['text'] = "" +data['tooltip'] = output +print(json.dumps(data)) diff --git a/dot_config/waybar/style.css b/dot_config/waybar/style.css index 8dac1f8..ed90cca 100644 --- a/dot_config/waybar/style.css +++ b/dot_config/waybar/style.css @@ -90,6 +90,7 @@ button:hover { #custom-wl-gammarelay-temperature, #custom-wl-gammarelay-brightness, #custom-wl-gammarelay-gamma, +#custom-events, #mpd { padding: 0 10px; color: #ffffff; @@ -173,6 +174,7 @@ label:focus { background-color: #f53c3c; } +#custom-events, #pulseaudio { background-color: #f1c40f; color: #000000;