[Always on top] Transparent border (#28127)

This commit is contained in:
Seraphima Zykova
2023-08-25 11:31:51 +03:00
committed by GitHub
parent 738072f508
commit b3532b8c91
10 changed files with 66 additions and 18 deletions

View File

@@ -15,6 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public const int DefaultFrameThickness = 15;
public const string DefaultFrameColor = "#0099cc";
public const bool DefaultFrameAccentColor = true;
public const int DefaultFrameOpacity = 100;
public const bool DefaultSoundEnabled = true;
public const bool DefaultDoNotActivateOnGameMode = true;
public const bool DefaultRoundCornersEnabled = true;
@@ -26,6 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
FrameThickness = new IntProperty(DefaultFrameThickness);
FrameColor = new StringProperty(DefaultFrameColor);
FrameAccentColor = new BoolProperty(DefaultFrameAccentColor);
FrameOpacity = new IntProperty(DefaultFrameOpacity);
SoundEnabled = new BoolProperty(DefaultSoundEnabled);
DoNotActivateOnGameMode = new BoolProperty(DefaultDoNotActivateOnGameMode);
RoundCornersEnabled = new BoolProperty(DefaultRoundCornersEnabled);
@@ -44,6 +46,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("frame-color")]
public StringProperty FrameColor { get; set; }
[JsonPropertyName("frame-opacity")]
public IntProperty FrameOpacity { get; set; }
[JsonPropertyName("frame-accent-color")]
public BoolProperty FrameAccentColor { get; set; }

View File

@@ -80,6 +80,15 @@
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.FrameAccentColor, Converter={StaticResource ReverseBoolToVisibilityConverter}}">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FrameColor, Mode=TwoWay}" />
</labs:SettingsCard>
<labs:SettingsCard
x:Uid="AlwaysOnTop_FrameOpacity"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.FrameEnabled}">
<Slider
MinWidth="{StaticResource SettingActionControlMinWidth}"
Maximum="100"
Minimum="0"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FrameOpacity}" />
</labs:SettingsCard>
<labs:SettingsCard
x:Uid="AlwaysOnTop_FrameThickness"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.FrameEnabled}">

View File

@@ -3655,4 +3655,7 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="Run_PluginUseFindMorePlugins.Content" xml:space="preserve">
<value>Find more plugins</value>
</data>
<data name="AlwaysOnTop_FrameOpacity.Header" xml:space="preserve">
<value>Opacity (%)</value>
</data>
</root>

View File

@@ -55,6 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_frameEnabled = Settings.Properties.FrameEnabled.Value;
_frameThickness = Settings.Properties.FrameThickness.Value;
_frameColor = Settings.Properties.FrameColor.Value;
_frameOpacity = Settings.Properties.FrameOpacity.Value;
_frameAccentColor = Settings.Properties.FrameAccentColor.Value;
_soundEnabled = Settings.Properties.SoundEnabled.Value;
_doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value;
@@ -188,6 +189,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public int FrameOpacity
{
get => _frameOpacity;
set
{
if (value != _frameOpacity)
{
_frameOpacity = value;
Settings.Properties.FrameOpacity.Value = value;
NotifyPropertyChanged();
}
}
}
public bool SoundEnabled
{
get => _soundEnabled;
@@ -293,6 +309,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private int _frameThickness;
private string _frameColor;
private bool _frameAccentColor;
private int _frameOpacity;
private bool _soundEnabled;
private bool _doNotActivateOnGameMode;
private bool _roundCornersEnabled;