Settings Flyout improvement (#43840)

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request introduces the new Quick Access feature to PowerToys
by integrating its host process management into the runner and system
tray. The changes add the Quick Access host implementation, update
project and build files to include it, and modify the runner and tray
icon logic to launch and interact with the Quick Access UI.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #43694
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **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

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
<img width="290" height="420" alt="image"
src="https://github.com/user-attachments/assets/7390a706-171c-479f-a4a2-999b18cfc65f"
/>

<img width="290" height="420" alt="image"
src="https://github.com/user-attachments/assets/99e99bc9-b1a3-46c6-b648-81e3048dec1b"
/>

<img width="490" height="350" alt="image"
src="https://github.com/user-attachments/assets/2cce4ad6-a54e-4587-87b7-fdc7fba1f54f"
/>

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
This commit is contained in:
Shawn Yuan
2026-01-07 16:38:09 +08:00
committed by GitHub
parent 19c9b4e1fd
commit 9086995eeb
89 changed files with 3916 additions and 1388 deletions

View File

@@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Lib="using:Microsoft.PowerToys.Settings.UI.Library"
xmlns:controlConverters="using:Microsoft.PowerToys.Settings.UI.Controls.Converters"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -19,7 +20,8 @@
x:Key="ModuleItemTemplateSelector"
ActivationTemplate="{StaticResource ModuleItemActivationTemplate}"
ShortcutTemplate="{StaticResource ModuleItemShortcutTemplate}" />
<converters:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
<controlConverters:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
<converters:EnumToModuleListSortOptionConverter x:Key="EnumToModuleListSortOptionConverter" />
<DataTemplate x:Key="ModuleItemShortcutTemplate" x:DataType="viewmodels:DashboardModuleShortcutItem">
<Grid MinHeight="36" ColumnSpacing="12">
<Grid.ColumnDefinitions>
@@ -159,64 +161,17 @@
</Grid.RowDefinitions>
<controls:Card x:Uid="QuickAccessTitle" VerticalAlignment="Top">
<Grid>
<ItemsControl
<controls:QuickAccessList
x:Name="QuickAccessItemsControl"
Margin="8,0,12,12"
ItemsSource="{x:Bind ViewModel.ActionModules, Mode=OneWay}"
Visibility="{x:Bind ViewModel.ActionModules.Count, Mode=OneWay, Converter={StaticResource DoubleToVisibilityConverter}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<tkcontrols:WrapPanel
Padding="12"
HorizontalSpacing="16"
VerticalSpacing="24" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewmodels:DashboardListItem">
<ItemsControl IsTabStop="False" ItemsSource="{x:Bind DashboardModuleItems, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewmodels:DashboardModuleButtonItem">
<controls:FlyoutMenuButton AutomationProperties.Name="{x:Bind ButtonTitle}" Click="{x:Bind ButtonClickHandler}">
<controls:FlyoutMenuButton.Content>
<TextBlock
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ButtonTitle}"
TextAlignment="Center"
TextWrapping="Wrap" />
</controls:FlyoutMenuButton.Content>
<controls:FlyoutMenuButton.Icon>
<Image Width="24">
<Image.Source>
<BitmapImage UriSource="{x:Bind ButtonGlyph}" />
</Image.Source>
</Image>
</controls:FlyoutMenuButton.Icon>
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind ButtonDescription}" />
</ToolTipService.ToolTip>
</controls:FlyoutMenuButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Spacing="0" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
ItemsSource="{x:Bind ViewModel.QuickAccessItems, Mode=OneWay}"
Visibility="{x:Bind ViewModel.QuickAccessItems.Count, Mode=OneWay, Converter={StaticResource DoubleToVisibilityConverter}}" />
<TextBlock
x:Uid="NoActionsToShow"
Margin="12"
HorizontalAlignment="Left"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Visibility="{x:Bind ViewModel.ActionModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
Visibility="{x:Bind ViewModel.QuickAccessItems.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
</Grid>
</controls:Card>
<controls:Card
@@ -270,7 +225,6 @@
</Grid>
</controls:Card>
<controls:Card
x:Name="ModulesCard"
x:Uid="UtilitiesHeader"
Grid.RowSpan="2"
Grid.Column="1"
@@ -304,68 +258,11 @@
</Button.Flyout>
</Button>
</controls:Card.TitleContent>
<ItemsRepeater
x:Name="DashboardView"
<controls:ModuleList
x:Name="ModulesCard"
Grid.Row="1"
ItemsSource="{x:Bind ViewModel.AllModules, Mode=OneWay}">
<ItemsRepeater.Layout>
<StackLayout Orientation="Vertical" Spacing="0" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="viewmodels:DashboardListItem">
<tkcontrols:SettingsCard
MinHeight="0"
Padding="12,4,12,4"
AutomationProperties.Name="{x:Bind Label}"
Background="Transparent"
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
BorderThickness="0,1,0,0"
Click="DashboardListItemClick"
CornerRadius="0"
IsClickEnabled="True"
Tag="{x:Bind Tag}">
<tkcontrols:SettingsCard.Resources>
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
<x:Double x:Key="SettingsCardHeaderIconMaxSize">16</x:Double>
</tkcontrols:SettingsCard.Resources>
<tkcontrols:SettingsCard.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Bind Label}" />
<InfoBadge
Margin="4,0,0,0"
Style="{StaticResource NewInfoBadge}"
Visibility="{x:Bind IsNew, Converter={StaticResource BoolToVisibilityConverter}}" />
<FontIcon
Grid.Column="2"
Width="20"
Margin="0,0,-12,0"
FontSize="16"
Glyph="&#xE72E;"
Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="GPO_SettingIsManaged_ToolTip" TextWrapping="WrapWholeWords" />
</ToolTipService.ToolTip>
</FontIcon>
</StackPanel>
</tkcontrols:SettingsCard.Header>
<tkcontrols:SettingsCard.HeaderIcon>
<ImageIcon>
<ImageIcon.Source>
<BitmapImage UriSource="{x:Bind Icon}" />
</ImageIcon.Source>
</ImageIcon>
</tkcontrols:SettingsCard.HeaderIcon>
<ToggleSwitch
AutomationProperties.Name="{x:Bind Label}"
IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}"
IsOn="{x:Bind IsEnabled, Mode=TwoWay}"
OffContent=""
OnContent="" />
</tkcontrols:SettingsCard>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
ItemsSource="{x:Bind ViewModel.AllModules, Mode=OneWay}"
SortOption="{x:Bind ViewModel.DashboardSortOrder, Mode=TwoWay, Converter={StaticResource EnumToModuleListSortOptionConverter}}" />
</controls:Card>
</Grid>
</Grid>

