elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
8.9k stars 370 forks source link

[BUG] Listening Variables Not Working As Expected With Binaries #936

Closed ghost closed 8 months ago

ghost commented 10 months ago

Checklist before submitting an issue

Description of the bug

Say I have a script to determine the screencast state. It outputs "true" or "false" whenever the screencast state changes.

This will work:

(deflisten isScreencastVisible "runhaskell ~/.config/eww/scripts/GetScreencast.hs")

But this will fail:

(deflisten isScreencastVisible "~/.config/eww/scripts/binaries/getScreencast")

However, the binary getScreencast is built from GetScreencast.hs and both work identically, and correctly, if run raw in the command line. The same issue does not occur with polling variables. I'm not sure why this is happening.

Reproducing the issue

Make a listening variable that calls a Haskell script, then a listening variable that calls a binary produced from that Haskell script.

Expected behaviour

The first will work, the second won't. And if you look at eww state you'll see there is no value for the relevant variable.

Additional context

Adding an initial value and/or prepending & does not resolve the issue.

You can see the files here if you want: https://gitlab.com/IsaacBrown92/dotfiles/-/tree/main/home-manager/modules/eww/config?ref_type=heads. This happens with both my listening binaries getWorkspaces and getScreencastState, so I'm currently stuck using runhaskell on the Haskell file itself.

ghost commented 9 months ago

NixOS server people randomly solved this, was line buffering.