Flatpak apps run under XWayland: blurry, wrongly scaled, deaf to session env vars
The symptom, the severity and every command in the fix are correct, but the cause is factually wrong in a way that would mislead someone diagnosing the same class of problem, so it cannot stand. The record asserts that ELECTRON_OZONE_PLATFORM_HINT, GDK_BACKEND, QT_QPA_PLATFORM and MOZ_ENABLE_WAYLAND "are not passed into the sandbox". Flatpak inherits the host environment by default: flatpak_run_app() in common/flatpak-run.c calls flatpak_bwrap_new(NULL), and common/flatpak-bwrap.c does bwrap->envp = g_get_environ() when passed NULL. What Flatpak then does is override a fixed list, default_exports[] in common/flatpak-run.c. Of the four variables the record names, exactly one is on that list: {"GDK_BACKEND", NULL}, unset unconditionally, alongside XCURSOR_PATH, PYTHONPATH, the GST_* family and the VK_* family. ELECTRON_OZONE_PLATFORM_HINT, QT_QPA_PLATFORM and MOZ_ENABLE_WAYLAND are not stripped and do reach the sandbox. So the record is right about GTK apps and wrong about the other three, and it points a reader away from the real failure (the variable never reaching the launcher's environment in the first place: systemd/D-Bus activation) toward a sandbox filter that does not exist for those variables. Everything else verified. All flatpak flags used are real, checked against doc/flatpak-override.xml upstream (--user, --show, --socket, --nosocket, --env, --reset are all documented options). flatpak info --show-permissions and flatpak kill are real. --socket=fallback-x11 is a real socket name so --nosocket=fallback-x11 is a valid diagnostic and the danger note about it is correct. com.github.tchx84.Flatseal is the right Flathub app id (and flatseal 2.4.1-1 is in Arch extra, which is the simpler route on Omarchy). The hyprctl clients / xwayland: 0 verify is accurate against Hyprland v0.56.2's HyprCtl.cpp. ArchWiki Flatpak confirms flatpak override and flatpak override --reset name and uses the same -u override --env= pattern for the analogous XCURSOR_PATH problem. No pacman -Sy, no rm -rf, no Omarchy 3 assumptions.
--nosocket=fallback-x11 (or --nosocket=x11) will stop an app from starting at all if any part of it genuinely needs X11. Some Electron apps still spawn X11 helper processes. Use it as a diagnostic and reset it afterwards with flatpak override --user --reset <app-id>.
Symptom
My Flatpak Obsidian / Spotify / VS Code is noticeably blurry next to everything else, ignores my display scale, and hyprctl clients shows xwayland: 1 for it. The exact same app installed from pacman is crisp. Setting the variable in ~/.config/uwsm/env or with hl.env() makes no difference to the Flatpak.
Cause
A Flatpak's window ends up on XWayland because the app inside the sandbox never positively selected the Wayland backend: most manifests grant both --socket=wayland and --socket=fallback-x11, and the X11 fallback is taken silently, with no error and no log line. It is *not* the case that the sandbox gets none of your session environment. flatpak run starts from the host environment (flatpak_bwrap_new(NULL) falls through to g_get_environ() in common/flatpak-bwrap.c) and then overrides only the fixed default_exports[] list in common/flatpak-run.c. Of the variables that matter here, exactly one is on that list: **GDK_BACKEND is unset unconditionally**, which is why a GTK app in a Flatpak ignores the value you set in ~/.config/uwsm/env or with hl.env(). ELECTRON_OZONE_PLATFORM_HINT, QT_QPA_PLATFORM and MOZ_ENABLE_WAYLAND are *not* stripped and do reach the sandbox, so if those are not taking effect, they are missing from the environment the launcher itself inherited (D-Bus/systemd activation), not being filtered out by Flatpak.
Fix
**1. Look at what the sandbox actually receives, rather than guessing.**
flatpak info --show-permissions md.obsidian.Obsidian
flatpak override --user --show md.obsidian.Obsidian
flatpak run --command=env md.obsidian.Obsidian \
| grep -E 'GDK_BACKEND|ELECTRON_OZONE|QT_QPA_PLATFORM|MOZ_ENABLE_WAYLAND|WAYLAND_DISPLAY'
Read the result this way:
GDK_BACKENDwill be **absent no matter what you set on the host**. Flatpak unsets it unconditionally. That is expected, and it is why GTK apps in a Flatpak ignore your session setting.ELECTRON_OZONE_PLATFORM_HINT,QT_QPA_PLATFORMandMOZ_ENABLE_WAYLAND*are* inherited. If they are missing here, fix the host side first. The launcher did not have them either:
systemctl --user show-environment | grep -E 'ELECTRON_OZONE|QT_QPA_PLATFORM|MOZ_ENABLE_WAYLAND'
WAYLAND_DISPLAYmissing means the sandbox has no Wayland socket at all. Go straight to the--socket=waylandoverride below.
**2. Set the backend inside the sandbox.** For Electron/Chromium apps:
flatpak override --user --socket=wayland \
--env=ELECTRON_OZONE_PLATFORM_HINT=wayland \
md.obsidian.Obsidian
For GTK apps, this one is genuinely required, since the host value never survives:
flatpak override --user --socket=wayland --env=GDK_BACKEND=wayland <app-id>
For Qt apps:
flatpak override --user --socket=wayland --env=QT_QPA_PLATFORM=wayland <app-id>
For Firefox:
flatpak override --user --socket=wayland --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox
To apply a default to every Flatpak, omit the app id:
flatpak override --user --socket=wayland --env=GDK_BACKEND=wayland
Restart the app (flatpak kill md.obsidian.Obsidian first if it lingers) and re-check.
**3. To prove an app really can run without X11**, temporarily remove the fallback so it fails loudly instead of falling back silently:
flatpak override --user --nosocket=fallback-x11 md.obsidian.Obsidian
**4. Undo everything for one app:**
flatpak override --user --reset md.obsidian.Obsidian
**5. A GUI for all of the above** is Flatseal. On Arch/Omarchy it is in the official repos, which is simpler than installing it as a Flatpak:
sudo pacman -S --needed flatseal
# or, from Flathub:
flatpak install flathub com.github.tchx84.Flatseal
Verify
hyprctl clients | grep -A8 <class> reports xwayland: 0 for the Flatpak window, and the window is sharp at your display scale. flatpak override --user --show <app-id> lists the env entries you set.