From 446d1baa6f0ea978dc92f7b8ca41e00f56c44886 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Thu, 16 Oct 2025 08:38:28 +0200 Subject: [PATCH] [CmdPal] Settings UX tweaks (#42303) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary of the Pull Request Clean up of the Settings app with some minor styling changes. - Moved activation key related settings into the Activation expander. - On the Extensions page, seperated the alias settings for improved a11y - Added a card to the extensions settings frame image ## PR Checklist - [ ] Closes: #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --------- Co-authored-by: Jiří Polášek --- .../cmdpal/Microsoft.CmdPal.UI/App.xaml | 4 +- .../CheckBoxWithDescriptionControl.cs | 76 +++++++++++++++++++ .../Controls/IsEnabledTextBlock.xaml | 43 +++++++++++ .../Controls/IsEnabledTextBlock.xaml.cs | 51 +++++++++++++ .../Microsoft.CmdPal.UI.csproj | 14 ++++ .../Settings/ExtensionPage.xaml | 69 ++++++++++------- .../Settings/ExtensionsPage.xaml | 3 - .../Settings/GeneralPage.xaml | 12 ++- .../Strings/en-us/Resources.resw | 21 +++-- .../Microsoft.CmdPal.UI/Styles/Settings.xaml | 2 +- .../Microsoft.CmdPal.UI/Themes/Generic.xaml | 1 - 11 files changed, 250 insertions(+), 46 deletions(-) create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/CheckBoxWithDescriptionControl.cs create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IsEnabledTextBlock.xaml create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IsEnabledTextBlock.xaml.cs delete mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Themes/Generic.xaml diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml index 745dc31d95..f9a9e37ea1 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml @@ -3,6 +3,7 @@ x:Class="Microsoft.CmdPal.UI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:controls="using:Microsoft.CmdPal.UI.Controls" xmlns:local="using:Microsoft.CmdPal.UI"> @@ -15,11 +16,12 @@ + 240 - + + + \ No newline at end of file diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IsEnabledTextBlock.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IsEnabledTextBlock.xaml.cs new file mode 100644 index 0000000000..ffe65bc9f9 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IsEnabledTextBlock.xaml.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.CmdPal.UI.Controls; + +[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] +[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] +public partial class IsEnabledTextBlock : Control +{ + public IsEnabledTextBlock() + { + this.Style = (Style)App.Current.Resources["DefaultIsEnabledTextBlockStyle"]; + } + + protected override void OnApplyTemplate() + { + IsEnabledChanged -= IsEnabledTextBlock_IsEnabledChanged; + SetEnabledState(); + IsEnabledChanged += IsEnabledTextBlock_IsEnabledChanged; + base.OnApplyTemplate(); + } + + public static readonly DependencyProperty TextProperty = DependencyProperty.Register( + "Text", + typeof(string), + typeof(IsEnabledTextBlock), + null); + + [Localizable(true)] + public string Text + { + get => (string)GetValue(TextProperty); + set => SetValue(TextProperty, value); + } + + private void IsEnabledTextBlock_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + SetEnabledState(); + } + + private void SetEnabledState() + { + VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true); + } +} diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj index b41f20a5a1..f577f13898 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj @@ -66,7 +66,9 @@ + + @@ -180,6 +182,18 @@ PreserveNewest + + + + MSBuild:Compile + + + + + + MSBuild:Compile + + MSBuild:Compile diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionPage.xaml index 5a495a2a21..72b51fd724 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionPage.xaml @@ -33,6 +33,10 @@ x:Key="StringEmptyToBoolConverter" EmptyValue="False" NotEmptyValue="True" /> + @@ -47,22 +51,34 @@ MaxWidth="1000" HorizontalAlignment="Stretch" Spacing="{StaticResource SettingsCardSpacing}"> - - + + + + + + + + + + + + + + - - - - - @@ -84,22 +100,22 @@ - - + - - - - - - + + + + + + + + - @@ -130,11 +146,8 @@ - - - @@ -145,8 +158,13 @@ Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Visibility="{x:Bind ViewModel.HasSettings}" /> - - + - - - diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionsPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionsPage.xaml index 56ec56fe20..f798134c10 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionsPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionsPage.xaml @@ -25,7 +25,6 @@ MaxWidth="1000" HorizontalAlignment="Stretch" Spacing="{StaticResource SettingsCardSpacing}"> - @@ -47,9 +46,7 @@ - - diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/GeneralPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/GeneralPage.xaml index 21cee5407c..121b478189 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/GeneralPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/GeneralPage.xaml @@ -37,22 +37,20 @@ - - - - + + + + + - - - diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Strings/en-us/Resources.resw b/src/modules/cmdpal/Microsoft.CmdPal.UI/Strings/en-us/Resources.resw index 76734a5568..ec7ce8b68c 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Strings/en-us/Resources.resw +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Strings/en-us/Resources.resw @@ -257,8 +257,8 @@ Right-click to remove the key combination, thereby deactivating the shortcut.Disabled Displayed when an extension is disabled - - Enable this extension + + Enable Displayed on a toggle controlling the extension's enabled / disabled state @@ -312,7 +312,13 @@ Right-click to remove the key combination, thereby deactivating the shortcut.Alias - Typing this alias will navigate to this command. Direct aliases navigate as soon as you type the alias. Indirect aliases navigate after typing a trailing space. + A short keyword used to navigate to this command. + + + Alias activation + + + Choose when the alias runs. Direct runs as soon as you type the alias. Indirect runs after a trailing space. Built-in @@ -429,12 +435,15 @@ Right-click to remove the key combination, thereby deactivating the shortcut.Close Close as a verb, as in Close the application - + Direct - + Indirect + + Enter alias + Show status messages @@ -454,7 +463,7 @@ Right-click to remove the key combination, thereby deactivating the shortcut.Trigger reload of the extension externally with the x-cmdpal://reload command - For Developers + For developers an untitled diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Styles/Settings.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Styles/Settings.xaml index 0413bbe5cb..89c01814eb 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Styles/Settings.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Styles/Settings.xaml @@ -2,7 +2,7 @@ - + 4 diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Themes/Generic.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Themes/Generic.xaml deleted file mode 100644 index 6903d112e3..0000000000 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Themes/Generic.xaml +++ /dev/null @@ -1 +0,0 @@ -