diff --git a/LenovoLegionToolkit.WPF/App.xaml.cs b/LenovoLegionToolkit.WPF/App.xaml.cs index d03114b15c..a461dc74bd 100644 --- a/LenovoLegionToolkit.WPF/App.xaml.cs +++ b/LenovoLegionToolkit.WPF/App.xaml.cs @@ -82,7 +82,8 @@ private async void Application_Startup(object sender, StartupEventArgs e) var mainWindow = new MainWindow { - WindowStartupLocation = WindowStartupLocation.CenterScreen + WindowStartupLocation = WindowStartupLocation.CenterScreen, + TrayTooltipEnabled = !flags.DisableTrayTooltip }; MainWindow = mainWindow; diff --git a/LenovoLegionToolkit.WPF/Flags.cs b/LenovoLegionToolkit.WPF/Flags.cs index d3b68881a9..84590ff940 100644 --- a/LenovoLegionToolkit.WPF/Flags.cs +++ b/LenovoLegionToolkit.WPF/Flags.cs @@ -11,6 +11,7 @@ public class Flags public bool IsTraceEnabled { get; } public bool Minimized { get; } public bool SkipCompatibilityCheck { get; } + public bool DisableTrayTooltip { get; } public bool AllowAllPowerModesOnBattery { get; } public bool ForceDisableRgbKeyboardSupport { get; } public bool ForceDisableSpectrumKeyboardSupport { get; } @@ -22,6 +23,7 @@ public Flags(IEnumerable startupArgs) IsTraceEnabled = args.Contains("--trace"); Minimized = args.Contains("--minimized"); SkipCompatibilityCheck = args.Contains("--skip-compat-check"); + DisableTrayTooltip = args.Contains("--disable-tray-tooltip"); AllowAllPowerModesOnBattery = args.Contains("--allow-all-power-modes-on-battery"); ForceDisableRgbKeyboardSupport = args.Contains("--force-disable-rgbkb"); ForceDisableSpectrumKeyboardSupport = args.Contains("--force-disable-spectrumkb"); diff --git a/LenovoLegionToolkit.WPF/Windows/MainWindow.xaml.cs b/LenovoLegionToolkit.WPF/Windows/MainWindow.xaml.cs index 0c9c4a5016..aef6104635 100644 --- a/LenovoLegionToolkit.WPF/Windows/MainWindow.xaml.cs +++ b/LenovoLegionToolkit.WPF/Windows/MainWindow.xaml.cs @@ -23,6 +23,8 @@ public partial class MainWindow private readonly ContextMenuHelper _contextMenuHelper = new(); + public bool TrayTooltipEnabled { get; init; } = true; + public bool SuppressClosingEventHandler { get; set; } public Snackbar Snackbar => _snackbar; @@ -54,17 +56,18 @@ private void InitializeTray() _trayIcon.ToolTipText = Resource.AppName; - _trayIcon.PreviewTrayToolTipOpen += (_, _) => + if (TrayTooltipEnabled) { - _trayIcon.TrayToolTip ??= new StatusTrayPopup(); - _trayIcon.TrayToolTipResolved.Style = null; - _trayIcon.TrayToolTipResolved.VerticalOffset = -8; - }; + _trayIcon.PreviewTrayToolTipOpen += (_, _) => + { + _trayIcon.TrayToolTip ??= new StatusTrayPopup(); + _trayIcon.TrayToolTipResolved.Style = null; + _trayIcon.TrayToolTipResolved.VerticalOffset = -8; + }; + } _trayIcon.PreviewTrayContextMenuOpen += (_, _) => _trayIcon.ContextMenu ??= _contextMenuHelper.ContextMenu; - _trayIcon.TrayLeftMouseUp += (_, _) => BringToForeground(); - _trayIcon.NoLeftClickDelay = true; }