add new waybar config

This commit is contained in:
Simon Rieger 2023-05-31 09:44:30 +02:00
parent a4b64f16cc
commit afe2f2faf2
3 changed files with 31 additions and 0 deletions

View file

@ -29,6 +29,7 @@
"battery", "battery",
"battery#bat2", "battery#bat2",
"clock", "clock",
"custom/events",
"tray" "tray"
], ],
// Modules configuration // Modules configuration
@ -235,5 +236,15 @@
"on-scroll-up": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateGamma d +0.02", "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-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" "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"
} }
} }

View file

@ -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<b>"+line+"</b>"
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))

View file

@ -90,6 +90,7 @@ button:hover {
#custom-wl-gammarelay-temperature, #custom-wl-gammarelay-temperature,
#custom-wl-gammarelay-brightness, #custom-wl-gammarelay-brightness,
#custom-wl-gammarelay-gamma, #custom-wl-gammarelay-gamma,
#custom-events,
#mpd { #mpd {
padding: 0 10px; padding: 0 10px;
color: #ffffff; color: #ffffff;
@ -173,6 +174,7 @@ label:focus {
background-color: #f53c3c; background-color: #f53c3c;
} }
#custom-events,
#pulseaudio { #pulseaudio {
background-color: #f1c40f; background-color: #f1c40f;
color: #000000; color: #000000;