hyprwm / hyprlang

The official implementation library for the hypr config language.
https://wiki.hyprland.org/Hypr-Ecosystem/hyprlang/
GNU Lesser General Public License v3.0
137 stars 16 forks source link

Conditional statements #52

Open alba4k opened 2 months ago

alba4k commented 2 months ago

I know that this might be behind the scope of hyprlang is supposed to be, but:

Would it be possible to get some sort of branching in hyprlang itself? As an example

# hyprlang if hyprctl monitors | grep DP-5
monitor = eDP-1, disabled
# hyprlang else
monitor = eDP-1, 1920x1200@60, 0x0, 1
# hyprlang endif

where the condition is simply sh -c "whatever the command is" returning 0.

Of course, this could be partially handled by scripts. Using scripts, however, is never as effective. I'm not sure how the delay could be handled.

vaxerski commented 2 months ago

idk if this is a good idea

alba4k commented 2 months ago

Could certainly be nice