mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[PT Run] Option for override theme (#7355)
* option for override PT Run theme * fix startup theme detection and moved strings in resources * xaml fixed * fix title spacing * launcher theme fix moved theme enum removed settings direct access * missing files * theme manager dispose removed Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
committed by
GitHub
parent
6424667396
commit
146e7866a6
@@ -51,6 +51,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\interop\interop.vcxproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using ManagedCommon;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
@@ -44,6 +45,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("clear_input_on_launch")]
|
||||
public bool ClearInputOnLaunch { get; set; }
|
||||
|
||||
[JsonPropertyName("theme")]
|
||||
public Theme Theme { get; set; }
|
||||
|
||||
public PowerLauncherProperties()
|
||||
{
|
||||
OpenPowerLauncher = new HotkeySettings(false, false, true, false, 32);
|
||||
@@ -56,6 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
DisableDriveDetectionWarning = false;
|
||||
ClearInputOnLaunch = false;
|
||||
MaximumNumberOfResults = 4;
|
||||
Theme = Theme.System;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
@@ -13,6 +14,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
public class PowerLauncherViewModel : Observable
|
||||
{
|
||||
private bool _isDarkThemeRadioButtonChecked;
|
||||
private bool _isLightThemeRadioButtonChecked;
|
||||
private bool _isSystemThemeRadioButtonChecked;
|
||||
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private readonly ISettingsUtils _settingsUtils;
|
||||
@@ -63,6 +68,19 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
settings.Properties.MaximumNumberOfResults = 4;
|
||||
callback(settings);
|
||||
}
|
||||
|
||||
switch (settings.Properties.Theme)
|
||||
{
|
||||
case Theme.Light:
|
||||
_isLightThemeRadioButtonChecked = true;
|
||||
break;
|
||||
case Theme.Dark:
|
||||
_isDarkThemeRadioButtonChecked = true;
|
||||
break;
|
||||
case Theme.System:
|
||||
_isSystemThemeRadioButtonChecked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public PowerLauncherViewModel(PowerLauncherSettings settings, SendCallback callback)
|
||||
@@ -149,6 +167,63 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDarkThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isDarkThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
settings.Properties.Theme = Theme.Dark;
|
||||
_isDarkThemeRadioButtonChecked = value;
|
||||
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLightThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isLightThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
settings.Properties.Theme = Theme.Light;
|
||||
_isDarkThemeRadioButtonChecked = value;
|
||||
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSystemThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSystemThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
settings.Properties.Theme = Theme.System;
|
||||
_isDarkThemeRadioButtonChecked = value;
|
||||
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenPowerLauncher
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user