Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] string comparation in :onscroll isn't working #1034

Closed
3 tasks done
antoniocorbi opened this issue Feb 23, 2024 · 3 comments
Closed
3 tasks done

[BUG] string comparation in :onscroll isn't working #1034

antoniocorbi opened this issue Feb 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@antoniocorbi
Copy link

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

When implementing volume-up/down scrolling in a eventbox like this:

(eventbox
        :class       "eventbox"
        :onhover     "eww update volume=true"
        :onhoverlost "eww update volume=false"
        :cursor      "pointer"
        :onscroll    { "up" == {} ? "echo UP; amixer sset Master 5%+ >/dev/null" : "echo DOWN; amixer sset Master 5%- >/dev/null" }
        (box...

It always produces the 'else' string, but if implement :onscroll like this it works:

:onscroll    "if [ {} = \"up\" ]; then amixer sset Master 5%+ >/dev/null; else amixer sset Master 5%- >/dev/null; fi"

Reproducing the issue

No response

Expected behaviour

The first implementation proposed for :onscroll should work.

Additional context

No response

@antoniocorbi antoniocorbi added the bug Something isn't working label Feb 23, 2024
@antoniocorbi
Copy link
Author

Forgot to mention OS (nixos 23.11) and eww version: 0.4.0

@elkowar
Copy link
Owner

elkowar commented Feb 24, 2024

Yeaa i see where the confusion is coming from - the issue here is that ewe evaluates the expression first, before replacing the {} with the "up" or "down" string, so whats actually happening is that youre comparing an empty json object to a string...

I don't think this will be avoidable any time soon, not before we get some form of lamdas

@antoniocorbi
Copy link
Author

Thx Elkowar!

Yep, that's what I thought.
Meanwhile I'm using something similar to the shell-script proposed.

Thanks for your work in eww!

@elkowar elkowar closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants