allow use of global_variables in defwindow #1004
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Allow the usage of global variables from defwindow like in :monitor
Usage
Main use case is workaround current Wayland/Gdk limitation of picking up monitor the point is currently under (I tried to make it worked but failed). With this PR user can define in eww stuff like that:
with two scripts that are need for hyprland to make it work.
Could be done in one script but I didn't find a way to do it yet.
With this way user can have a window that opens on the current active monitor instead of a fixed one.
Even that it is a workaround adding something like "" monitor definition it still can be useful for other stuff in defwindow like for example making the geometry dynamic (for example to always open a menu under the mouse).
Additional Notes
Currently with this PR eww doesn't pick up that the variables is used in defwindow. Hope someone could give me some guidance where to put that. I already found out how the variables scopes are picked up in eww, but no idea yet how to bring that into
WindowInitiator::new
to register variables used by a window open.Maybe this should be done not at open but at eww startup so the variable used in defwindow is always updated?
Checklist
docs/content/main
directory has been adjusted to reflect my changes.cargo fmt
to automatically format all code before committing