mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 02:06:36 +02:00
[AlwaysOnTop] Round corners on Windows 11 (#19109)
* check window corners * draw rounded rectangle * draw rounded corners * switch between rounded and not rounded rects * added enabled corners setting * update corner
This commit is contained in:
@@ -14,9 +14,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public const bool DefaultFrameEnabled = true;
|
||||
public const int DefaultFrameThickness = 15;
|
||||
public const string DefaultFrameColor = "#0099cc";
|
||||
public const bool DefaultFrameAccentColor = true;
|
||||
public const bool DefaultSoundEnabled = true;
|
||||
public const bool DefaultDoNotActivateOnGameMode = true;
|
||||
public const bool DefaultFrameAccentColor = true;
|
||||
public const bool DefaultRoundCornersEnabled = true;
|
||||
|
||||
public AlwaysOnTopProperties()
|
||||
{
|
||||
@@ -24,10 +25,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
FrameEnabled = new BoolProperty(DefaultFrameEnabled);
|
||||
FrameThickness = new IntProperty(DefaultFrameThickness);
|
||||
FrameColor = new StringProperty(DefaultFrameColor);
|
||||
FrameAccentColor = new BoolProperty(DefaultFrameAccentColor);
|
||||
SoundEnabled = new BoolProperty(DefaultSoundEnabled);
|
||||
DoNotActivateOnGameMode = new BoolProperty(DefaultDoNotActivateOnGameMode);
|
||||
RoundCornersEnabled = new BoolProperty(DefaultRoundCornersEnabled);
|
||||
ExcludedApps = new StringProperty();
|
||||
FrameAccentColor = new BoolProperty(DefaultFrameAccentColor);
|
||||
}
|
||||
|
||||
[JsonPropertyName("hotkey")]
|
||||
@@ -42,6 +44,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("frame-color")]
|
||||
public StringProperty FrameColor { get; set; }
|
||||
|
||||
[JsonPropertyName("frame-accent-color")]
|
||||
public BoolProperty FrameAccentColor { get; set; }
|
||||
|
||||
[JsonPropertyName("sound-enabled")]
|
||||
public BoolProperty SoundEnabled { get; set; }
|
||||
|
||||
@@ -51,8 +56,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("excluded-apps")]
|
||||
public StringProperty ExcludedApps { get; set; }
|
||||
|
||||
[JsonPropertyName("frame-accent-color")]
|
||||
public BoolProperty FrameAccentColor { get; set; }
|
||||
[JsonPropertyName("round-corners-enabled")]
|
||||
public BoolProperty RoundCornersEnabled { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
@@ -51,10 +52,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
_frameEnabled = Settings.Properties.FrameEnabled.Value;
|
||||
_frameThickness = Settings.Properties.FrameThickness.Value;
|
||||
_frameColor = Settings.Properties.FrameColor.Value;
|
||||
_frameAccentColor = Settings.Properties.FrameAccentColor.Value;
|
||||
_soundEnabled = Settings.Properties.SoundEnabled.Value;
|
||||
_doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value;
|
||||
_roundCornersEnabled = Settings.Properties.RoundCornersEnabled.Value;
|
||||
_excludedApps = Settings.Properties.ExcludedApps.Value;
|
||||
_frameAccentColor = Settings.Properties.FrameAccentColor.Value;
|
||||
_windows11 = Helper.Windows11();
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
@@ -186,6 +189,21 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool RoundCornersEnabled
|
||||
{
|
||||
get => _roundCornersEnabled;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _roundCornersEnabled)
|
||||
{
|
||||
_roundCornersEnabled = value;
|
||||
Settings.Properties.RoundCornersEnabled.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ExcludedApps
|
||||
{
|
||||
get => _excludedApps;
|
||||
@@ -216,6 +234,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool Windows11
|
||||
{
|
||||
get => _windows11;
|
||||
|
||||
set
|
||||
{
|
||||
_windows11 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
@@ -227,9 +255,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
private bool _frameEnabled;
|
||||
private int _frameThickness;
|
||||
private string _frameColor;
|
||||
private bool _frameAccentColor;
|
||||
private bool _soundEnabled;
|
||||
private bool _doNotActivateOnGameMode;
|
||||
private bool _roundCornersEnabled;
|
||||
private string _excludedApps;
|
||||
private bool _frameAccentColor;
|
||||
private bool _windows11;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user