diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs index a89b46e6d7..8c9befc026 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs @@ -80,14 +80,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels // normalization for switch statements switch (GeneralSettingsConfig.Theme.ToUpperInvariant()) { - case "LIGHT": - _isLightThemeRadioButtonChecked = true; - break; case "DARK": - _isDarkThemeRadioButtonChecked = true; + _themeIndex = 0; + break; + case "LIGHT": + _themeIndex = 1; break; case "SYSTEM": - _isSystemThemeRadioButtonChecked = true; + _themeIndex = 2; break; } @@ -116,9 +116,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels private bool _isElevated; private bool _runElevated; private bool _isAdmin; - private bool _isDarkThemeRadioButtonChecked; - private bool _isLightThemeRadioButtonChecked; - private bool _isSystemThemeRadioButtonChecked; + private int _themeIndex; + private bool _autoDownloadUpdates; private UpdatingSettings.UpdatingState _updatingState = UpdatingSettings.UpdatingState.UpToDate; @@ -255,86 +254,76 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels } } - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsDarkThemeRadioButtonChecked + public int ThemeIndex { get { - return _isDarkThemeRadioButtonChecked; + return _themeIndex; } set { - if (value == true) + if (_themeIndex != value) { - GeneralSettingsConfig.Theme = "dark"; - _isDarkThemeRadioButtonChecked = value; - try + if (value == 0) { - UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); - } - catch (Exception e) - { - Logger.LogError("Exception encountered when changing Settings theme", e); + // set theme to dark. + GeneralSettingsConfig.Theme = "dark"; + _themeIndex = value; + + try + { + UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception e) +#pragma warning restore CA1031 // Do not catch general exception types + { + Logger.LogError("Exception encountered when changing Settings theme", e); + } + + NotifyPropertyChanged(); } - NotifyPropertyChanged(); - } - } - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsLightThemeRadioButtonChecked - { - get - { - return _isLightThemeRadioButtonChecked; - } - - set - { - if (value == true) - { - GeneralSettingsConfig.Theme = "light"; - _isLightThemeRadioButtonChecked = value; - try + if (value == 1) { - UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); - } - catch (Exception e) - { - Logger.LogError("Exception encountered when changing Settings theme", e); + // set theme to light. + GeneralSettingsConfig.Theme = "light"; + _themeIndex = value; + + try + { + UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception e) +#pragma warning restore CA1031 // Do not catch general exception types + { + Logger.LogError("Exception encountered when changing Settings theme", e); + } + + NotifyPropertyChanged(); } - NotifyPropertyChanged(); - } - } - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsSystemThemeRadioButtonChecked - { - get - { - return _isSystemThemeRadioButtonChecked; - } - - set - { - if (value == true) - { - GeneralSettingsConfig.Theme = "system"; - _isSystemThemeRadioButtonChecked = value; - try + if (value == 2) { - UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); - } - catch (Exception e) - { - Logger.LogError("Exception encountered when changing Settings theme", e); - } + // set theme to system default. + GeneralSettingsConfig.Theme = "system"; + _themeIndex = value; - NotifyPropertyChanged(); + try + { + UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception e) +#pragma warning restore CA1031 // Do not catch general exception types + { + Logger.LogError("Exception encountered when changing Settings theme", e); + } + + NotifyPropertyChanged(); + } } } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml index 13c642c4b5..3ae04a51c8 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml @@ -6,25 +6,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - AutomationProperties.Name="{x:Bind Header, Mode=OneTime}" + d:DesignHeight="300" d:DesignWidth="400"> - - - - - - - - - - - - - - + IsReadOnly="True"/> + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml index 475ed49610..9d3f5afab7 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml @@ -22,7 +22,16 @@ HorizontalAlignment="Stretch" VerticalAlignment="Center" MinHeight="48"> - + + + + + + + + + + @@ -70,8 +79,9 @@ diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml index 4b15fede1e..9ba04c5b1e 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml @@ -43,7 +43,7 @@ - + @@ -60,7 +60,7 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}" TextWrapping="Wrap"/> - + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 8477a68757..6d05fda60c 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -362,9 +362,6 @@ Disabling this module or closing PowerToys will unmute the microphone and camera Maximum number of results - - Shortcuts - Open PowerToys Run @@ -508,8 +505,11 @@ Disabling this module or closing PowerToys will unmute the microphone and camera Restart as administrator running PowerToys as a higher level user, account is typically referred to as an admin / administrator - + Run at startup + + + PowerToys will launch automatically A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions. @@ -574,7 +574,7 @@ Disabling this module or closing PowerToys will unmute the microphone and camera Press duration before showing (ms) pressing a key in milliseconds - + Appearance & behavior @@ -584,11 +584,11 @@ Disabling this module or closing PowerToys will unmute the microphone and camera Opacity of background - - Disable for apps + + Exclude apps - - Turn off Shortcut Guide when these applications have focus. Add one application name per line. + + Turns off Shortcut Guide when these applications have focus. Add one application name per line. Example: outlook.exe @@ -901,7 +901,7 @@ Made with 💗 by Microsoft and the PowerToys community. Example: %1 (%2) - + Choose a mode @@ -916,7 +916,7 @@ Made with 💗 by Microsoft and the PowerToys community. Windows default Windows refers to the Operating system - + Windows color settings Windows refers to the Operating system @@ -1087,7 +1087,7 @@ Made with 💗 by Microsoft and the PowerToys community. Quick layout switch - Open Shortcut Guide + Activation shortcut Let's get started! diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/SettingsSectionStyles.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/SettingsSectionStyles.xaml index ceb5fd32e0..72d7f4e806 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/SettingsSectionStyles.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/SettingsSectionStyles.xaml @@ -5,11 +5,10 @@ - + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml index 9413ea3143..f071b6e7ee 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml @@ -7,6 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" xmlns:localConverters="using:Microsoft.PowerToys.Settings.UI.Converters" + xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d" AutomationProperties.LandmarkType="Main"> @@ -58,31 +59,53 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HorizontalAlignment="Stretch"> diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml index 4a7fa12162..952775d735 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml @@ -5,7 +5,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" - xmlns:muxc="using:Microsoft.UI.Xaml.Controls" + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" + xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" mc:Ignorable="d" AutomationProperties.LandmarkType="Main"> @@ -21,84 +22,82 @@ - + x:Name="ShortcutGuideView"> - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +