Add navigation to system tray
This commit is contained in:
@@ -241,6 +241,7 @@
|
|||||||
"tray": {
|
"tray": {
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
"quit": "Quit",
|
"quit": "Quit",
|
||||||
|
"open": "Open",
|
||||||
"status": {
|
"status": {
|
||||||
"connect": "Connect",
|
"connect": "Connect",
|
||||||
"connecting": "Connecting",
|
"connecting": "Connecting",
|
||||||
|
|||||||
@@ -246,7 +246,8 @@
|
|||||||
"connecting": "در حال اتصال",
|
"connecting": "در حال اتصال",
|
||||||
"disconnect": "قطع اتصال",
|
"disconnect": "قطع اتصال",
|
||||||
"disconnecting": "در حال قطع اتصال"
|
"disconnecting": "در حال قطع اتصال"
|
||||||
}
|
},
|
||||||
|
"open": "باز کن"
|
||||||
},
|
},
|
||||||
"failure": {
|
"failure": {
|
||||||
"unexpected": "خطای غیرمنتظره",
|
"unexpected": "خطای غیرمنتظره",
|
||||||
|
|||||||
@@ -246,7 +246,8 @@
|
|||||||
"connecting": "Подключение",
|
"connecting": "Подключение",
|
||||||
"disconnect": "Отключено",
|
"disconnect": "Отключено",
|
||||||
"disconnecting": "Отключение"
|
"disconnecting": "Отключение"
|
||||||
}
|
},
|
||||||
|
"open": "Открыть"
|
||||||
},
|
},
|
||||||
"failure": {
|
"failure": {
|
||||||
"unexpected": "Непредвиденная ошибка",
|
"unexpected": "Непредвиденная ошибка",
|
||||||
|
|||||||
@@ -246,7 +246,8 @@
|
|||||||
"connecting": "正在连接",
|
"connecting": "正在连接",
|
||||||
"disconnect": "已断开连接",
|
"disconnect": "已断开连接",
|
||||||
"disconnecting": "正在断开连接"
|
"disconnecting": "正在断开连接"
|
||||||
}
|
},
|
||||||
|
"open": "打开"
|
||||||
},
|
},
|
||||||
"failure": {
|
"failure": {
|
||||||
"unexpected": "意外错误",
|
"unexpected": "意外错误",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:hiddify/core/core_providers.dart';
|
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/data/repository/config_options_store.dart';
|
||||||
import 'package:hiddify/domain/connectivity/connectivity.dart';
|
import 'package:hiddify/domain/connectivity/connectivity.dart';
|
||||||
import 'package:hiddify/domain/constants.dart';
|
import 'package:hiddify/domain/constants.dart';
|
||||||
@@ -37,6 +38,13 @@ class SystemTrayController extends _$SystemTrayController
|
|||||||
final serviceMode = ref.watch(serviceModeStoreProvider);
|
final serviceMode = ref.watch(serviceModeStoreProvider);
|
||||||
|
|
||||||
final t = ref.watch(translationsProvider);
|
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');
|
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.separator(),
|
||||||
MenuItem(
|
MenuItem(
|
||||||
label: t.tray.quit,
|
label: t.tray.quit,
|
||||||
|
|||||||
Reference in New Issue
Block a user