From db6352ada83ded58d55d8cfc525915f89fdb4dfa Mon Sep 17 00:00:00 2001 From: Levi Date: Wed, 15 May 2024 20:41:57 +0800 Subject: [PATCH] feat: add show item on system tray (#533) --- .../lib/app/modules/app/controllers/app_controller.dart | 8 +++++++- ui/flutter/lib/i18n/langs/en_us.dart | 1 + ui/flutter/lib/i18n/langs/zh_cn.dart | 1 + ui/flutter/lib/i18n/langs/zh_tw.dart | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/flutter/lib/app/modules/app/controllers/app_controller.dart b/ui/flutter/lib/app/modules/app/controllers/app_controller.dart index abeea3a90..a8f101d2a 100644 --- a/ui/flutter/lib/app/modules/app/controllers/app_controller.dart +++ b/ui/flutter/lib/app/modules/app/controllers/app_controller.dart @@ -198,6 +198,13 @@ class AppController extends GetxController with WindowListener, TrayListener { await trayManager.setIcon('assets/tray_icon/icon.png'); } final menu = Menu(items: [ + MenuItem( + label: "show".tr, + onClick: (menuItem) async => { + await windowManager.show(), + }, + ), + MenuItem.separator(), MenuItem( label: "create".tr, onClick: (menuItem) async => { @@ -205,7 +212,6 @@ class AppController extends GetxController with WindowListener, TrayListener { await Get.rootDelegate.offAndToNamed(Routes.CREATE), }, ), - MenuItem.separator(), MenuItem( label: "startAll".tr, onClick: (menuItem) async => {continueAllTasks()}, diff --git a/ui/flutter/lib/i18n/langs/en_us.dart b/ui/flutter/lib/i18n/langs/en_us.dart index bdedfae93..95818a1d1 100644 --- a/ui/flutter/lib/i18n/langs/en_us.dart +++ b/ui/flutter/lib/i18n/langs/en_us.dart @@ -60,6 +60,7 @@ const enUS = { 'set': 'SET', 'portInUse': 'Port [@port] is in use, please change the port', 'effectAfterRestart': 'Effect after restart', + 'show': 'Show', 'startAll': 'Start All', 'pauseAll': 'Pause All', 'deleteTask': 'Delete Task', diff --git a/ui/flutter/lib/i18n/langs/zh_cn.dart b/ui/flutter/lib/i18n/langs/zh_cn.dart index a33aad71e..8522415ce 100644 --- a/ui/flutter/lib/i18n/langs/zh_cn.dart +++ b/ui/flutter/lib/i18n/langs/zh_cn.dart @@ -58,6 +58,7 @@ const zhCN = { 'set': '已设置', 'portInUse': '端口[@port]已被占用,请更换端口', 'effectAfterRestart': '此配置项将在重启应用后生效', + 'show': '显示', 'startAll': '全部开始', 'pauseAll': '全部暂停', 'deleteTask': '删除任务', diff --git a/ui/flutter/lib/i18n/langs/zh_tw.dart b/ui/flutter/lib/i18n/langs/zh_tw.dart index b9e97d69b..e06741f48 100644 --- a/ui/flutter/lib/i18n/langs/zh_tw.dart +++ b/ui/flutter/lib/i18n/langs/zh_tw.dart @@ -58,6 +58,7 @@ const zhTW = { 'set': '已設定', 'portInUse': '端口[@port]已被占用,請更換端口', 'effectAfterRestart': '重啟後生效', + 'show': '顯示', 'startAll': '全部開始', 'pauseAll': '全部暫停', 'deleteTask': '刪除任務',