mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
<!-- 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 Based on https://github.com/microsoft/PowerToys/pull/40260#issuecomment-3085099815 feedback, this PR remove the title bar shutdown button in favor of a menu item in the navigation view footer. - Menu item is visible only when tray icon is hidden - A confirm dialog has been added <img width="848" height="448" alt="image" src="https://github.com/user-attachments/assets/529bcfa9-94ed-48b1-b2bb-ca6993d12e0f" /> <img width="848" height="448" alt="image" src="https://github.com/user-attachments/assets/febafbb4-3a5b-4b04-8065-28f0d269ab6c" /> - Close is used in tray icon menu for closing app <img alt="image" src="https://github.com/user-attachments/assets/3ac79a8c-961f-4f95-8967-adef00aba77b" /> <img alt="image" src="https://github.com/user-attachments/assets/c2800a77-c733-41a9-aa4f-fa4c2afd30a3" /> <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #40346 #40577 - [x] **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 - [x] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Open settings with tray icon visible: close menu is hidden - Open settings with tray icon hidden: close menu is visible - Tested close menu visibility change when tray icon option is changed - Tested cancel button of close dialog - Tested close button of dialog --------- Co-authored-by: Niels Laute <niels.laute@live.nl>
301 lines
16 KiB
XML
301 lines
16 KiB
XML
<UserControl
|
|
x:Class="Microsoft.PowerToys.Settings.UI.Views.ShellPage"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
|
|
xmlns:animations="using:CommunityToolkit.WinUI.Animations"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:helpers="using:Microsoft.PowerToys.Settings.UI.Helpers"
|
|
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
|
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:ui="using:CommunityToolkit.WinUI"
|
|
xmlns:views="using:Microsoft.PowerToys.Settings.UI.Views"
|
|
HighContrastAdjustment="None"
|
|
Loaded="ShellPage_Loaded"
|
|
mc:Ignorable="d">
|
|
|
|
<i:Interaction.Behaviors>
|
|
<ic:EventTriggerBehavior EventName="Loaded">
|
|
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
|
|
</ic:EventTriggerBehavior>
|
|
</i:Interaction.Behaviors>
|
|
|
|
<Grid x:Name="RootGrid">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="48" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Button
|
|
x:Name="PaneToggleBtn"
|
|
Width="48"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Click="PaneToggleBtn_Click"
|
|
Style="{StaticResource PaneToggleButtonStyle}" />
|
|
<Grid
|
|
x:Name="AppTitleBar"
|
|
Height="{Binding ElementName=navigationView, Path=CompactPaneLength}"
|
|
Margin="48,0,0,0"
|
|
VerticalAlignment="Top"
|
|
IsHitTestVisible="True">
|
|
<animations:Implicit.Animations>
|
|
<animations:OffsetAnimation Duration="0:0:0.3" />
|
|
</animations:Implicit.Animations>
|
|
<StackPanel Orientation="Horizontal">
|
|
<Image
|
|
Width="16"
|
|
Height="16"
|
|
HorizontalAlignment="Left"
|
|
Source="/Assets/Settings/icon.ico" />
|
|
<TextBlock
|
|
x:Name="AppTitleBarText"
|
|
Margin="12,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Style="{StaticResource CaptionTextBlockStyle}"
|
|
TextWrapping="NoWrap" />
|
|
<TextBlock
|
|
x:Name="DebugMessage"
|
|
Margin="8,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
Style="{StaticResource CaptionTextBlockStyle}"
|
|
Text="Debug"
|
|
TextWrapping="NoWrap"
|
|
Visibility="Collapsed" />
|
|
</StackPanel>
|
|
</Grid>
|
|
<NavigationView
|
|
x:Name="navigationView"
|
|
Grid.Row="1"
|
|
Canvas.ZIndex="0"
|
|
CompactModeThresholdWidth="1007"
|
|
DisplayModeChanged="NavigationView_DisplayModeChanged"
|
|
ExpandedModeThresholdWidth="1007"
|
|
IsBackButtonVisible="Collapsed"
|
|
IsBackEnabled="{x:Bind ViewModel.IsBackEnabled, Mode=OneWay}"
|
|
IsPaneToggleButtonVisible="False"
|
|
IsSettingsVisible="False"
|
|
IsTitleBarAutoPaddingEnabled="False"
|
|
PaneClosed="NavigationView_PaneClosed"
|
|
PaneOpened="NavigationView_PaneOpened"
|
|
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"
|
|
SelectionChanged="NavigationView_SelectionChanged">
|
|
<NavigationView.Resources>
|
|
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
|
|
<SolidColorBrush x:Key="NavigationViewContentGridBorderBrush" Color="Transparent" />
|
|
</NavigationView.Resources>
|
|
<NavigationView.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_Dashboard"
|
|
helpers:NavHelper.NavigateTo="views:DashboardPage"
|
|
Icon="{ui:FontIcon Glyph=}" />
|
|
|
|
<NavigationViewItem x:Uid="Shell_General" helpers:NavHelper.NavigateTo="views:GeneralPage">
|
|
<NavigationViewItem.Icon>
|
|
<AnimatedIcon>
|
|
<AnimatedIcon.Source>
|
|
<animatedVisuals:AnimatedSettingsVisualSource />
|
|
</AnimatedIcon.Source>
|
|
<AnimatedIcon.FallbackIconSource>
|
|
<SymbolIconSource Symbol="Setting" />
|
|
</AnimatedIcon.FallbackIconSource>
|
|
</AnimatedIcon>
|
|
</NavigationViewItem.Icon>
|
|
</NavigationViewItem>
|
|
<NavigationViewItemSeparator />
|
|
|
|
<!-- System Tools -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TopLevelSystemTools"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/SystemTools.png}"
|
|
SelectsOnInvoked="False">
|
|
<NavigationViewItem.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_AdvancedPaste"
|
|
helpers:NavHelper.NavigateTo="views:AdvancedPastePage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AdvancedPaste.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_Awake"
|
|
helpers:NavHelper.NavigateTo="views:AwakePage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Awake.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_CmdPal"
|
|
helpers:NavHelper.NavigateTo="views:CmdPalPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CmdPal.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_ColorPicker"
|
|
helpers:NavHelper.NavigateTo="views:ColorPickerPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ColorPicker.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_PowerLauncher"
|
|
helpers:NavHelper.NavigateTo="views:PowerLauncherPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_MeasureTool"
|
|
helpers:NavHelper.NavigateTo="views:MeasureToolPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_ShortcutGuide"
|
|
helpers:NavHelper.NavigateTo="views:ShortcutGuidePage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ShortcutGuide.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TextExtractor"
|
|
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_ZoomIt"
|
|
helpers:NavHelper.NavigateTo="views:ZoomItPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ZoomIt.png}" />
|
|
</NavigationViewItem.MenuItems>
|
|
</NavigationViewItem>
|
|
|
|
<!-- Windowing & Layouts -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TopLevelWindowsAndLayouts "
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/WindowingAndLayouts.png}"
|
|
SelectsOnInvoked="False">
|
|
<NavigationViewItem.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_AlwaysOnTop"
|
|
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AlwaysOnTop.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_CropAndLock"
|
|
helpers:NavHelper.NavigateTo="views:CropAndLockPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CropAndLock.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_FancyZones"
|
|
helpers:NavHelper.NavigateTo="views:FancyZonesPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FancyZones.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_Workspaces"
|
|
helpers:NavHelper.NavigateTo="views:WorkspacesPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}" />
|
|
</NavigationViewItem.MenuItems>
|
|
</NavigationViewItem>
|
|
|
|
<!-- Input / Output -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TopLevelInputOutput"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/InputOutput.png}"
|
|
SelectsOnInvoked="False">
|
|
<NavigationViewItem.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_KeyboardManager"
|
|
helpers:NavHelper.NavigateTo="views:KeyboardManagerPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/KeyboardManager.png}" />
|
|
<!-- Find my mouse -->
|
|
<!-- Mouse Highlighter -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_MouseUtilities"
|
|
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseUtils.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_MouseWithoutBorders"
|
|
helpers:NavHelper.NavigateTo="views:MouseWithoutBordersPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseWithoutBorders.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_QuickAccent"
|
|
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
|
|
</NavigationViewItem.MenuItems>
|
|
</NavigationViewItem>
|
|
|
|
<!-- File Management -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TopLevelFileManagement"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileManagement.png}"
|
|
SelectsOnInvoked="False">
|
|
<NavigationViewItem.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_PowerPreview"
|
|
helpers:NavHelper.NavigateTo="views:PowerPreviewPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileExplorerPreview.png}" />
|
|
<!-- File Explorer Thumbnails -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_FileLocksmith"
|
|
helpers:NavHelper.NavigateTo="views:FileLocksmithPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileLocksmith.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_ImageResizer"
|
|
helpers:NavHelper.NavigateTo="views:ImageResizerPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ImageResizer.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="NewPlus_Product_Name"
|
|
helpers:NavHelper.NavigateTo="views:NewPlusPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_Peek"
|
|
helpers:NavHelper.NavigateTo="views:PeekPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_PowerRename"
|
|
helpers:NavHelper.NavigateTo="views:PowerRenamePage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}" />
|
|
</NavigationViewItem.MenuItems>
|
|
</NavigationViewItem>
|
|
|
|
<!-- Advanced -->
|
|
<NavigationViewItem
|
|
x:Uid="Shell_TopLevelAdvanced"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Advanced.png}"
|
|
SelectsOnInvoked="False">
|
|
<NavigationViewItem.MenuItems>
|
|
<NavigationViewItem
|
|
x:Uid="Shell_CmdNotFound"
|
|
helpers:NavHelper.NavigateTo="views:CmdNotFoundPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CommandNotFound.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_EnvironmentVariables"
|
|
helpers:NavHelper.NavigateTo="views:EnvironmentVariablesPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/EnvironmentVariables.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_Hosts"
|
|
helpers:NavHelper.NavigateTo="views:HostsPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Hosts.png}" />
|
|
<NavigationViewItem
|
|
x:Uid="Shell_RegistryPreview"
|
|
helpers:NavHelper.NavigateTo="views:RegistryPreviewPage"
|
|
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/RegistryPreview.png}" />
|
|
</NavigationViewItem.MenuItems>
|
|
</NavigationViewItem>
|
|
</NavigationView.MenuItems>
|
|
<NavigationView.PaneFooter>
|
|
<StackPanel Orientation="Vertical">
|
|
<NavigationViewItem
|
|
x:Uid="OOBE_NavViewItem"
|
|
Icon="{ui:FontIcon Glyph=}"
|
|
Tapped="OOBEItem_Tapped" />
|
|
<NavigationViewItem
|
|
x:Uid="WhatIsNew_NavViewItem"
|
|
Icon="{ui:FontIcon Glyph=}"
|
|
Tapped="WhatIsNewItem_Tapped" />
|
|
<NavigationViewItem
|
|
x:Uid="Feedback_NavViewItem"
|
|
Icon="{ui:FontIcon Glyph=}"
|
|
Tapped="FeedbackItem_Tapped" />
|
|
<NavigationViewItem
|
|
x:Uid="Close_NavViewItem"
|
|
Icon="{ui:FontIcon Glyph=}"
|
|
Tapped="Close_Tapped"
|
|
Visibility="{x:Bind ViewModel.ShowCloseMenu, Mode=OneWay}" />
|
|
</StackPanel>
|
|
</NavigationView.PaneFooter>
|
|
<i:Interaction.Behaviors>
|
|
<ic:EventTriggerBehavior EventName="ItemInvoked">
|
|
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemInvokedCommand}" />
|
|
</ic:EventTriggerBehavior>
|
|
</i:Interaction.Behaviors>
|
|
<Frame x:Name="shellFrame" />
|
|
</NavigationView>
|
|
<ContentDialog
|
|
x:Name="CloseDialog"
|
|
x:Uid="CloseDialog"
|
|
IsPrimaryButtonEnabled="True"
|
|
IsSecondaryButtonEnabled="True"
|
|
PrimaryButtonClick="CloseDialog_Click"
|
|
PrimaryButtonStyle="{StaticResource AccentButtonStyle}" />
|
|
</Grid>
|
|
</UserControl>
|