An open-source cross-platform alternative to AirDrop
fix(linux): use different tray icon path for flatpak (#1900)
Guilherme Silva09406512dac2
diff --git a/app/lib/util/native/tray_helper.dart b/app/lib/util/native/tray_helper.dartindex 6f12e24e..aa4b9500 100644--- a/app/lib/util/native/tray_helper.dart+++ b/app/lib/util/native/tray_helper.dart@@ -1,3 +1,5 @@+import 'dart:io';+import 'package:flutter/foundation.dart';import 'package:localsend_app/gen/assets.gen.dart';import 'package:localsend_app/gen/strings.g.dart';@@ -26,7 +28,15 @@ Future<void> initTray() async {// The menu bar icon will created in AppDelegate.swiftreturn;} else if (checkPlatform([TargetPlatform.linux])) {- await tm.trayManager.setIcon(Assets.img.logo32White.path);+ String icon;+ if (await File("/.flatpak-info").exists()) {+ // Icon for Flatpak, which must exist in /app/share/icons/hicolor/*x*/apps.+ icon = 'org.localsend.localsend_app-tray';+ } else {+ icon = Assets.img.logo32White.path;+ }+ _logger.info('Using "$icon" as path of system tray icon');+ await tm.trayManager.setIcon(icon);} else {await tm.trayManager.setIcon(Assets.img.logo32.path);}