microsoft / microsoft/WSL

DISPLAY and WAYLAND_DISPLAY not set in systemd activation environment

Open
#12,436 5 comments 0 reactions 1 assignee View on GitHub

@OneBlue is already working on this.

Since Jan 7, 2025.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.26100.2605]

### WSL Version

2.4.8.0

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.167.4-1

### Distro Version

NixOS unstable

### Other Software

_No response_

### Repro Steps

1. Try to run a graphical application from a systemd user service
2. Observe lack of `DISPLAY` or `WAYLAND_DISPLAY` in the environment

### Expected Behavior

`DISPLAY` and `WAYLAND_DISPLAY`, and possibly other relevant variables are available in the environment for all user services.

### Actual Behavior

They are not.

Not sure where to put notes, but fixing this should be as simple as running `systemctl --user import-environment DISPLAY WAYLAND_DISPLAY ` with the right environment set, or making a dbus call directly. The problem is mostly that only WSL really knows when WSLg is available and what the variables should be set to.

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.