[FancyZones] Child windows support (#16507)

This commit is contained in:
Seraphima Zykova
2022-02-23 17:25:28 +03:00
committed by GitHub
parent d9c98bbc29
commit 8edfb8fe80
37 changed files with 1204 additions and 1477 deletions

View File

@@ -43,6 +43,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
FancyzonesNextTabHotkey = new KeyboardKeysProperty(DefaultNextTabHotkeyValue);
FancyzonesPrevTabHotkey = new KeyboardKeysProperty(DefaultPrevTabHotkeyValue);
FancyzonesMakeDraggedWindowTransparent = new BoolProperty();
FancyzonesAllowPopupWindowSnap = new BoolProperty();
FancyzonesAllowChildWindowSnap = new BoolProperty();
FancyzonesExcludedApps = new StringProperty();
FancyzonesInActiveColor = new StringProperty(ConfigDefaults.DefaultFancyZonesInActiveColor);
FancyzonesBorderColor = new StringProperty(ConfigDefaults.DefaultFancyzonesBorderColor);
@@ -102,6 +104,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("fancyzones_makeDraggedWindowTransparent")]
public BoolProperty FancyzonesMakeDraggedWindowTransparent { get; set; }
[JsonPropertyName("fancyzones_allowPopupWindowSnap")]
public BoolProperty FancyzonesAllowPopupWindowSnap { get; set; }
[JsonPropertyName("fancyzones_allowChildWindowSnap")]
public BoolProperty FancyzonesAllowChildWindowSnap { get; set; }
[JsonPropertyName("fancyzones_zoneHighlightColor")]
public StringProperty FancyzonesZoneHighlightColor { get; set; }

View File

@@ -84,6 +84,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
_spanZonesAcrossMonitors = Settings.Properties.FancyzonesSpanZonesAcrossMonitors.Value;
_makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value;
_allowPopupWindowSnap = Settings.Properties.FancyzonesAllowPopupWindowSnap.Value;
_allowChildWindowSnap = Settings.Properties.FancyzonesAllowChildWindowSnap.Value;
_highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
_excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
_systemTheme = Settings.Properties.FancyzonesSystemTheme.Value;
@@ -131,6 +133,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _makeDraggedWindowTransparent;
private bool _systemTheme;
private bool _showZoneNumber;
private bool _allowPopupWindowSnap;
private bool _allowChildWindowSnap;
private int _highlightOpacity;
private string _excludedApps;
@@ -562,6 +566,42 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool AllowPopupWindowSnap
{
get
{
return _allowPopupWindowSnap;
}
set
{
if (value != _allowPopupWindowSnap)
{
_allowPopupWindowSnap = value;
Settings.Properties.FancyzonesAllowPopupWindowSnap.Value = value;
NotifyPropertyChanged();
}
}
}
public bool AllowChildWindowSnap
{
get
{
return _allowChildWindowSnap;
}
set
{
if (value != _allowChildWindowSnap)
{
_allowChildWindowSnap = value;
Settings.Properties.FancyzonesAllowChildWindowSnap.Value = value;
NotifyPropertyChanged();
}
}
}
// For the following setters we use OrdinalIgnoreCase string comparison since
// we expect value to be a hex code.
public string ZoneHighlightColor

View File

@@ -2050,4 +2050,13 @@ From there, simply click on one of the supported files in the File Explorer and
<value>Attribution</value>
<comment>giving credit to the projects this utility was based on</comment>
</data>
<data name="FancyZones_AllowPopupWindowSnap.Description" xml:space="preserve">
<value>This setting can affect all popup windows including notifications</value>
</data>
<data name="FancyZones_AllowPopupWindowSnap.Header" xml:space="preserve">
<value>Allow popup windows snapping</value>
</data>
<data name="FancyZones_AllowChildWindowSnap.Content" xml:space="preserve">
<value>Allow child windows snapping</value>
</data>
</root>

View File

@@ -183,6 +183,12 @@
<CheckBox x:Uid="FancyZones_RestoreSize" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.RestoreSize}" Margin="{StaticResource ExpanderSettingMargin}"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox x:Uid="FancyZones_MakeDraggedWindowTransparentCheckBoxControl" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MakeDraggedWindowsTransparent}" Margin="{StaticResource ExpanderSettingMargin}"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<controls:CheckBoxWithDescriptionControl IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowPopupWindowSnap}"
Margin="56, -2, 40, 14"
x:Uid="FancyZones_AllowPopupWindowSnap"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowChildWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}"/>
</StackPanel>
</controls:SettingExpander.Content>