Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

JSON output of command triggered by "exec-on-event" is ignored

Open smurfix opened this issue 1 year ago • 3 comments

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?

smurfix avatar Oct 05 '23 06:10 smurfix

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".

druneau avatar Oct 22 '23 00:10 druneau

I solved the problem by adding a signal to the module and triggering the signal in the on-click.

VAWVAW avatar Feb 09 '24 10:02 VAWVAW

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

juanolon avatar May 02 '24 02:05 juanolon