Skip to content

Commit b84f0e5

Browse files
committed
Try to add icon and fix user dir
1 parent e24673c commit b84f0e5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

gtk_llm_chat/platform_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ def fork_or_spawn_applet(config={}):
199199

200200
debug_print(f"Lanzando applet (logs.db existe en {db_path})")
201201

202+
# Detectar si estamos en Flatpak
203+
is_flatpak_env = os.path.exists('/.flatpak-info') or os.environ.get('FLATPAK_ID')
204+
202205
# Solo fork en sistemas tipo Unix si está disponible
203-
# En algunos ambientes Mac/AppImage es o era necesario/conveniente hacer fork - pero ahora no funciona?
204-
can_fork = (is_linux() or is_mac()) and hasattr(os, 'fork')
205-
debug_print(f"[platform_utils] fork_or_spawn_applet: is_linux={is_linux()}, is_mac={is_mac()}, hasattr(os, 'fork')={hasattr(os, 'fork')}, can_fork={can_fork}")
206+
# En Flatpak, preferimos spawn para evitar problemas con el sandboxing y la monitorización de archivos.
207+
can_fork = (is_linux() or is_mac()) and hasattr(os, 'fork') and not is_flatpak_env
208+
209+
debug_print(f"[platform_utils] fork_or_spawn_applet: is_linux={is_linux()}, is_mac={is_mac()}, hasattr(os, 'fork')={hasattr(os, 'fork')}, is_flatpak={is_flatpak_env}, can_fork={can_fork}")
206210

207211
if can_fork:
208212
debug_print("[platform_utils] Intentando fork para el applet...")
@@ -216,7 +220,10 @@ def fork_or_spawn_applet(config={}):
216220
debug_print(f"[platform_utils] Proceso padre continúa después del fork. PID del hijo (applet): {pid}")
217221
return True
218222
else:
219-
debug_print("[platform_utils] No se puede hacer fork, usando spawn_tray_applet.")
223+
if is_flatpak_env:
224+
debug_print("[platform_utils] En entorno Flatpak, usando spawn_tray_applet en lugar de fork.")
225+
else:
226+
debug_print("[platform_utils] No se puede/debe hacer fork, usando spawn_tray_applet.")
220227
spawn_tray_applet(config)
221228
return True
222229

linux/org.fuentelibre.gtk_llm_Chat.flatpak.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ finish-args:
1919
- --talk-name=org.ayatana.indicator.application
2020
- --talk-name=org.freedesktop.Notifications
2121
- --own-name=org.fuentelibre.gtk_llm_Chat.*
22+
- --own-name=org.kde.StatusNotifierItem-org.fuentelibre.gtk_llm_Chat
23+
- --own-name=org.freedesktop.StatusNotifierItem-org.fuentelibre.gtk_llm_Chat
2224
- --share=ipc
2325
- --socket=session-bus
2426
- --socket=system-bus
@@ -32,8 +34,6 @@ finish-args:
3234
- --talk-name=com.canonical.AppMenu.Registrar
3335
- --talk-name=org.kde.StatusNotifierWatcher
3436
- --talk-name=org.freedesktop.StatusNotifierWatcher
35-
- --talk-name=org.kde.StatusNotifierItem-*
36-
- --talk-name=org.freedesktop.StatusNotifierItem-*
3737
build-options:
3838
env:
3939
PKG_CONFIG_PATH: "/app/lib/pkgconfig:/app/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig"

0 commit comments

Comments
 (0)