Following Situation I need to setup the DISPLAY
Variable for my WSL2 to transmit goutput to the Xserver running on my Host-System.
In general I would do this by using my .bashrc:
export DISPLAY=$(ip route list default | awk '{print $3}'):0
So I started by setting the DISPLAY
Variable with
set -Ux DISPLAY $(ip route list default | awk '{print $3}'):0
which worked in the first place.
The Issue: The Variable is now set inside .config/fish/fish_variables
as SETUVAR --export DISPLAY:<MY-IP>:0
Seems fine for the moment but since my Homenet uses DHCP it might happen that my IP is changing. How do I set the variable by calling the top used command?
Your mistake was using set -U
. That creates a "universal" variable. Instead, simply do set -x
in your ~/.config/fish/config.fish so the var is created every time you start a fish shell. See also https://fishshell.com/docs/current/faq.html#why-doesn-t-set-ux-exported-universal-variables-seem-to-work. Universal variables shouldn't be used for values that can change each time you start a fish shell or that might be different for concurrently running shells.