From c8f94aade981702d3afefc1c5308574cd3684d47 Mon Sep 17 00:00:00 2001 From: dengbo Date: Wed, 12 Aug 2026 16:47:31 +0800 Subject: [PATCH] feat(linux): detect Linglong sandbox via LINGLONG_APPID env When running inside a Linglong container the LINGLONG_APPID environment variable is set by the runtime, but was not checked by runningInSandbox(). Applications like LocalSend that pass a theme icon name to tray_manager were getting the icon name rewritten into a sandbox-internal absolute path, because the sandbox guard didn't recognise Linglong. Adding the env-var check is consistent with the Flatpak/Snap pattern and requires no packages to guess the app's filesystem layout. --- packages/tray_manager/lib/src/helpers/sandbox.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tray_manager/lib/src/helpers/sandbox.dart b/packages/tray_manager/lib/src/helpers/sandbox.dart index 602c42d..12fe1a9 100644 --- a/packages/tray_manager/lib/src/helpers/sandbox.dart +++ b/packages/tray_manager/lib/src/helpers/sandbox.dart @@ -1,9 +1,10 @@ import 'dart:io'; -/// Returns `true` if the app is running in a sandbox, eg. Flatpak, Snap, Docker, Podman. +/// Returns `true` if the app is running in a sandbox, eg. Flatpak, Snap, Linglong, Docker, Podman. bool runningInSandbox() { return Platform.environment.containsKey('FLATPAK_ID') || Platform.environment.containsKey('SNAP') || + Platform.environment.containsKey('LINGLONG_APPID') || (Platform.environment['container']?.isNotEmpty == true) || FileSystemEntity.isFileSync('/.dockerenv'); }