-
-
Notifications
You must be signed in to change notification settings - Fork 381
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] Stack selection index not persisting #1192
Comments
@ovalkonia you recently worked on the stack widget. are you by any chance able to look into this ^^'? if not, don't worry about it @koalagang as a workaround (and something that is probably more efficient as well), you should be able to use the following config (not tested, but should you give an idea):
i'll look into this if noone else does so, but i'm currently a bit busy so this might take a while by the way, that menu looks really neat! (i will take inspiration from it if i ever find the energy to rice again) |
As @w-lfchen mentioned, there's no need for the
(defwidget settings []
(eventbox
:onhover "${EWW_CMD} open some_menu"
(label :text "settings beep boop!")
)
)
(defwindow bar
:monitor "0"
:geometry (geometry
:x "0"
:y "0"
:width "100%"
:height "35px"
:anchor "top center"
)
:exclusive "true"
(settings)
)
(defvar stack_index "0")
(defwidget stack_test []
(stack
:selected {stack_index}
(label :class "red" :text "red")
(label :class "green" :text "green")
)
)
(defwindow some_menu
:monitor "0"
:geometry (geometry
:x "0"
:y "0"
:width "100%"
:height "35px"
:anchor "top center"
)
:exclusive "false"
(eventbox
:onhoverlost "${EWW_CMD} close some_menu"
:onclick "${EWW_CMD} update stack_index=${(stack_index + 1) % 2}"
(stack_test)
)
)
window {
background-color: #282828;
color: #ebdbb2;
}
.red {
color: #ff0000;
}
.green {
color: #00ff00;
} It's the same thing you have, right? With this configuration everything works as expected. Whether |
i didn't test the config earlier, it seems to be working for me as well |
This works beautifully! So glad I filed this issue. :D I didn't know it was possible to write conditional statements in yuck. Guess I must have overlooked some part of the documentation... Edit: actually, I forgot that I wanted to keep the animation which the stack provides. Also, when using your suggested method, the button seems to change size (because it doesn't have the
Thanks for the compliment. That put a smile on my face. 😄 I don't actually use network manager (just bare iwd, networkd and resolved) and will probably see if I can interface with my VPN provider through their cli utility or via wireguard (have not actually installed and set it up yet) but thanks anyway. :)
Strange. I just tested your config and on my end it has the same issue as with my config. I click and it switches from yuck
scss
The issue persists with this configuration too.
0.6.0 |
the relevant documentation for the expression bit would be here, glad to help ^^ are you able to try building from master and seeing whether everything works there? i'll look into a version bump soonish, don't think elkowar would be opposed there, but there are some things that should be resolved first |
I'm still using my puny ThinkPad T420 so I don't think that would be able to handle compiling eww. Maybe in a few days, though, as I have bought a new, more powerful laptop. Btw I made an edit to my comment. I'll still consider using your method but I might still want to use the stack because I really like the transition animation. 😄 Edit: just noticed that you're a fellow nix user. :) |
your config, your choice obviously ^^ the version in nixpkgs is a bit more up to date i'm guessing you could hack together a button animation using scss somehow, but i don't know enough scss for that |
Tested this under |
@ovalkonia try 3673639 ^^ |
Yep, works under 3673639. Doesn't work before the fix. Didn't expect it to be this one, but I guess why not |
Okay, so I guess I just have to wait until the next version bump? |
Pretty much. Or you could install the git version) |
the git version would compile from source i think if your nix config uses flakes, you can just use the overlay feel free to ask if you need help with nix since i wrote the flake in its current form ^^ |
That's true. I may give that a go in a few days once I've moved over to my new laptop. But I can be patient and wait for the next version (although by the looks of the releases page, it seems like they don't come that often so maybe I'm not patient enough for that). |
sure thing! i'd ask you to close this issue since it seems to be resolved on master, i'll bump it once an update in nixpkgs happens (if i don't forget it ^^') |
@koalagang btw, I think you can achieve the same transition using css only. It should work with |
I may give that a go. I don't actually know any css beyond the very basic stuff in my Edit: nvm. That was extremely easy. Just added |
Too late, but I will post it anyway. Take a look at the configuration I tested before, but this time without the
(defwidget settings []
(eventbox
:onhover "${EWW_CMD} open some_menu"
(label :text "settings beep boop!")
)
)
(defwindow bar
:monitor "0"
:geometry (geometry
:x "0"
:y "0"
:width "100%"
:height "35px"
:anchor "top center"
)
:exclusive "true"
(settings)
)
(defvar stack_toggle "false")
(defwindow some_menu
:monitor "0"
:geometry (geometry
:x "0"
:y "0"
:width "100%"
:height "35px"
:anchor "top center"
)
:exclusive "false"
(eventbox
:onhoverlost "${EWW_CMD} close some_menu"
:onclick "${EWW_CMD} update stack_toggle=${!stack_toggle}"
(label :class "${stack_toggle ? "red" : "green"} transition-class" :text "some text beep boop!")
)
)
It's kind of a slow transition from red green and vice versa, but of course you can change the duration, curve of change and even delay of it. Take a look here for more info: https://developer.mozilla.org/en-US/docs/Web/CSS/transition |
Checklist before submitting an issue
Description of the bug
Not sure whether or not this is a bug or a feature but it seems that the index of a stack is reset whenever the window is closed, even if the index is set using a variable.
Reproducing the issue
Here is a minimal config. It's designed so that I can click the button to enable do not disturb mode in mako and then transitions into a different colour so that I can see that it is turned on. This works by setting the selection index to be a variable and then updating the variable, causing a different widget in the stack to show. However, when I close the window and later re-open it, the index is reset to 0 despite the variable's (
dnd_toggle
) value not having changed.scss:
yuck:
Expected behaviour
I would expect the stack's selection index to remain exactly the value of the variable
dnd_toggle
even when I close and re-open the window.Additional context
The text was updated successfully, but these errors were encountered: