rustdesk/flutter/lib/utils/tray_manager.dart
Kingtous d81d785722 feat: add tray icon to status bar
Signed-off-by: Kingtous <kingtous@qq.com>
2022-06-02 16:23:20 +08:00

23 lines
680 B
Dart

import 'dart:io';
import 'package:flutter_hbb/models/model.dart';
import 'package:tray_manager/tray_manager.dart';
Future<void> initTray({List<MenuItem>? extra_item}) async {
List<MenuItem> items = [
MenuItem(key: "show", label: translate("show rustdesk")),
MenuItem.separator(),
MenuItem(key: "quit", label: translate("quit rustdesk")),
];
if (extra_item != null) {
items.insertAll(0, extra_item);
}
await Future.wait([
trayManager
.setIcon(Platform.isWindows ? "assets/logo.ico" : "assets/logo.png"),
trayManager.setContextMenu(Menu(items: items)),
trayManager.setToolTip("rustdesk"),
trayManager.setTitle("rustdesk")
]);
}