fix(flatpak): apply QT_QPA_PLATFORMTHEME override alongside GTK_THEME

Flatpak apps don't inherit the host's QT_QPA_PLATFORMTHEME=gtk3, so Qt apps
(Wireshark, PrismLauncher, ...) ignored the cyberqueer theme even though
GTK_THEME was already being overridden per-app.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-07-10 16:23:49 +02:00
parent f90dbdae8b
commit a0221b42dc
1 changed files with 11 additions and 2 deletions

View File

@ -121,8 +121,13 @@ ensure_flatpak() {
# ── apply_flatpak_theme ──────────────────────────────────────────────────────── # ── apply_flatpak_theme ────────────────────────────────────────────────────────
# WHY: Flatpak apps run in sandboxes and can't access the host ~/.themes directory # WHY: Flatpak apps run in sandboxes and can't access the host ~/.themes directory
# by default. We must explicitly grant filesystem access AND set GTK_THEME. # by default. We must explicitly grant filesystem access AND set GTK_THEME.
# Qt apps (Wireshark, PrismLauncher, ...) don't follow GTK_THEME on their
# own — the host sets QT_QPA_PLATFORMTHEME=gtk3 (see envvars.lua/envvars.conf)
# so Qt borrows the GTK theme via the gtk3 platform plugin, but Flatpak apps
# don't inherit host env vars, so the same var must be overridden per-app.
# WHAT: Copies the cyberqueer GTK theme into ~/.themes, grants the Flatpak app # WHAT: Copies the cyberqueer GTK theme into ~/.themes, grants the Flatpak app
# read-only access to that directory, and overrides the GTK_THEME env var. # read-only access to that directory, and overrides GTK_THEME and
# QT_QPA_PLATFORMTHEME so both GTK and Qt apps pick up the theme.
# #
# Usage: apply_flatpak_theme <app-id> # Usage: apply_flatpak_theme <app-id>
# e.g. apply_flatpak_theme org.gnome.gedit # e.g. apply_flatpak_theme org.gnome.gedit
@ -151,5 +156,9 @@ apply_flatpak_theme() {
# Set GTK_THEME env var for this app so GTK picks up the correct theme name # Set GTK_THEME env var for this app so GTK picks up the correct theme name
flatpak override --user --env=GTK_THEME="$theme_name" "$app_id" flatpak override --user --env=GTK_THEME="$theme_name" "$app_id"
log "Cyberqueer theme applied to $app_id." # Set QT_QPA_PLATFORMTHEME so Qt apps route through the gtk3 platform
# plugin and pick up the same GTK_THEME, matching the host setup.
flatpak override --user --env=QT_QPA_PLATFORMTHEME=gtk3 "$app_id"
log "Cyberqueer theme applied to $app_id (GTK + Qt)."
} }