Add navigation to system tray
This commit is contained in:
@@ -241,6 +241,7 @@
|
||||
"tray": {
|
||||
"dashboard": "Dashboard",
|
||||
"quit": "Quit",
|
||||
"open": "Open",
|
||||
"status": {
|
||||
"connect": "Connect",
|
||||
"connecting": "Connecting",
|
||||
|
||||
@@ -246,7 +246,8 @@
|
||||
"connecting": "در حال اتصال",
|
||||
"disconnect": "قطع اتصال",
|
||||
"disconnecting": "در حال قطع اتصال"
|
||||
}
|
||||
},
|
||||
"open": "باز کن"
|
||||
},
|
||||
"failure": {
|
||||
"unexpected": "خطای غیرمنتظره",
|
||||
|
||||
@@ -246,7 +246,8 @@
|
||||
"connecting": "Подключение",
|
||||
"disconnect": "Отключено",
|
||||
"disconnecting": "Отключение"
|
||||
}
|
||||
},
|
||||
"open": "Открыть"
|
||||
},
|
||||
"failure": {
|
||||
"unexpected": "Непредвиденная ошибка",
|
||||
|
||||
@@ -246,7 +246,8 @@
|
||||
"connecting": "正在连接",
|
||||
"disconnect": "已断开连接",
|
||||
"disconnecting": "正在断开连接"
|
||||
}
|
||||
},
|
||||
"open": "打开"
|
||||
},
|
||||
"failure": {
|
||||
"unexpected": "意外错误",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/core/router/router.dart';
|
||||
import 'package:hiddify/data/repository/config_options_store.dart';
|
||||
import 'package:hiddify/domain/connectivity/connectivity.dart';
|
||||
import 'package:hiddify/domain/constants.dart';
|
||||
@@ -37,6 +38,13 @@ class SystemTrayController extends _$SystemTrayController
|
||||
final serviceMode = ref.watch(serviceModeStoreProvider);
|
||||
|
||||
final t = ref.watch(translationsProvider);
|
||||
final destinations = <(String label, String location)>[
|
||||
(t.home.pageTitle, const HomeRoute().location),
|
||||
(t.proxies.pageTitle, const ProxiesRoute().location),
|
||||
(t.logs.pageTitle, const LogsRoute().location),
|
||||
(t.settings.pageTitle, const SettingsRoute().location),
|
||||
(t.about.pageTitle, const AboutRoute().location),
|
||||
];
|
||||
|
||||
loggy.debug('updating system tray');
|
||||
|
||||
@@ -79,6 +87,22 @@ class SystemTrayController extends _$SystemTrayController
|
||||
],
|
||||
),
|
||||
),
|
||||
MenuItem.submenu(
|
||||
label: t.tray.open,
|
||||
submenu: Menu(
|
||||
items: [
|
||||
...destinations.map(
|
||||
(e) => MenuItem(
|
||||
label: e.$1,
|
||||
onClick: (_) async {
|
||||
await ref.read(windowControllerProvider.notifier).show();
|
||||
ref.read(routerProvider).go(e.$2);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
MenuItem.separator(),
|
||||
MenuItem(
|
||||
label: t.tray.quit,
|
||||
|
||||
Reference in New Issue
Block a user