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

[FEATURE] Being able to use variable argument in listen variable #1212

Open
coni opened this issue Oct 3, 2024 · 4 comments
Open

[FEATURE] Being able to use variable argument in listen variable #1212

coni opened this issue Oct 3, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@coni
Copy link

coni commented Oct 3, 2024

Description of the requested feature

Being able to use variable inside listen definition.

Proposed configuration syntax

(defvar monitor "eDP-1")
(deflisten workspaces           :initial "[]"   "scripts/workspaces.sh ${monitor}")

for example I would love this listener depend to another variable to easily change the monitor as I wish. I know I can do some workaround my scripts not related to yuck to make it works but i think it could be a nice feature to have.

Additional context

No response

@coni coni added the enhancement New feature or request label Oct 3, 2024
@ovalkonia
Copy link
Contributor

ovalkonia commented Oct 8, 2024

That indeed would be nice. I think the reason this feature has not been implemented yet is it's kinda confusing sometimes. Like, what if in your example the value of monitor changes. Can't really change the value of the argument, so should we rerun the script or just leave it as is? What if script is expected to be run exactly once, it would break then? It gets more confusing with defpoll and defvar. I suppose something like that is also why we can't use variables in defwindow

@Hiraeth4171
Copy link

Can't you just use the get sub-command, something like:

(defvar monitor "eDP-1")
(deflisten workspaces           :initial "[]"   "scripts/workspaces.sh $(${EWW_CMD} get monitor)")

I don't think this'll update on the fly if you want it to you could move the eww get monitor command inside your scripts/workspaces.sh

@ovalkonia
Copy link
Contributor

ovalkonia commented Oct 12, 2024

@Hiraeth4171 It won't work because you can't reference any variables inside of deflisten. So EWW_CMD, as well as any other variable, can't actually be used here. I think being able to do that is what the op meant by requesting this feature.

@Hiraeth4171
Copy link

@Hiraeth4171 It won't work because you can't reference any variables inside of deflisten. So EWW_CMD, as well as any other variable, can't actually be used here. I think being able to do that is what the op meant by requesting this feature.

oh yeah, makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants