@@ -199,10 +199,14 @@ def fork_or_spawn_applet(config={}):
199
199
200
200
debug_print (f"Lanzando applet (logs.db existe en { db_path } )" )
201
201
202
+ # Detectar si estamos en Flatpak
203
+ is_flatpak_env = os .path .exists ('/.flatpak-info' ) or os .environ .get ('FLATPAK_ID' )
204
+
202
205
# 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 } " )
206
210
207
211
if can_fork :
208
212
debug_print ("[platform_utils] Intentando fork para el applet..." )
@@ -216,7 +220,10 @@ def fork_or_spawn_applet(config={}):
216
220
debug_print (f"[platform_utils] Proceso padre continúa después del fork. PID del hijo (applet): { pid } " )
217
221
return True
218
222
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." )
220
227
spawn_tray_applet (config )
221
228
return True
222
229
0 commit comments