eww
eww copied to clipboard
[FEATURE] Reference variables in the definition of other variables
Checklist before submitting an issue
- [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
- [X] I have specifically verified that this bug is not a common user error
- [X] 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
I'd like to share the eww configs with two of my machines but each of them needs a little different setup (like size) so I'm trying to store some needed values in variabes which should be set during the startup of eww
but somehow I can reuse some variables.
Reproducing the issue
Create ~/.config/eww/eww.yuck
:
(defvar var true)
(defvar var2 {var ? 1 : 2})
(defwindow window []
(label :text "hi"))
and execute eww open window
.
This should create the following error message:
error: Tried to reference variable `var`, but we cannot access variables here
┌─ /home/tornax/.config/eww/eww.yuck:2:15
│
2 │ (defvar var2 {var ? 1 : 2})
│ ───
│
→ Expected format: `(defvar name "initial-value")`
Given SCSS File Doesnt Exist! /home/tornax/.config/eww/eww.scss
Caused by:
No such file or directory (os error 2)
Expected behaviour
I expected to be able to use var
in var2
.
Additional context
No response
Currently, it's not possible to refer to variables in the definition of other variables. This may be possible in the future, so I'll keep this open, but for now this is expected behavior
Oh, ok. Thank you for the information!
Just to make sure this would also apply to deflisten right?
use case
(defvar path "/some/pre/determined/path")
(deflisten listener "script --needed-config ${path}/the/file")
this is throwing the error "we cannot access variable here"
bump
If possible it would be great if it would for windows as well (in addition to vars, polls, listens)
use case:
(defwindow bar1
:monitor 1
:windowtype "dock"
:stacking "bg"
:geometry (geometry :x "0%"
:y "0%"
;; :width "100%"
:width "${1440 - trayer-width}"
:height "24px"
:anchor "top left")
:reserve (struts :side "top"
:distance "24px")
(centerbox :orientation "h"
:class "bar"
(leftside)
""
(rightside-1)))
Another use-case is on a multi-monitor setup to open the bar on the currently focused monitor (I use a keybinding to open/close the bar)