mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
close #65 Hide when app loses focus
This commit is contained in:
@@ -71,6 +71,9 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public bool LeaveCmdOpen { get; set; }
|
public bool LeaveCmdOpen { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public bool HideWhenDeactive { get; set; }
|
||||||
|
|
||||||
public List<WebSearch> LoadDefaultWebSearches()
|
public List<WebSearch> LoadDefaultWebSearches()
|
||||||
{
|
{
|
||||||
List<WebSearch> webSearches = new List<WebSearch>();
|
List<WebSearch> webSearches = new List<WebSearch>();
|
||||||
@@ -142,6 +145,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||||||
Opacity = 1;
|
Opacity = 1;
|
||||||
OpacityMode = OpacityMode.Normal;
|
OpacityMode = OpacityMode.Normal;
|
||||||
LeaveCmdOpen = false;
|
LeaveCmdOpen = false;
|
||||||
|
HideWhenDeactive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
Loaded="MainWindow_OnLoaded"
|
Loaded="MainWindow_OnLoaded"
|
||||||
SizeToContent="Height"
|
SizeToContent="Height"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
|
Deactivated="MainWindow_OnDeactivated"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
WindowStartupLocation="Manual"
|
WindowStartupLocation="Manual"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
|
|||||||
@@ -299,7 +299,13 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MainWindow_OnDeactivated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (UserSettingStorage.Instance.HideWhenDeactive)
|
||||||
|
{
|
||||||
|
HideWox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
|
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
|
||||||
{
|
{
|
||||||
@@ -554,5 +560,7 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,10 @@
|
|||||||
<CheckBox x:Name="cbLeaveCmdOpen" />
|
<CheckBox x:Name="cbLeaveCmdOpen" />
|
||||||
<TextBlock Text="Do not close Command Prompt after command execution" />
|
<TextBlock Text="Do not close Command Prompt after command execution" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="10">
|
||||||
|
<CheckBox x:Name="cbHideWhenDeactive" />
|
||||||
|
<TextBlock Text="Hide Wox when loses focus" />
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Features">
|
<TabItem Header="Features">
|
||||||
|
|||||||
@@ -87,6 +87,18 @@ namespace Wox
|
|||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cbHideWhenDeactive.Checked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.HideWhenDeactive = true;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
|
||||||
|
cbHideWhenDeactive.Unchecked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.HideWhenDeactive = false;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
|
||||||
#region Load Theme Data
|
#region Load Theme Data
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) &&
|
if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) &&
|
||||||
@@ -179,6 +191,7 @@ namespace Wox
|
|||||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||||
cbEnableBookmarkPlugin.IsChecked = UserSettingStorage.Instance.EnableBookmarkPlugin;
|
cbEnableBookmarkPlugin.IsChecked = UserSettingStorage.Instance.EnableBookmarkPlugin;
|
||||||
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
|
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
|
||||||
|
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
|
||||||
|
|
||||||
var features = new CompositeCollection
|
var features = new CompositeCollection
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user