hide tray icon (close #563)

This commit is contained in:
jhdxr
2018-12-19 11:46:27 +08:00
parent 7fe01f0764
commit 3dac6fd1c3
5 changed files with 23 additions and 1 deletions

View File

@@ -44,6 +44,16 @@ namespace Wox.Infrastructure.UserSettings
public bool StartWoxOnSystemStartup { get; set; } = true; public bool StartWoxOnSystemStartup { get; set; } = true;
public bool HideOnStartup { get; set; } 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 LeaveCmdOpen { get; set; }
public bool HideWhenDeactive { get; set; } public bool HideWhenDeactive { get; set; }
public bool RememberLastLaunchLocation { get; set; } public bool RememberLastLaunchLocation { get; set; }

View File

@@ -32,6 +32,7 @@
<system:String x:Key="autoUpdates">Auto Update</system:String> <system:String x:Key="autoUpdates">Auto Update</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String> <system:String x:Key="selectPythonDirectory">Select</system:String>
<system:String x:Key="hideOnStartup">Hide Wox on startup</system:String> <system:String x:Key="hideOnStartup">Hide Wox on startup</system:String>
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
<!--Setting Plugin--> <!--Setting Plugin-->
<system:String x:Key="plugin">Plugin</system:String> <system:String x:Key="plugin">Plugin</system:String>

View File

@@ -32,6 +32,7 @@
<system:String x:Key="autoUpdates">自动更新</system:String> <system:String x:Key="autoUpdates">自动更新</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String> <system:String x:Key="selectPythonDirectory">Select</system:String>
<system:String x:Key="hideOnStartup">启动时不显示主窗口</system:String> <system:String x:Key="hideOnStartup">启动时不显示主窗口</system:String>
<system:String x:Key="hideNotifyIcon">隐藏任务栏图标</system:String>
<!--设置,插件--> <!--设置,插件-->
<system:String x:Key="plugin">插件</system:String> <system:String x:Key="plugin">插件</system:String>

View File

@@ -85,6 +85,13 @@ namespace Wox
} }
} }
}; };
_settings.PropertyChanged += (o, e) =>
{
if (e.PropertyName == nameof(Settings.HideNotifyIcon))
{
_notifyIcon.Visible = !_settings.HideNotifyIcon;
}
};
InitializePosition(); InitializePosition();
} }
@@ -102,7 +109,7 @@ namespace Wox
{ {
Text = Infrastructure.Constant.Wox, Text = Infrastructure.Constant.Wox,
Icon = Properties.Resources.app, Icon = Properties.Resources.app,
Visible = true Visible = !_settings.HideNotifyIcon
}; };
var menu = new ContextMenuStrip(); var menu = new ContextMenuStrip();
var items = menu.Items; var items = menu.Items;

View File

@@ -42,6 +42,9 @@
<CheckBox Margin="10" IsChecked="{Binding Settings.HideWhenDeactive}"> <CheckBox Margin="10" IsChecked="{Binding Settings.HideWhenDeactive}">
<TextBlock Text="{DynamicResource hideWoxWhenLoseFocus}" /> <TextBlock Text="{DynamicResource hideWoxWhenLoseFocus}" />
</CheckBox> </CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.HideNotifyIcon}">
<TextBlock Text="{DynamicResource hideNotifyIcon}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.RememberLastLaunchLocation}"> <CheckBox Margin="10" IsChecked="{Binding Settings.RememberLastLaunchLocation}">
<TextBlock Text="{DynamicResource rememberLastLocation}" /> <TextBlock Text="{DynamicResource rememberLastLocation}" />
</CheckBox> </CheckBox>