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"
|
"on-click-right": "$TERMINAL start --class float glances"
|
||||||
},
|
},
|
||||||
"custom/events": {
|
"custom/events": {
|
||||||
"format": "{}",
|
|
||||||
"interval": 300,
|
|
||||||
"exec": "~/.config/waybar/modules/khal.py 2>/dev/null",
|
|
||||||
"exec-if": "command -v khal >/dev/null 2>&1",
|
"exec-if": "command -v khal >/dev/null 2>&1",
|
||||||
|
"exec": "~/.config/waybar/modules/khal.py 2>/dev/null",
|
||||||
"return-type": "json",
|
"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": {
|
"memory": {
|
||||||
"interval": 30,
|
"interval": 30,
|
||||||
|
@ -138,7 +142,7 @@
|
||||||
"tag-labels": [ "", "", "", "", "", "", "", "", "", "" ]
|
"tag-labels": [ "", "", "", "", "", "", "", "", "", "" ]
|
||||||
},
|
},
|
||||||
"river/mode": {
|
"river/mode": {
|
||||||
"format": "{} ",
|
"format": "{} ",
|
||||||
},
|
},
|
||||||
"river/window": {
|
"river/window": {
|
||||||
"format": " {}",
|
"format": " {}",
|
||||||
|
@ -172,7 +176,7 @@
|
||||||
"interval": 60,
|
"interval": 60,
|
||||||
},
|
},
|
||||||
"custom/vidl": {
|
"custom/vidl": {
|
||||||
"format": "{} {icon}",
|
"format": "{icon}{}",
|
||||||
"format-alt-click": "right",
|
"format-alt-click": "right",
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"default": " "
|
"default": " "
|
||||||
|
|
|
@ -29,11 +29,11 @@ for line in lines:
|
||||||
new_lines.append(clean_line)
|
new_lines.append(clean_line)
|
||||||
output = "\n".join(new_lines).strip()
|
output = "\n".join(new_lines).strip()
|
||||||
|
|
||||||
if today in output:
|
data["alt"] = "no-event"
|
||||||
data["text"] = " " + output.split("\n")[1]
|
|
||||||
else:
|
|
||||||
data["text"] = ""
|
|
||||||
|
|
||||||
data["tooltip"] = output
|
data["tooltip"] = output
|
||||||
|
|
||||||
|
if today in output:
|
||||||
|
data["text"] = output.split("\n")[1]
|
||||||
|
data["alt"] = "event"
|
||||||
|
|
||||||
print(json.dumps(data))
|
print(json.dumps(data))
|
||||||
|
|
Loading…
Reference in a new issue