hyprwm / hypridle

Hyprland's idle daemon
BSD 3-Clause "New" or "Revised" License
393 stars 26 forks source link

[REQ] Ability to use variables inside commands #9

Closed Andy3153 closed 8 months ago

Andy3153 commented 8 months ago

Since this uses hyprlang, when I wrote my config I took the liberty to create variables for every command the listeners will run, only to realize variables declared inside the file cannot be used inside commands.

For example, this:

# [...]

screen = hyprctl dispatch dpms

listener {
    timeout    = 69
    on-timeout = $screen off
    on-resume  = $screen on
}

# [...]

does not work.

hypridle probably just takes everything after the = on things like on-timeout, on-resume, lock_cmd etc. as a string and makes the shell execute it without evaluating it at all, which makes it act differently than the way Hyprland can be configured, where (from what I can see) you can put variables in things that are meant to be executed.

I don't know if you care about this, but I figure someone is going to try doing this too, so it would be nice as a feature.

fufexan commented 8 months ago

Variables are declared with $variable = ..., not variable = .... That's why it doesn't work.

Andy3153 commented 8 months ago

Great. How do I delete an issue lmao