hyprwm / Hyprland

Hyprland is a highly customizable dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
18k stars 754 forks source link

Unable to reuse the environment variable defined in hyprland.conf #2591

Open Bryan2333 opened 1 year ago

Bryan2333 commented 1 year ago

I define some environment variables in hyprland.conf

env = XDG_DATA_HOME,$HOME/.local/share
env = GOPATH,$XDG_DATA_HOME/go

When I run echo $GOPATH in terminal, what I expect is /home/username/.local/share/go. But it prints $XDG_DATA_HOME/go.

swappy-20230627-220417

Bryan2333 commented 1 year ago

I look up the related information in wiki. The wiki says the value of variable will be treated as raw string. I am a bit confused with it. If this is the case, why $HOME is being parsed as /home/username and XDG_CONFIG_HOME is being put as raw string?

vaxerski commented 1 year ago

because XDG_DATA_HOME is defined as an env inside the config and hyprland doesn't treat that as env because it sources env before that

Bryan2333 commented 1 year ago

I see. So is it possible to add a function to reuse the environment variable which is newly defined in the config file

Bryan2333 commented 1 year ago

I find a temporary workaround. Define the variable as configuration variable and use it.

$XDG_DATA_HOME=$HOME/.local/share
env = XDG_DATA_HOME,$XDG_DATA_HOME
env = GOPATH,$XDG_DATA_HOME/go
vaxerski commented 1 year ago

yes, thats why this is open and labelled a bug