mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
custom show tray icon
Closes #1569 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -58,6 +58,7 @@ class MainController extends GetxController
|
|||||||
late final optTabletNav = Pref.optTabletNav;
|
late final optTabletNav = Pref.optTabletNav;
|
||||||
|
|
||||||
late bool directExitOnBack = Pref.directExitOnBack;
|
late bool directExitOnBack = Pref.directExitOnBack;
|
||||||
|
late bool showTrayIcon = Pref.showTrayIcon;
|
||||||
late bool minimizeOnExit = Pref.minimizeOnExit;
|
late bool minimizeOnExit = Pref.minimizeOnExit;
|
||||||
late bool pauseOnMinimize = Pref.pauseOnMinimize;
|
late bool pauseOnMinimize = Pref.pauseOnMinimize;
|
||||||
late bool isPlaying = false;
|
late bool isPlaying = false;
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ class _MainAppState extends State<MainApp>
|
|||||||
windowManager
|
windowManager
|
||||||
..addListener(this)
|
..addListener(this)
|
||||||
..setPreventClose(true);
|
..setPreventClose(true);
|
||||||
trayManager.addListener(this);
|
if (_mainController.showTrayIcon) {
|
||||||
_handleTray();
|
trayManager.addListener(this);
|
||||||
|
_handleTray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ class _MainAppState extends State<MainApp>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowClose() {
|
void onWindowClose() {
|
||||||
if (_mainController.minimizeOnExit) {
|
if (_mainController.showTrayIcon && _mainController.minimizeOnExit) {
|
||||||
windowManager.hide();
|
windowManager.hide();
|
||||||
_onHideWindow();
|
_onHideWindow();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
List<SettingsModel> get styleSettings => [
|
List<SettingsModel> get styleSettings => [
|
||||||
if (Utils.isDesktop)
|
if (Utils.isDesktop) ...[
|
||||||
const SettingsModel(
|
const SettingsModel(
|
||||||
settingsType: SettingsType.sw1tch,
|
settingsType: SettingsType.sw1tch,
|
||||||
title: '显示窗口标题栏',
|
title: '显示窗口标题栏',
|
||||||
@@ -45,6 +45,15 @@ List<SettingsModel> get styleSettings => [
|
|||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
needReboot: true,
|
needReboot: true,
|
||||||
),
|
),
|
||||||
|
const SettingsModel(
|
||||||
|
settingsType: SettingsType.sw1tch,
|
||||||
|
title: '显示托盘图标',
|
||||||
|
leading: Icon(Icons.donut_large_rounded),
|
||||||
|
setKey: SettingBoxKey.showTrayIcon,
|
||||||
|
defaultVal: true,
|
||||||
|
needReboot: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
SettingsModel(
|
SettingsModel(
|
||||||
settingsType: SettingsType.sw1tch,
|
settingsType: SettingsType.sw1tch,
|
||||||
title: '横屏适配',
|
title: '横屏适配',
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ abstract class SettingBoxKey {
|
|||||||
windowPosition = 'windowPosition',
|
windowPosition = 'windowPosition',
|
||||||
isWindowMaximized = 'isWindowMaximized',
|
isWindowMaximized = 'isWindowMaximized',
|
||||||
showWindowTitleBar = 'showWindowTitleBar',
|
showWindowTitleBar = 'showWindowTitleBar',
|
||||||
desktopVolume = 'desktopVolume';
|
desktopVolume = 'desktopVolume',
|
||||||
|
showTrayIcon = 'showTrayIcon';
|
||||||
|
|
||||||
static const String subtitlePreferenceV2 = 'subtitlePreferenceV2',
|
static const String subtitlePreferenceV2 = 'subtitlePreferenceV2',
|
||||||
enableDragSubtitle = 'enableDragSubtitle',
|
enableDragSubtitle = 'enableDragSubtitle',
|
||||||
|
|||||||
@@ -861,4 +861,7 @@ abstract class Pref {
|
|||||||
|
|
||||||
static bool get enableTapDm =>
|
static bool get enableTapDm =>
|
||||||
_setting.get(SettingBoxKey.enableTapDm, defaultValue: true);
|
_setting.get(SettingBoxKey.enableTapDm, defaultValue: true);
|
||||||
|
|
||||||
|
static bool get showTrayIcon =>
|
||||||
|
_setting.get(SettingBoxKey.showTrayIcon, defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user