mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Settings][FancyZones] Rounded corners settings only on Windows 11 (#18151)
* rounded corners settings only on windows 11 * disable setting on win10
This commit is contained in:
committed by
GitHub
parent
1552e75df2
commit
dda0aa237c
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Library.CustomAction;
|
using Microsoft.PowerToys.Settings.UI.Library.CustomAction;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
||||||
@@ -135,5 +134,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH;
|
public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH;
|
||||||
|
|
||||||
|
public static bool Windows11()
|
||||||
|
{
|
||||||
|
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||||
@@ -26,6 +27,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
|
|
||||||
private string settingsConfigFileFolder = string.Empty;
|
private string settingsConfigFileFolder = string.Empty;
|
||||||
|
|
||||||
|
private bool _windows11;
|
||||||
|
|
||||||
private enum MoveWindowBehaviour
|
private enum MoveWindowBehaviour
|
||||||
{
|
{
|
||||||
MoveWindowBasedOnZoneIndex = 0,
|
MoveWindowBasedOnZoneIndex = 0,
|
||||||
@@ -112,6 +115,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
_zoneNumberColor = !string.IsNullOrEmpty(numberColor) ? numberColor : ConfigDefaults.DefaultFancyzonesNumberColor;
|
_zoneNumberColor = !string.IsNullOrEmpty(numberColor) ? numberColor : ConfigDefaults.DefaultFancyzonesNumberColor;
|
||||||
|
|
||||||
_isEnabled = GeneralSettingsConfig.Enabled.FancyZones;
|
_isEnabled = GeneralSettingsConfig.Enabled.FancyZones;
|
||||||
|
_windows11 = Helper.Windows11();
|
||||||
|
|
||||||
|
// Disable setting on windows 10
|
||||||
|
if (!_windows11 && DisableRoundCornersOnWindowSnap)
|
||||||
|
{
|
||||||
|
DisableRoundCornersOnWindowSnap = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _isEnabled;
|
private bool _isEnabled;
|
||||||
@@ -846,6 +856,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Windows11 => _windows11;
|
||||||
|
|
||||||
private void LaunchEditor()
|
private void LaunchEditor()
|
||||||
{
|
{
|
||||||
// send message to launch the zones editor;
|
// send message to launch the zones editor;
|
||||||
|
|||||||
@@ -2105,10 +2105,7 @@ From there, simply click on one of the supported files in the File Explorer and
|
|||||||
<data name="Shell_WhatsNew.Content" xml:space="preserve">
|
<data name="Shell_WhatsNew.Content" xml:space="preserve">
|
||||||
<value>What's new</value>
|
<value>What's new</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Description" xml:space="preserve">
|
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Content" xml:space="preserve">
|
||||||
<value>Works on Windows 11 </value>
|
|
||||||
</data>
|
|
||||||
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Header" xml:space="preserve">
|
|
||||||
<value>Disable round corners when window is snapped</value>
|
<value>Disable round corners when window is snapped</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<converters:BoolToObjectConverter x:Key="BoolToComboBoxIndexConverter" TrueValue="1" FalseValue="0"/>
|
<converters:BoolToObjectConverter x:Key="BoolToComboBoxIndexConverter" TrueValue="1" FalseValue="0"/>
|
||||||
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
|
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
|
||||||
<converters:BoolToVisibilityConverter x:Key="FalseToVisibleConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
<converters:BoolToVisibilityConverter x:Key="FalseToVisibleConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
||||||
|
<converters:BoolToVisibilityConverter x:Key="TrueToVisibleConverter" TrueValue="Visible" FalseValue="Collapsed"/>
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
|
|
||||||
<controls:SettingsPageControl x:Uid="FancyZones"
|
<controls:SettingsPageControl x:Uid="FancyZones"
|
||||||
@@ -189,10 +190,8 @@
|
|||||||
x:Uid="FancyZones_AllowPopupWindowSnap"/>
|
x:Uid="FancyZones_AllowPopupWindowSnap"/>
|
||||||
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
|
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
|
||||||
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowChildWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}"/>
|
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowChildWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}"/>
|
||||||
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
|
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.Windows11, Converter={StaticResource TrueToVisibleConverter}}"/>
|
||||||
<controls:CheckBoxWithDescriptionControl IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableRoundCornersOnWindowSnap}"
|
<CheckBox x:Uid="FancyZones_DisableRoundCornersOnWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableRoundCornersOnWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.Windows11, Converter={StaticResource TrueToVisibleConverter}}"/>
|
||||||
Margin="56, -2, 40, 14"
|
|
||||||
x:Uid="FancyZones_DisableRoundCornersOnWindowSnap"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</controls:SettingExpander.Content>
|
</controls:SettingExpander.Content>
|
||||||
|
|||||||
Reference in New Issue
Block a user