Waybar
Waybar copied to clipboard
JSON output of command triggered by "exec-on-event" is ignored
Assume this nice little module:
"custom/dark": {
"return-type": "json",
"exec-on-event": true,
"interval": 60,
"on-click": "dark f",
"exec": "darkmode i",
"on-click": "darkmode f"
}
The "darkmode" script emits this JSON snippet:
{"text":"💡","tooltip":"it is light","class":["mode","light"]}
The problem is that the exec-on-event
setting is summarily ignored. Or rather, the JSON returned by the program is ignored. My icon thus changes (up to) a minute after clicking it, which is not quite what I'd like to see.
Is there a way to fix that?
I'm trying to do something similar and am hitting the same issue.
It works if I set an interval, but is not instant as expected when I trigger an "on-click" event.
Edit: I have exec-on-event working for me now. I had to set "interval": "once"; and now when I click the module through "on-click" it fires off "exec": "myscript".
I solved the problem by adding a signal
to the module and triggering the signal in the on-click
.
i had the same problem and funnily enough, i was also trying to update a dark/light mode module. I did also solve it with the signal approach