Skip to content

Commit

Permalink
hide tray icon (close #563)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdxr committed Dec 19, 2018
1 parent 7fe01f0 commit 3dac6fd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Wox.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions Wox/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<system:String x:Key="autoUpdates">Auto Update</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="hideNotifyIcon">Hide tray icon</system:String>

<!--Setting Plugin-->
<system:String x:Key="plugin">Plugin</system:String>
Expand Down
1 change: 1 addition & 0 deletions Wox/Languages/zh-cn.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<system:String x:Key="autoUpdates">自动更新</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String>
<system:String x:Key="hideOnStartup">启动时不显示主窗口</system:String>
<system:String x:Key="hideNotifyIcon">隐藏任务栏图标</system:String>

<!--设置,插件-->
<system:String x:Key="plugin">插件</system:String>
Expand Down
9 changes: 8 additions & 1 deletion Wox/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ private void OnLoaded(object sender, RoutedEventArgs _)
}
}
};
_settings.PropertyChanged += (o, e) =>

This comment has been minimized.

Copy link
@zhao-xu

zhao-xu Jan 5, 2019

Contributor

原来是这样处理的
了却一桩心事,谢谢

This comment has been minimized.

Copy link
@jhdxr

jhdxr Jan 5, 2019

Author Member

哈哈,不用谢

{
if (e.PropertyName == nameof(Settings.HideNotifyIcon))
{
_notifyIcon.Visible = !_settings.HideNotifyIcon;
}
};
InitializePosition();
}

Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions Wox/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<CheckBox Margin="10" IsChecked="{Binding Settings.HideWhenDeactive}">
<TextBlock Text="{DynamicResource hideWoxWhenLoseFocus}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.HideNotifyIcon}">
<TextBlock Text="{DynamicResource hideNotifyIcon}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.RememberLastLaunchLocation}">
<TextBlock Text="{DynamicResource rememberLastLocation}" />
</CheckBox>
Expand Down

0 comments on commit 3dac6fd

Please sign in to comment.