runtime: check for DISPLAY instead of XDG_CURRENT_DESKTOP to check if linux machine is GUIless or not #2373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DISPLAY instruct processes which Xorg server to communicate basically, or at least are a obvious sign that there is some kind of X server available.
In environments, such as TMUX sessions, DISPLAY is propagated inside but the same doesn't happen with XDG_CURRENT_DESKTOP so it happens that one launches a session but no windows shows up, even though if one start the frontend process pointing to the socket in the logs and it works just fine.
BTW I am packaging the flutter module to nixpkgs [1] and I was stuck for a few hours on this until I found out about this check. Basically the approach is to use a hardcoded packaged flutter core instead of flet having to download and failing to run because Nix don't use the concept of global libraries like other distros do.
[1] https://github.com/NixOS/nixpkgs/pull/279936/files