mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Peek]Add setting to close after losing focus (#26364)
* [Peek] WindowActivationState checks are added for focus and close after losing focus. * Add setting to activate the behavior --------- Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
@@ -2843,6 +2843,10 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Tries to run Peek without elevated permissions, to fix access to network shares. You need to disable and re-enable Peek for changes to this value to take effect.</value>
|
||||
<comment>Peek is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="Peek_CloseAfterLosingFocus.Header" xml:space="preserve">
|
||||
<value>Automatically close the Peek window after it loses focus</value>
|
||||
<comment>Peek is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Content" xml:space="preserve">
|
||||
<value>Disable round corners when window is snapped</value>
|
||||
</data>
|
||||
|
||||
@@ -123,6 +123,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CloseAfterLosingFocus
|
||||
{
|
||||
get => _peekSettings.Properties.CloseAfterLosingFocus.Value;
|
||||
set
|
||||
{
|
||||
if (_peekSettings.Properties.CloseAfterLosingFocus.Value != value)
|
||||
{
|
||||
_peekSettings.Properties.CloseAfterLosingFocus.Value = value;
|
||||
OnPropertyChanged(nameof(CloseAfterLosingFocus));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifySettingsChanged()
|
||||
{
|
||||
// Using InvariantCulture as this is an IPC message
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.AlwaysRunNotElevated}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard x:Uid="Peek_CloseAfterLosingFocus">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.CloseAfterLosingFocus}" />
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user