Code Monkey home page Code Monkey logo

Comments (3)

Rayzeq avatar Rayzeq commented on May 23, 2024

I'm not sure it will fix your issue, but you should try printing with print(line[-1], flush=True).
Doing this fixed some of my script, so it might works for you.

from eww.

rafaeljacov avatar rafaeljacov commented on May 23, 2024

I'm not sure it will fix your issue, but you should try printing with print(line[-1], flush=True). Doing this fixed some of my script, so it might works for you.

thanks it worked! but one more thing:

in the line below, is it invalid to set the initial value of deflisten as the output of an command?
I ran eww state and it shows the literal command that I ran instead of the output of the value.

(deflisten active-ws 
    :initial `hyprctl activeworkspace -j | jq '.id'`
    `scripts/hypr.py -a`)

;; eww state
;; active-ws: hyprctl activeworkspace -j | jq '.id'

from eww.

elkowar avatar elkowar commented on May 23, 2024

That is indeed invalid! The idea of the initial value is to have some value that shows before any scripts push their first output, thus setting the initial value to some command would mean that eww would still have to wait for the command to finish before being able to proceed with rendering anything. To ensure that your variable is set to a correct value as fast as possible, I recommend just starting out your hypr.py script by running hyprctl activeworkspaces -j | jq .'id', such that eww gets a meaningful value as fast as possible.

And ye, that flush=True fix ensures that your script actually outputs the data, rather than just buffering it and then printing it in some batch at some point -- eww can't really do anything to avoid this being required :/ Thus, I'll close this issue. Feel free to re-open or create a new one if there are other issues.

from eww.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.