flathub / flathub/com.fastmail.Fastmail

WSLg: XDG_SESSION_TYPE unset causes launcher to force X11 despite Wayland being available

Open Beginner friendly
#32 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
0
Forks
1
Avg merge
10h 34m
Merged PRs (30d)
2

Description

## Summary

The Fastmail Flatpak incorrectly launches Electron with:

--ozone-platform=x11

under WSLg because the launcher only checks `XDG_SESSION_TYPE == wayland`.

In my environment, Wayland is available and functioning, but `XDG_SESSION_TYPE` is unset inside the Flatpak sandbox, causing Fastmail to select X11 and fail to start.

## Environment

- Windows 11
- WSL2
- WSLg
- Flatpak
- Fastmail Flatpak: com.fastmail.Fastmail

Other GUI applications work correctly (Firefox, Obsidian, etc.).

## Reproduction

Outside sandbox:

```bash
echo $DISPLAY
echo $WAYLAND_DISPLAY
```

Output:

```text
:0
wayland-0
```

Inside sandbox:

```bash
flatpak run --command=sh com.fastmail.Fastmail -c '
echo "DISPLAY=$DISPLAY"
echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY"
echo "XDG_SESSION_TYPE=$XDG_SESSION_TYPE"
'
```

Output:

```text
DISPLAY=
WAYLAND_DISPLAY=wayland-0
XDG_SESSION_TYPE=
```

Launching Fastmail:

```bash
flatpak run com.fastmail.Fastmail
```

Output:

```text
Running on X11
Passing the following arguments to Electron: --ozone-platform=x11

[ERROR:ui/ozone/platform/x11/ozone_platform_x11.cc:257]
Missing X server or $DISPLAY
```

## Investigation

The launcher contains:

```bash
if [[ $XDG_SESSION_TYPE == "wayland" && -z "$DISPLAY" ]]; then
...
else
FLAGS+=(--ozone-platform=x11)
fi
```

Because `XDG_SESSION_TYPE` is unset in WSLg, Fastmail incorrectly falls into the X11 branch even though:

```text
WAYLAND_DISPLAY=wayland-0
```

is available and functional.

## Workaround

```bash
flatpak run \
--env=XDG_SESSION_TYPE=wayland \
com.fastmail.Fastmail
```

This causes the launcher to correctly select Wayland:

```text
Running on native Wayland
```

## Expected Behavior

Fastmail should detect Wayland when a valid Wayland environment exists, even if `XDG_SESSION_TYPE` is unset.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the Flatpak launcher containing the shown XDG_SESSION_TYPE and DISPLAY checks, then inspect how it selects Electron's ozone platform. Reproduce the environment with the provided flatpak command and verify the launcher selects native Wayland when WAYLAND_DISPLAY is available but XDG_SESSION_TYPE is unset; confirm existing X11 behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.