View File

@@ -48,11 +48,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
ViewModel.ModuleEnabledChangedOnSettingsPage();
}
private void DashboardListItemClick(object sender, RoutedEventArgs e)
{
ViewModel.DashboardListItemClick(sender);
}
private void WhatsNewButton_Click(object sender, RoutedEventArgs e)
{
if (App.GetOobeWindow() == null)

View File

@@ -291,6 +291,28 @@
Toggled="ShowSystemTrayIcon_Toggled" />
</tkcontrols:SettingsCard>
</controls:GPOInfoControl>
<tkcontrols:SettingsExpander
Name="GeneralPageEnableQuickAccess"
x:Uid="GeneralPage_EnableQuickAccess"
HeaderIcon="{ui:FontIcon Glyph=&#xE91C;}"
IsExpanded="True">
<ToggleSwitch
x:Uid="ToggleSwitch"
AutomationProperties.Name="{Binding ElementName=GeneralPageEnableQuickAccess, Path=Header}"
IsOn="{x:Bind ViewModel.EnableQuickAccess, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<!-- HACK: For some weird reason, a ShortcutControl does not work correctly if it's the first or last item in the expander, so we add an invisible card. -->
<tkcontrols:SettingsCard Visibility="Collapsed" />
<tkcontrols:SettingsCard
Name="QuickAccessShortcut"
x:Uid="GeneralPage_QuickAccessShortcut"
IsEnabled="{x:Bind ViewModel.EnableQuickAccess, Mode=OneWay}">
<controls:ShortcutControl HotkeySettings="{x:Bind ViewModel.QuickAccessShortcut, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Visibility="Collapsed" />
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="General_SettingsBackupAndRestoreTitle" Visibility="Visible">

View File

@@ -6,7 +6,6 @@ using System;
using System.Threading;
using System.Threading.Tasks;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Flyout;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.ViewModels;
@@ -94,6 +93,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
CheckBugReportStatus();
doRefreshBackupRestoreStatus(100);
this.Loaded += (s, e) => ViewModel.OnPageLoaded();
}
private void OpenColorsSettings_Click(object sender, RoutedEventArgs e)
@@ -176,8 +177,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void BugReportToolClicked(object sender, RoutedEventArgs e)
{
// Start bug report
var launchPage = new LaunchPage();
launchPage.ReportBugBtn_Click(sender, e);
ShellPage.SendDefaultIPCMessage("{\"bugreport\": 0 }");
ViewModel.IsBugReportRunning = true;

View File

@@ -58,16 +58,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// </summary>
public delegate void WhatIsNewOpeningCallback();
/// <summary>
/// Declaration for opening flyout window callback function.
/// </summary>
public delegate void FlyoutOpeningCallback(POINT? point);
/// <summary>
/// Declaration for disabling hide of flyout window callback function.
/// </summary>
public delegate void DisablingFlyoutHidingCallback();
/// <summary>
/// Gets or sets a shell handler to be used to update contents of the shell dynamically from page within the frame.
/// </summary>
@@ -108,16 +98,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// </summary>
public static WhatIsNewOpeningCallback OpenWhatIsNewWindowCallback { get; set; }
/// <summary>
/// Gets or sets callback function for opening flyout window
/// </summary>
public static FlyoutOpeningCallback OpenFlyoutCallback { get; set; }
/// <summary>
/// Gets or sets callback function for disabling hide of flyout window
/// </summary>
public static DisablingFlyoutHidingCallback DisableFlyoutHidingCallback { get; set; }
/// <summary>
/// Gets view model.
/// </summary>
@@ -261,24 +241,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
OpenWhatIsNewWindowCallback = implementation;
}
/// <summary>
/// Set flyout opening callback function
/// </summary>
/// <param name="implementation">delegate function implementation.</param>
public static void SetOpenFlyoutCallback(FlyoutOpeningCallback implementation)
{
OpenFlyoutCallback = implementation;
}
/// <summary>
/// Set disable flyout hiding callback function
/// </summary>
/// <param name="implementation">delegate function implementation.</param>
public static void SetDisableFlyoutHidingCallback(DisablingFlyoutHidingCallback implementation)
{
DisableFlyoutHidingCallback = implementation;
}
public static void SetElevationStatus(bool isElevated)
{
IsElevated = isElevated;
@@ -399,25 +361,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
IJsonValue whatToShowJson;
if (json.TryGetValue("ShowYourself", out whatToShowJson))
{
if (whatToShowJson.ValueType == JsonValueType.String && whatToShowJson.GetString().Equals("flyout", StringComparison.Ordinal))
{
POINT? p = null;
IJsonValue flyoutPointX;
IJsonValue flyoutPointY;
if (json.TryGetValue("x_position", out flyoutPointX) && json.TryGetValue("y_position", out flyoutPointY))
{
if (flyoutPointX.ValueType == JsonValueType.Number && flyoutPointY.ValueType == JsonValueType.Number)
{
int flyout_x = (int)flyoutPointX.GetNumber();
int flyout_y = (int)flyoutPointY.GetNumber();
p = new POINT(flyout_x, flyout_y);
}
}
OpenFlyoutCallback(p);
}
else if (whatToShowJson.ValueType == JsonValueType.String)
if (whatToShowJson.ValueType == JsonValueType.String)
{
OpenMainWindowCallback(App.GetPage(whatToShowJson.GetString()));
}