From f8ea2fc5142c88ec898f5c72e5df067503d117a2 Mon Sep 17 00:00:00 2001 From: Matteo Benedetto Date: Sun, 8 Mar 2026 15:39:22 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20improve=20portability=20=E2=80=93=20fix?= =?UTF-8?q?=20spec=20entry=20point,=20add=20hicolor=20icons,=20force=20Adw?= =?UTF-8?q?aita=20theme=20on=20KDE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cellar-gtk.py | 11 +++++++++++ cellar.spec | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cellar-gtk.py b/cellar-gtk.py index 3d194ef..7c07baa 100755 --- a/cellar-gtk.py +++ b/cellar-gtk.py @@ -3,12 +3,23 @@ from __future__ import annotations import json +import os +import sys import threading import urllib.error from dataclasses import asdict, dataclass from pathlib import Path from typing import Any, Callable +# When running as a frozen binary (PyInstaller) on non-GNOME desktops (e.g. KDE), +# no GTK theme is configured by default. Force Adwaita so the bundled theme is +# used and the UI renders correctly. +if getattr(sys, "frozen", False): + os.environ.setdefault("GTK_THEME", "Adwaita") + # Allow GTK4 to fall back from Wayland to X11 if the Wayland compositor + # does not support the required protocols (common on some KDE setups). + os.environ.setdefault("GDK_BACKEND", "wayland,x11") + try: import gi # type: ignore[import-not-found] except ImportError as exc: diff --git a/cellar.spec b/cellar.spec index 7338f98..5d35d45 100644 --- a/cellar.spec +++ b/cellar.spec @@ -2,7 +2,7 @@ """PyInstaller spec for Cellar GTK – portable all-in-one executable.""" a = Analysis( - ["gtk_client.py"], + ["cellar-gtk.py"], pathex=[], binaries=[], datas=[], @@ -32,7 +32,7 @@ a = Analysis( "Gdk": "4.0", "Gsk": "4.0", }, - "icons": ["Adwaita"], + "icons": ["Adwaita", "hicolor"], "themes": ["Adwaita"], "languages": [], },