Skip to content

Commit

Permalink
Ensure tray icon display in linux sandboxed environments (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
pugaizai authored Sep 15, 2024
1 parent c3e29c6 commit 3f5f051
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions lib/Utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';

import 'package:cloudotp/Database/category_dao.dart';
Expand Down Expand Up @@ -603,11 +604,17 @@ class Utils {
await trayManager.destroy();
return;
}
await trayManager.setIcon(
ResponsiveUtil.isWindows()
? 'assets/logo-transparent.ico'
: 'assets/logo-transparent.png',
);

// Ensure tray icon display in linux sandboxed environments
if (Platform.environment.containsKey('FLATPAK_ID') ||
Platform.environment.containsKey('SNAP')) {
await trayManager.setIcon('com.cloudchewie.cloudotp');
} else if (ResponsiveUtil.isWindows()) {
await trayManager.setIcon('assets/logo-transparent.ico');
} else {
await trayManager.setIcon('assets/logo-transparent.png');
}

var packageInfo = await PackageInfo.fromPlatform();
bool lauchAtStartup = await LaunchAtStartup.instance.isEnabled();
if (!ResponsiveUtil.isLinux()) {
Expand Down Expand Up @@ -675,11 +682,17 @@ class Utils {
await trayManager.destroy();
return;
}
await trayManager.setIcon(
ResponsiveUtil.isWindows()
? 'assets/logo-transparent.ico'
: 'assets/logo-transparent.png',
);

// Ensure tray icon display in linux sandboxed environments
if (Platform.environment.containsKey('FLATPAK_ID') ||
Platform.environment.containsKey('SNAP')) {
await trayManager.setIcon('com.cloudchewie.cloudotp');
} else if (ResponsiveUtil.isWindows()) {
await trayManager.setIcon('assets/logo-transparent.ico');
} else {
await trayManager.setIcon('assets/logo-transparent.png');
}

var packageInfo = await PackageInfo.fromPlatform();
bool lauchAtStartup = await LaunchAtStartup.instance.isEnabled();
if (!ResponsiveUtil.isLinux()) {
Expand Down

0 comments on commit 3f5f051

Please sign in to comment.