waybar: Improve events block icon rendering
Using the 'alt' json return field to set the icon and change the icon within waybar itself instead of doing so manually in the script. This makes us a little more flexible and puts all the 'what' is rendered that is specific to waybar into waybar (keeping the 'how' it's rendered in the style.css).
This commit is contained in:
parent
6905ce3ea7
commit
12d186d871
2 changed files with 16 additions and 12 deletions
|
@ -49,12 +49,16 @@
|
|||
"on-click-right": "$TERMINAL start --class float glances"
|
||||
},
|
||||
"custom/events": {
|
||||
"format": "{}",
|
||||
"interval": 300,
|
||||
"exec": "~/.config/waybar/modules/khal.py 2>/dev/null",
|
||||
"exec-if": "command -v khal >/dev/null 2>&1",
|
||||
"exec": "~/.config/waybar/modules/khal.py 2>/dev/null",
|
||||
"return-type": "json",
|
||||
"on-click": "$TERMINAL start --class float ikhal"
|
||||
"interval": 300,
|
||||
"on-click": "$TERMINAL start --class float ikhal",
|
||||
"format": "{icon}{}",
|
||||
"format-icons": {
|
||||
"event": " ",
|
||||
"no-event": "",
|
||||
},
|
||||
},
|
||||
"memory": {
|
||||
"interval": 30,
|
||||
|
@ -138,7 +142,7 @@
|
|||
"tag-labels": [ "", "", "", "", "", "", "", "", "", "" ]
|
||||
},
|
||||
"river/mode": {
|
||||
"format": "{} ",
|
||||
"format": "{} ",
|
||||
},
|
||||
"river/window": {
|
||||
"format": " {}",
|
||||
|
@ -172,10 +176,10 @@
|
|||
"interval": 60,
|
||||
},
|
||||
"custom/vidl": {
|
||||
"format": "{} {icon}",
|
||||
"format": "{icon}{}",
|
||||
"format-alt-click": "right",
|
||||
"format-icons": {
|
||||
"default": ""
|
||||
"default": " "
|
||||
},
|
||||
"exec": "wc -l ~/.local/share/vidl/vidl_queue | cut -d' ' -f1",
|
||||
"exec-if": "[ -f ~/.local/share/vidl/vidl_queue ]",
|
||||
|
|
|
@ -29,11 +29,11 @@ for line in lines:
|
|||
new_lines.append(clean_line)
|
||||
output = "\n".join(new_lines).strip()
|
||||
|
||||
if today in output:
|
||||
data["text"] = " " + output.split("\n")[1]
|
||||
else:
|
||||
data["text"] = ""
|
||||
|
||||
data["alt"] = "no-event"
|
||||
data["tooltip"] = output
|
||||
|
||||
if today in output:
|
||||
data["text"] = output.split("\n")[1]
|
||||
data["alt"] = "event"
|
||||
|
||||
print(json.dumps(data))
|
||||
|
|
Loading…
Reference in a new issue