From da95dfae2d2d8a8ad9affcaed98ca572901fccc4 Mon Sep 17 00:00:00 2001 From: Sumedh Wale Date: Wed, 21 May 2025 05:37:56 +0530 Subject: [PATCH 1/2] fix the sandbox check to also work for docker/podman containers --- packages/tray_manager/lib/src/helpers/sandbox.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/tray_manager/lib/src/helpers/sandbox.dart b/packages/tray_manager/lib/src/helpers/sandbox.dart index ab75ce3..d1964a7 100644 --- a/packages/tray_manager/lib/src/helpers/sandbox.dart +++ b/packages/tray_manager/lib/src/helpers/sandbox.dart @@ -1,7 +1,9 @@ import 'dart:io'; -/// Returns `true` if the app is running in a sandbox, eg. Flatpak or Snap. +/// Returns `true` if the app is running in a sandbox, eg. Flatpak, Snap, Docker, Podman. bool runningInSandbox() { return Platform.environment.containsKey('FLATPAK_ID') || - Platform.environment.containsKey('SNAP'); + Platform.environment.containsKey('SNAP') || + Platform.environment.containsKey('container') || + FileSystemEntity.isFileSync('/.dockerenv'); } From 7a6492e1dd6dd1e321e19a02e397a36a8861e227 Mon Sep 17 00:00:00 2001 From: Sumedh Wale Date: Wed, 21 May 2025 16:11:16 +0530 Subject: [PATCH 2/2] check for non-empty value of "container" env var --- packages/tray_manager/lib/src/helpers/sandbox.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tray_manager/lib/src/helpers/sandbox.dart b/packages/tray_manager/lib/src/helpers/sandbox.dart index d1964a7..602c42d 100644 --- a/packages/tray_manager/lib/src/helpers/sandbox.dart +++ b/packages/tray_manager/lib/src/helpers/sandbox.dart @@ -4,6 +4,6 @@ import 'dart:io'; bool runningInSandbox() { return Platform.environment.containsKey('FLATPAK_ID') || Platform.environment.containsKey('SNAP') || - Platform.environment.containsKey('container') || + (Platform.environment['container']?.isNotEmpty == true) || FileSystemEntity.isFileSync('/.dockerenv'); }