From 3dac6fd1c39ba9893b6a480168571157905b7204 Mon Sep 17 00:00:00 2001 From: jhdxr Date: Wed, 19 Dec 2018 11:46:27 +0800 Subject: [PATCH] hide tray icon (close #563) --- Wox.Infrastructure/UserSettings/Settings.cs | 10 ++++++++++ Wox/Languages/en.xaml | 1 + Wox/Languages/zh-cn.xaml | 1 + Wox/MainWindow.xaml.cs | 9 ++++++++- Wox/SettingWindow.xaml | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Wox.Infrastructure/UserSettings/Settings.cs b/Wox.Infrastructure/UserSettings/Settings.cs index 7a040cd5e..8e72a2487 100644 --- a/Wox.Infrastructure/UserSettings/Settings.cs +++ b/Wox.Infrastructure/UserSettings/Settings.cs @@ -44,6 +44,16 @@ public class Settings : BaseModel public bool StartWoxOnSystemStartup { get; set; } = true; public bool HideOnStartup { get; set; } + bool _hideNotifyIcon { get; set; } + public bool HideNotifyIcon + { + get { return _hideNotifyIcon; } + set + { + _hideNotifyIcon = value; + OnPropertyChanged(); + } + } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactive { get; set; } public bool RememberLastLaunchLocation { get; set; } diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index ddc40b2d4..7431d1da5 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -32,6 +32,7 @@ Auto Update Select Hide Wox on startup + Hide tray icon Plugin diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index d471a4111..9b3bff0c7 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -32,6 +32,7 @@ 自动更新 Select 启动时不显示主窗口 + 隐藏任务栏图标 插件 diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 2b84bb890..427f641a4 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -85,6 +85,13 @@ private void OnLoaded(object sender, RoutedEventArgs _) } } }; + _settings.PropertyChanged += (o, e) => + { + if (e.PropertyName == nameof(Settings.HideNotifyIcon)) + { + _notifyIcon.Visible = !_settings.HideNotifyIcon; + } + }; InitializePosition(); } @@ -102,7 +109,7 @@ private void InitializeNotifyIcon() { Text = Infrastructure.Constant.Wox, Icon = Properties.Resources.app, - Visible = true + Visible = !_settings.HideNotifyIcon }; var menu = new ContextMenuStrip(); var items = menu.Items; diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 35b02cebd..bf25e3e60 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -42,6 +42,9 @@ + + +