diff --git a/Directory.Packages.props b/Directory.Packages.props
index 7912ed0cdf..7217b3c0fe 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -7,6 +7,7 @@
+
diff --git a/NOTICE.md b/NOTICE.md
index 1e6c6681b2..b927859099 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -284,6 +284,7 @@ SOFTWARE.
- CommunityToolkit.Labs.WinUI.SettingsControls 0.0.18
- CommunityToolkit.Mvvm 8.2.0
- CommunityToolkit.WinUI.UI 7.1.2
+- CommunityToolkit.WinUI.UI.Animations 7.1.2
- CommunityToolkit.WinUI.UI.Controls 7.1.2
- ControlzEx 5.0.1
- HelixToolkit 2.20.2
diff --git a/src/settings-ui/Settings.UI/App.xaml b/src/settings-ui/Settings.UI/App.xaml
index b4e581d64d..e32dfc58d1 100644
--- a/src/settings-ui/Settings.UI/App.xaml
+++ b/src/settings-ui/Settings.UI/App.xaml
@@ -3,9 +3,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
- xmlns:local="using:Microsoft.PowerToys.Settings.UI"
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
- xmlns:labs="using:CommunityToolkit.Labs.WinUI">
+ xmlns:labs="using:CommunityToolkit.Labs.WinUI"
+ xmlns:local="using:Microsoft.PowerToys.Settings.UI">
@@ -54,14 +54,17 @@
-
+
+
+
+
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/App.xaml.cs b/src/settings-ui/Settings.UI/App.xaml.cs
index ec57d0cf1e..98103dc833 100644
--- a/src/settings-ui/Settings.UI/App.xaml.cs
+++ b/src/settings-ui/Settings.UI/App.xaml.cs
@@ -85,6 +85,7 @@ namespace Microsoft.PowerToys.Settings.UI
}
settingsWindow.Activate();
+
if (type != null)
{
settingsWindow.NavigateToSection(type);
@@ -104,7 +105,6 @@ namespace Microsoft.PowerToys.Settings.UI
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
var cmdArgs = Environment.GetCommandLineArgs();
-
var isDark = IsDarkTheme();
if (cmdArgs != null && cmdArgs.Length >= RequiredArgumentsQty)
@@ -164,6 +164,7 @@ namespace Microsoft.PowerToys.Settings.UI
{
settingsWindow = new MainWindow(isDark);
settingsWindow.Activate();
+ settingsWindow.ExtendsContentIntoTitleBar = true;
settingsWindow.NavigateToSection(StartupPage);
// https://github.com/microsoft/microsoft-ui-xaml/issues/7595 - Activate doesn't bring window to the foreground
@@ -182,6 +183,7 @@ namespace Microsoft.PowerToys.Settings.UI
PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
OobeWindow oobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.Overview, isDark);
oobeWindow.Activate();
+ oobeWindow.ExtendsContentIntoTitleBar = true;
SetOobeWindow(oobeWindow);
}
else if (ShowScoobe)
@@ -189,6 +191,7 @@ namespace Microsoft.PowerToys.Settings.UI
PowerToysTelemetry.Log.WriteEvent(new ScoobeStartedEvent());
OobeWindow scoobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.WhatsNew, isDark);
scoobeWindow.Activate();
+ scoobeWindow.ExtendsContentIntoTitleBar = true;
SetOobeWindow(scoobeWindow);
}
else if (ShowFlyout)
@@ -208,7 +211,9 @@ namespace Microsoft.PowerToys.Settings.UI
// For debugging purposes
// Window is also needed to show MessageDialog
settingsWindow = new MainWindow(isDark);
+ settingsWindow.ExtendsContentIntoTitleBar = true;
settingsWindow.Activate();
+ settingsWindow.NavigateToSection(StartupPage);
#if !DEBUG
ShowMessageDialogAndExit("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden");
@@ -248,36 +253,43 @@ namespace Microsoft.PowerToys.Settings.UI
return ipcmanager;
}
- public static string SelectedTheme()
+ public static ElementTheme SelectedTheme()
{
- return SettingsRepository.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture);
+ switch (SettingsRepository.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture))
+ {
+ case "DARK": return ElementTheme.Dark;
+ case "LIGHT": return ElementTheme.Light;
+ default: return ElementTheme.Default;
+ }
}
public static bool IsDarkTheme()
{
var selectedTheme = SelectedTheme();
- return selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && ThemeHelpers.GetAppTheme() == AppTheme.Dark);
+ return selectedTheme == ElementTheme.Dark || (selectedTheme == ElementTheme.Default && ThemeHelpers.GetAppTheme() == AppTheme.Dark);
}
public static void HandleThemeChange()
{
try
{
- var isDark = IsDarkTheme();
+ bool isDark = IsDarkTheme();
+
if (settingsWindow != null)
{
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(settingsWindow);
ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark);
+ SetContentTheme(isDark, settingsWindow);
}
if (oobeWindow != null)
{
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(oobeWindow);
ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark);
+ SetContentTheme(isDark, oobeWindow);
}
- var selectedTheme = SelectedTheme();
- if (selectedTheme == "SYSTEM")
+ if (SelectedTheme() == ElementTheme.Default)
{
themeListener = new ThemeListener();
themeListener.ThemeChanged += (_) => HandleThemeChange();
@@ -298,6 +310,22 @@ namespace Microsoft.PowerToys.Settings.UI
}
}
+ public static void SetContentTheme(bool isDark, WindowEx window)
+ {
+ var rootGrid = (FrameworkElement)window.Content;
+ if (rootGrid != null)
+ {
+ if (isDark)
+ {
+ rootGrid.RequestedTheme = ElementTheme.Dark;
+ }
+ else
+ {
+ rootGrid.RequestedTheme = ElementTheme.Light;
+ }
+ }
+ }
+
private static ISettingsUtils settingsUtils = new SettingsUtils();
private static MainWindow settingsWindow;
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
index 1252811ccf..54f871a80a 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
+++ b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
@@ -46,7 +46,6 @@
-
-
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/MainWindow.xaml.cs b/src/settings-ui/Settings.UI/MainWindow.xaml.cs
index 896f95ed84..e26ec2683d 100644
--- a/src/settings-ui/Settings.UI/MainWindow.xaml.cs
+++ b/src/settings-ui/Settings.UI/MainWindow.xaml.cs
@@ -220,6 +220,8 @@ namespace Microsoft.PowerToys.Settings.UI
this.InitializeComponent();
+ SetTheme(isDark);
+
// receive IPC Message
App.IPCMessageReceivedCallback = (string msg) =>
{
@@ -279,5 +281,10 @@ namespace Microsoft.PowerToys.Settings.UI
{
ShellPage.EnsurePageIsSelected();
}
+
+ private void SetTheme(bool isDark)
+ {
+ shellPage.RequestedTheme = isDark ? ElementTheme.Dark : ElementTheme.Light;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
index 26dae05314..009d307459 100644
--- a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
+++ b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
@@ -2,22 +2,73 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
- xmlns:localModels="using:Microsoft.PowerToys.Settings.UI.OOBE.ViewModel"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI.UI"
HighContrastAdjustment="None"
+ Loaded="ShellPage_Loaded"
mc:Ignorable="d">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
index 58a5e099b6..3c2ab9549d 100644
--- a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
+++ b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
@@ -59,10 +59,9 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
InitializeComponent();
ExperimentationToggleSwitchEnabled = SettingsRepository.GetInstance(settingsUtils).SettingsConfig.EnableExperimentation;
-
+ SetTitleBar();
DataContext = ViewModel;
OobeShellHandler = this;
- UpdateUITheme();
Modules = new ObservableCollection();
Modules.Insert((int)PowerToysModules.Overview, new OobePowerToysModule()
@@ -190,7 +189,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
public void OnClosing()
{
- Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = this.NavigationView.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
+ Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = this.navigationView.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
if (selectedItem != null)
{
Modules[(int)(PowerToysModules)Enum.Parse(typeof(PowerToysModules), (string)selectedItem.Tag, true)].LogClosingModuleEvent();
@@ -201,11 +200,11 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
if (selectedModule == PowerToysModules.WhatsNew)
{
- NavigationView.SelectedItem = NavigationView.FooterMenuItems[0];
+ navigationView.SelectedItem = navigationView.FooterMenuItems[0];
}
else
{
- NavigationView.SelectedItem = NavigationView.MenuItems[(int)selectedModule];
+ navigationView.SelectedItem = navigationView.MenuItems[(int)selectedModule];
}
}
@@ -264,20 +263,42 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
}
}
- public void UpdateUITheme()
+ private void SetTitleBar()
{
- switch (SettingsRepository.GetInstance(new SettingsUtils()).SettingsConfig.Theme.ToUpperInvariant())
+ var u = App.GetOobeWindow();
+ if (u != null)
{
- case "LIGHT":
- this.RequestedTheme = ElementTheme.Light;
- break;
- case "DARK":
- this.RequestedTheme = ElementTheme.Dark;
- break;
- case "SYSTEM":
- this.RequestedTheme = ElementTheme.Default;
- break;
+ // A custom title bar is required for full window theme and Mica support.
+ // https://docs.microsoft.com/windows/apps/develop/title-bar?tabs=winui3#full-customization
+ u.ExtendsContentIntoTitleBar = true;
+ u.SetTitleBar(AppTitleBar);
}
}
+
+ private void ShellPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ SetTitleBar();
+ }
+
+ private void NavigationView_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
+ {
+ if (args.DisplayMode == NavigationViewDisplayMode.Compact || args.DisplayMode == NavigationViewDisplayMode.Minimal)
+ {
+ PaneToggleBtn.Visibility = Visibility.Visible;
+ AppTitleBar.Margin = new Thickness(48, 0, 0, 0);
+ AppTitleBarText.Margin = new Thickness(12, 0, 0, 0);
+ }
+ else
+ {
+ PaneToggleBtn.Visibility = Visibility.Collapsed;
+ AppTitleBar.Margin = new Thickness(16, 0, 0, 0);
+ AppTitleBarText.Margin = new Thickness(16, 0, 0, 0);
+ }
+ }
+
+ private void PaneToggleBtn_Click(object sender, RoutedEventArgs e)
+ {
+ navigationView.IsPaneOpen = !navigationView.IsPaneOpen;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/OobeWindow.xaml b/src/settings-ui/Settings.UI/OobeWindow.xaml
index 2a23faa589..4a5f4233de 100644
--- a/src/settings-ui/Settings.UI/OobeWindow.xaml
+++ b/src/settings-ui/Settings.UI/OobeWindow.xaml
@@ -1,17 +1,17 @@
-
-
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/OobeWindow.xaml.cs b/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
index 983f60e641..4ea99c3f1e 100644
--- a/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
+++ b/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
@@ -48,6 +48,8 @@ namespace Microsoft.PowerToys.Settings.UI
ThemeHelpers.SetImmersiveDarkMode(_hWnd, isDark);
}
+ SetTheme(isDark);
+
OverlappedPresenter presenter = _appWindow.Presenter as OverlappedPresenter;
presenter.IsMinimizable = false;
presenter.IsMaximizable = false;
@@ -118,5 +120,10 @@ namespace Microsoft.PowerToys.Settings.UI
mainWindow.CloseHiddenWindow();
}
}
+
+ private void SetTheme(bool isDark)
+ {
+ shellPage.RequestedTheme = isDark ? ElementTheme.Dark : ElementTheme.Light;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
index aee7efc542..decb2e5e71 100644
--- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
+++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
@@ -82,6 +82,7 @@
+
diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
index 552eb3a25f..6fcbbbe554 100644
--- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
+++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
@@ -2149,6 +2149,9 @@ From there, simply click on one of the supported files in the File Explorer and
Welcome to PowerToys
+
+
+ Welcome to PowerToys
PowerToys Settings
@@ -3529,6 +3532,9 @@ Activate by holding the key for the character you want to add an accent to, then
Maximum width (px)
px = pixels
+
+ PowerToys Settings
+
A lightning fast file preview feature for Windows.
diff --git a/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs b/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
index 92c3fd7da1..5d9051221c 100644
--- a/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
+++ b/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
+using Microsoft.PowerToys.Settings.UI.OOBE.Views;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@@ -94,12 +95,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
switch (themeName?.ToUpperInvariant())
{
case "LIGHT":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Light;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
break;
case "DARK":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Dark;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
break;
case "SYSTEM":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Default;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
break;
default:
diff --git a/src/settings-ui/Settings.UI/Views/ShellPage.xaml b/src/settings-ui/Settings.UI/Views/ShellPage.xaml
index df9ee29d8d..ade6679c92 100644
--- a/src/settings-ui/Settings.UI/Views/ShellPage.xaml
+++ b/src/settings-ui/Settings.UI/Views/ShellPage.xaml
@@ -2,6 +2,7 @@
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:animations="using:CommunityToolkit.WinUI.UI.Animations"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:i="using:Microsoft.Xaml.Interactivity"
@@ -10,11 +11,8 @@
xmlns:ui="using:CommunityToolkit.WinUI.UI"
xmlns:views="using:Microsoft.PowerToys.Settings.UI.Views"
HighContrastAdjustment="None"
+ Loaded="ShellPage_Loaded"
mc:Ignorable="d">
-
@@ -22,14 +20,61 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+