diff --git a/src/common/Common.UI/SettingsDeepLink.cs b/src/common/Common.UI/SettingsDeepLink.cs index 1a154f0a82..97547c4292 100644 --- a/src/common/Common.UI/SettingsDeepLink.cs +++ b/src/common/Common.UI/SettingsDeepLink.cs @@ -28,6 +28,7 @@ namespace Common.UI PowerOCR, RegistryPreview, CropAndLock, + Dashboard, } private static string SettingsWindowNameToString(SettingsWindow value) @@ -68,6 +69,8 @@ namespace Common.UI return "RegistryPreview"; case SettingsWindow.CropAndLock: return "CropAndLock"; + case SettingsWindow.Dashboard: + return "Dashboard"; default: { return string.Empty; diff --git a/src/runner/main.cpp b/src/runner/main.cpp index eb1fb48503..fab4a6500b 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -81,7 +81,7 @@ inline wil::unique_mutex_nothrow create_msi_mutex() void open_menu_from_another_instance(std::optional settings_window) { const HWND hwnd_main = FindWindowW(L"PToyTrayIconWindow", nullptr); - LPARAM msg = static_cast(ESettingsWindowNames::Overview); + LPARAM msg = static_cast(ESettingsWindowNames::Dashboard); if (settings_window.has_value() && settings_window.value() != "") { msg = static_cast(ESettingsWindowNames_from_string(settings_window.value())); diff --git a/src/runner/settings_window.cpp b/src/runner/settings_window.cpp index bcba0915b1..f7f8d5df63 100644 --- a/src/runner/settings_window.cpp +++ b/src/runner/settings_window.cpp @@ -596,7 +596,7 @@ void open_settings_window(std::optional settings_window, bool show } else { - current_settings_ipc->send(L"{\"ShowYourself\":\"Overview\"}"); + current_settings_ipc->send(L"{\"ShowYourself\":\"Dashboard\"}"); } } } @@ -676,6 +676,8 @@ std::string ESettingsWindowNames_to_string(ESettingsWindowNames value) return "RegistryPreview"; case ESettingsWindowNames::CropAndLock: return "CropAndLock"; + case ESettingsWindowNames::Dashboard: + return "Dashboard"; default: { Logger::error(L"Can't convert ESettingsWindowNames value={} to string", static_cast(value)); @@ -755,11 +757,15 @@ ESettingsWindowNames ESettingsWindowNames_from_string(std::string value) { return ESettingsWindowNames::CropAndLock; } + else if (value == "Dashboard") + { + return ESettingsWindowNames::Dashboard; + } else { Logger::error(L"Can't convert string value={} to ESettingsWindowNames", winrt::to_hstring(value)); assert(false); } - return ESettingsWindowNames::Overview; + return ESettingsWindowNames::Dashboard; } diff --git a/src/runner/settings_window.h b/src/runner/settings_window.h index 2a14ec46e0..06aac30dc8 100644 --- a/src/runner/settings_window.h +++ b/src/runner/settings_window.h @@ -4,7 +4,8 @@ enum class ESettingsWindowNames { - Overview = 0, + Dashboard = 0, + Overview, Awake, ColorPicker, FancyZones, diff --git a/src/settings-ui/Settings.UI/Converters/ModuleItemTemplateSelector.cs b/src/settings-ui/Settings.UI/Converters/ModuleItemTemplateSelector.cs new file mode 100644 index 0000000000..b34331a0e7 --- /dev/null +++ b/src/settings-ui/Settings.UI/Converters/ModuleItemTemplateSelector.cs @@ -0,0 +1,33 @@ +// 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 Microsoft.PowerToys.Settings.UI.ViewModels; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Converters +{ + public class ModuleItemTemplateSelector : DataTemplateSelector + { + public DataTemplate TextTemplate { get; set; } + + public DataTemplate ButtonTemplate { get; set; } + + public DataTemplate ShortcutTemplate { get; set; } + + public DataTemplate KBMTemplate { get; set; } + + protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) + { + switch (item) + { + case DashboardModuleButtonItem: return ButtonTemplate; + case DashboardModuleShortcutItem: return ShortcutTemplate; + case DashboardModuleTextItem: return TextTemplate; + case DashboardModuleKBMItem: return KBMTemplate; + default: return TextTemplate; + } + } + } +} diff --git a/src/settings-ui/Settings.UI/Converters/NegativeBoolToVisibilityConverter.cs b/src/settings-ui/Settings.UI/Converters/NegativeBoolToVisibilityConverter.cs new file mode 100644 index 0000000000..df9f02eca7 --- /dev/null +++ b/src/settings-ui/Settings.UI/Converters/NegativeBoolToVisibilityConverter.cs @@ -0,0 +1,37 @@ +// 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; +using System.Globalization; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; + +namespace Microsoft.PowerToys.Settings.UI.Converters +{ + public class NegativeBoolToVisibilityConverter : IValueConverter + { + object IValueConverter.Convert(object value, Type targetType, object parameter, string language) + { + if ((bool)value) + { + return Visibility.Collapsed; + } + + return Visibility.Visible; + } + + object IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language) + { + if (value is Visibility) + { + if ((Visibility)value == Visibility.Visible) + { + return false; + } + } + + return true; + } + } +} diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index 98be30ec56..e601b11886 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -21,6 +21,9 @@ PowerToys.Settings.pri + + + @@ -124,5 +127,11 @@ Always + + + + $(DefaultXamlRuntime) + + - + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs index ba9988dd2d..ea02e1779e 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs @@ -60,7 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI public bool ShowScoobe { get; set; } - public Type StartupPage { get; set; } = typeof(Views.GeneralPage); + public Type StartupPage { get; set; } = typeof(Views.DashboardPage); public static Action IPCMessageReceivedCallback { get; set; } @@ -218,8 +218,8 @@ namespace Microsoft.PowerToys.Settings.UI settingsWindow.NavigateToSection(StartupPage); ShowMessageDialog("The application is running in Debug mode.", "DEBUG"); #else - /* If we try to run Settings as a standalone app, it will start PowerToys.exe if not running and open Settings again through it in the General page. */ - SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.Overview, true); + /* If we try to run Settings as a standalone app, it will start PowerToys.exe if not running and open Settings again through it in the Dashboard page. */ + SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.Dashboard, true); Exit(); #endif } @@ -380,6 +380,7 @@ namespace Microsoft.PowerToys.Settings.UI { switch (settingWindow) { + case "Dashboard": return typeof(DashboardPage); case "Overview": return typeof(GeneralPage); case "AlwaysOnTop": return typeof(AlwaysOnTopPage); case "Awake": return typeof(AwakePage); @@ -404,9 +405,9 @@ namespace Microsoft.PowerToys.Settings.UI case "Peek": return typeof(PeekPage); case "CropAndLock": return typeof(CropAndLockPage); default: - // Fallback to general + // Fallback to Dashboard Debug.Assert(false, "Unexpected SettingsWindow argument value"); - return typeof(GeneralPage); + return typeof(DashboardPage); } } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs index 5e5d3ee846..8b36831984 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs @@ -116,7 +116,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls case 91: // The left Windows key case 92: // The right Windows key - PathIcon winIcon = XamlReader.Load(@"") as PathIcon; + PathIcon winIcon = XamlReader.Load(@"") as PathIcon; Viewbox winIconContainer = new Viewbox(); winIconContainer.Child = winIcon; winIconContainer.HorizontalAlignment = HorizontalAlignment.Center; @@ -143,6 +143,10 @@ namespace Microsoft.PowerToys.Settings.UI.Controls { return (Style)App.Current.Resources["SmallOutline" + styleName]; } + else if (VisualType == VisualType.TextOnly) + { + return (Style)App.Current.Resources["Only" + styleName]; + } else { return (Style)App.Current.Resources["Default" + styleName]; @@ -181,6 +185,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls { Small, SmallOutline, + TextOnly, Large, } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml index 2d469563a2..68590a040a 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml @@ -5,9 +5,7 @@ 16 12 - + + + + + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml index 1a51b17874..1f1fc9e071 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml @@ -23,9 +23,7 @@ ItemsSource="{x:Bind Keys}"> - + @@ -41,7 +39,6 @@ diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs index b86a17aa38..d43bda83bf 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs @@ -25,7 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views { if (OobeShellPage.OpenMainWindowCallback != null) { - OobeShellPage.OpenMainWindowCallback(typeof(GeneralPage)); + OobeShellPage.OpenMainWindowCallback(typeof(DashboardPage)); } ViewModel.LogOpeningSettingsEvent(); diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewAlternate.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewAlternate.xaml.cs index c5171f4159..d0ae488347 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewAlternate.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewAlternate.xaml.cs @@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views { if (OobeShellPage.OpenMainWindowCallback != null) { - OobeShellPage.OpenMainWindowCallback(typeof(GeneralPage)); + OobeShellPage.OpenMainWindowCallback(typeof(DashboardPage)); } ViewModel.LogOpeningSettingsEvent(); diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs index 40dcb56aa2..18a18189ab 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs @@ -54,7 +54,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views { if (OobeShellPage.OpenMainWindowCallback != null) { - OobeShellPage.OpenMainWindowCallback(typeof(GeneralPage)); + OobeShellPage.OpenMainWindowCallback(typeof(DashboardPage)); } ViewModel.LogOpeningSettingsEvent(); diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml new file mode 100644 index 0000000000..cac07b5bfd --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +