2023-05-02 13:10:54 +02:00
// Copyright (c) Microsoft Corporation
2020-04-10 15:22:07 -07:00
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
2022-04-19 22:00:28 +02:00
using System ;
2024-04-02 01:09:47 +02:00
using System.Collections.Generic ;
2022-04-19 22:00:28 +02:00
using System.Diagnostics ;
2024-04-02 01:09:47 +02:00
using System.IO ;
2022-04-19 22:00:28 +02:00
using System.Linq ;
2024-04-02 01:09:47 +02:00
using System.Text.Json ;
2022-04-19 22:00:28 +02:00
using System.Threading.Tasks ;
2024-10-17 05:14:57 -04:00
2022-04-19 22:00:28 +02:00
using ManagedCommon ;
2020-10-29 14:24:16 -07:00
using Microsoft.PowerToys.Settings.UI.Helpers ;
2021-02-26 13:21:58 +02:00
using Microsoft.PowerToys.Settings.UI.Library ;
2022-04-19 22:00:28 +02:00
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events ;
2025-02-25 02:48:54 +08:00
using Microsoft.PowerToys.Settings.UI.SerializationContext ;
2024-04-17 16:39:19 +02:00
using Microsoft.PowerToys.Settings.UI.Services ;
2023-01-31 00:00:11 +01:00
using Microsoft.PowerToys.Settings.UI.Views ;
2022-04-19 22:00:28 +02:00
using Microsoft.PowerToys.Telemetry ;
using Microsoft.UI.Xaml ;
2024-08-08 15:26:43 +01:00
using PowerToys.Interop ;
2022-04-19 22:00:28 +02:00
using Windows.UI.Popups ;
using WinRT.Interop ;
2023-05-02 13:10:54 +02:00
using WinUIEx ;
2020-03-06 17:46:51 -08:00
2020-03-11 10:43:32 -07:00
namespace Microsoft.PowerToys.Settings.UI
2020-03-06 17:46:51 -08:00
{
2022-04-19 22:00:28 +02:00
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
2020-03-06 17:46:51 -08:00
{
2022-04-19 22:00:28 +02:00
private enum Arguments
{
PTPipeName = 1 ,
SettingsPipeName ,
PTPid ,
Theme , // used in the old settings
ElevatedStatus ,
IsUserAdmin ,
ShowOobeWindow ,
ShowScoobeWindow ,
2023-01-31 00:00:11 +01:00
ShowFlyout ,
2023-02-03 15:10:14 +00:00
ContainsSettingsWindow ,
ContainsFlyoutPosition ,
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
private const int RequiredArgumentsSetSettingQty = 4 ;
private const int RequiredArgumentsSetAdditionalSettingsQty = 4 ;
private const int RequiredArgumentsGetSettingQty = 3 ;
private const int RequiredArgumentsLaunchedFromRunnerQty = 12 ;
2022-04-19 22:00:28 +02:00
// Create an instance of the IPC wrapper.
private static TwoWayPipeMessageIPCManaged ipcmanager ;
public static bool IsElevated { get ; set ; }
public static bool IsUserAnAdmin { get ; set ; }
public static int PowerToysPID { get ; set ; }
public bool ShowOobe { get ; set ; }
2023-01-31 00:00:11 +01:00
public bool ShowFlyout { get ; set ; }
2022-04-19 22:00:28 +02:00
public bool ShowScoobe { get ; set ; }
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
public Type StartupPage { get ; set ; } = typeof ( Views . DashboardPage ) ;
2022-04-19 22:00:28 +02:00
public static Action < string > IPCMessageReceivedCallback { get ; set ; }
2024-10-24 22:04:32 +02:00
public ETWTrace EtwTrace { get ; private set ; } = new ETWTrace ( ) ;
2022-04-19 22:00:28 +02:00
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
2020-03-06 17:46:51 -08:00
public App ( )
{
2024-06-16 17:58:25 +02:00
Logger . InitializeLogger ( @"\Settings\Logs" ) ;
2023-03-21 10:27:29 +01:00
2024-09-25 22:20:15 +02:00
string appLanguage = LanguageHelper . LoadLanguage ( ) ;
if ( ! string . IsNullOrEmpty ( appLanguage ) )
{
Microsoft . Windows . Globalization . ApplicationLanguages . PrimaryLanguageOverride = appLanguage ;
}
2024-06-16 17:58:25 +02:00
InitializeComponent ( ) ;
UnhandledException + = App_UnhandledException ;
2024-10-24 22:04:32 +02:00
NativeEventWaiter . WaitForEventLoop (
Constants . PowerToysRunnerTerminateSettingsEvent ( ) , ( ) = >
{
EtwTrace ? . Dispose ( ) ;
Environment . Exit ( 0 ) ;
} ) ;
2024-06-16 17:58:25 +02:00
}
private void App_UnhandledException ( object sender , Microsoft . UI . Xaml . UnhandledExceptionEventArgs e )
{
Logger . LogError ( "Unhandled exception" , e . Exception ) ;
2022-04-19 22:00:28 +02:00
}
2023-01-31 00:00:11 +01:00
public static void OpenSettingsWindow ( Type type = null , bool ensurePageIsSelected = false )
2022-04-19 22:00:28 +02:00
{
if ( settingsWindow = = null )
{
2024-02-20 11:40:53 +01:00
settingsWindow = new MainWindow ( ) ;
2022-04-19 22:00:28 +02:00
}
2020-05-09 14:10:57 -07:00
2022-04-19 22:00:28 +02:00
settingsWindow . Activate ( ) ;
2023-06-11 17:54:01 +02:00
2023-01-31 00:00:11 +01:00
if ( type ! = null )
{
settingsWindow . NavigateToSection ( type ) ;
2024-01-22 07:44:39 -08:00
WindowHelpers . BringToForeground ( settingsWindow . GetWindowHandle ( ) ) ;
2024-02-20 11:40:53 +01:00
}
2023-01-31 00:00:11 +01:00
if ( ensurePageIsSelected )
{
settingsWindow . EnsurePageIsSelected ( ) ;
}
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
private void OnLaunchedToSetSetting ( string [ ] cmdArgs )
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
var settingName = cmdArgs [ 2 ] ;
var settingValue = cmdArgs [ 3 ] ;
try
{
SetSettingCommandLineCommand . Execute ( settingName , settingValue , new SettingsUtils ( ) ) ;
}
catch ( Exception ex )
{
Logger . LogError ( $"SetSettingCommandLineCommand exception: '{settingName}' setting couldn't be set to {settingValue}" , ex ) ;
}
Exit ( ) ;
}
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
private void OnLaunchedToSetAdditionalSetting ( string [ ] cmdArgs )
{
var moduleName = cmdArgs [ 2 ] ;
var ipcFileName = cmdArgs [ 3 ] ;
try
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
using ( var settings = JsonDocument . Parse ( File . ReadAllText ( ipcFileName ) ) )
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
SetAdditionalSettingsCommandLineCommand . Execute ( moduleName , settings , new SettingsUtils ( ) ) ;
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
}
catch ( Exception ex )
{
Logger . LogError ( $"SetAdditionalSettingsCommandLineCommand exception: couldn't set additional settings for '{moduleName}'" , ex ) ;
}
Exit ( ) ;
}
private void OnLaunchedToGetSetting ( string [ ] cmdArgs )
{
var ipcFileName = cmdArgs [ 2 ] ;
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
try
{
2025-02-25 02:48:54 +08:00
var requestedSettings = JsonSerializer . Deserialize < Dictionary < string , List < string > > > ( File . ReadAllText ( ipcFileName ) , SourceGenerationContextContext . Default . DictionaryStringListString ) ;
2024-04-02 01:09:47 +02:00
File . WriteAllText ( ipcFileName , GetSettingCommandLineCommand . Execute ( requestedSettings ) ) ;
}
catch ( Exception ex )
{
Logger . LogError ( $"GetSettingCommandLineCommand exception" , ex ) ;
}
Exit ( ) ;
}
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
private void OnLaunchedFromRunner ( string [ ] cmdArgs )
{
// Skip the first argument which is prepended when launched by explorer
if ( cmdArgs [ 0 ] . EndsWith ( ".dll" , StringComparison . InvariantCultureIgnoreCase ) & & cmdArgs [ 1 ] . EndsWith ( ".exe" , StringComparison . InvariantCultureIgnoreCase ) & & ( cmdArgs . Length > = RequiredArgumentsLaunchedFromRunnerQty + 1 ) )
{
cmdArgs = cmdArgs . Skip ( 1 ) . ToArray ( ) ;
}
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
_ = int . TryParse ( cmdArgs [ ( int ) Arguments . PTPid ] , out int powerToysPID ) ;
PowerToysPID = powerToysPID ;
2023-02-03 15:10:14 +00:00
2024-04-02 01:09:47 +02:00
IsElevated = cmdArgs [ ( int ) Arguments . ElevatedStatus ] = = "true" ;
IsUserAnAdmin = cmdArgs [ ( int ) Arguments . IsUserAdmin ] = = "true" ;
ShowOobe = cmdArgs [ ( int ) Arguments . ShowOobeWindow ] = = "true" ;
ShowScoobe = cmdArgs [ ( int ) Arguments . ShowScoobeWindow ] = = "true" ;
ShowFlyout = cmdArgs [ ( int ) Arguments . ShowFlyout ] = = "true" ;
bool containsSettingsWindow = cmdArgs [ ( int ) Arguments . ContainsSettingsWindow ] = = "true" ;
bool containsFlyoutPosition = cmdArgs [ ( int ) Arguments . ContainsFlyoutPosition ] = = "true" ;
2023-02-03 15:10:14 +00:00
2024-04-02 01:09:47 +02:00
// To keep track of variable arguments
int currentArgumentIndex = RequiredArgumentsLaunchedFromRunnerQty ;
2023-02-03 15:10:14 +00:00
2024-04-02 01:09:47 +02:00
if ( containsSettingsWindow )
{
// Open specific window
StartupPage = GetPage ( cmdArgs [ currentArgumentIndex ] ) ;
currentArgumentIndex + + ;
}
int flyout_x = 0 ;
int flyout_y = 0 ;
if ( containsFlyoutPosition )
{
// get the flyout position arguments
_ = int . TryParse ( cmdArgs [ currentArgumentIndex + + ] , out flyout_x ) ;
_ = int . TryParse ( cmdArgs [ currentArgumentIndex + + ] , out flyout_y ) ;
}
RunnerHelper . WaitForPowerToysRunner ( PowerToysPID , ( ) = >
{
Environment . Exit ( 0 ) ;
} ) ;
ipcmanager = new TwoWayPipeMessageIPCManaged ( cmdArgs [ ( int ) Arguments . SettingsPipeName ] , cmdArgs [ ( int ) Arguments . PTPipeName ] , ( string message ) = >
{
if ( IPCMessageReceivedCallback ! = null & & message . Length > 0 )
2023-02-03 15:10:14 +00:00
{
2024-04-02 01:09:47 +02:00
IPCMessageReceivedCallback ( message ) ;
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
} ) ;
ipcmanager . Start ( ) ;
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
if ( ! ShowOobe & & ! ShowScoobe & & ! ShowFlyout )
{
settingsWindow = new MainWindow ( ) ;
settingsWindow . Activate ( ) ;
settingsWindow . ExtendsContentIntoTitleBar = true ;
settingsWindow . NavigateToSection ( StartupPage ) ;
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
// https://github.com/microsoft/microsoft-ui-xaml/issues/7595 - Activate doesn't bring window to the foreground
// Need to call SetForegroundWindow to actually gain focus.
WindowHelpers . BringToForeground ( settingsWindow . GetWindowHandle ( ) ) ;
2025-01-13 17:13:16 +02:00
// https://github.com/microsoft/microsoft-ui-xaml/issues/8948 - A window's top border incorrectly
// renders as black on Windows 10.
WindowHelpers . ForceTopBorder1PixelInsetOnWindows10 ( WindowNative . GetWindowHandle ( settingsWindow ) ) ;
2024-04-02 01:09:47 +02:00
}
else
{
// Create the Settings window hidden so that it's fully initialized and
// it will be ready to receive the notification if the user opens
// the Settings from the tray icon.
settingsWindow = new MainWindow ( true ) ;
2022-04-19 22:00:28 +02:00
2024-04-02 01:09:47 +02:00
if ( ShowOobe )
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
PowerToysTelemetry . Log . WriteEvent ( new OobeStartedEvent ( ) ) ;
OobeWindow oobeWindow = new OobeWindow ( OOBE . Enums . PowerToysModules . Overview ) ;
oobeWindow . Activate ( ) ;
oobeWindow . ExtendsContentIntoTitleBar = true ;
2025-01-13 17:13:16 +02:00
WindowHelpers . ForceTopBorder1PixelInsetOnWindows10 ( WindowNative . GetWindowHandle ( settingsWindow ) ) ;
2024-04-02 01:09:47 +02:00
SetOobeWindow ( oobeWindow ) ;
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
else if ( ShowScoobe )
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
PowerToysTelemetry . Log . WriteEvent ( new ScoobeStartedEvent ( ) ) ;
OobeWindow scoobeWindow = new OobeWindow ( OOBE . Enums . PowerToysModules . WhatsNew ) ;
scoobeWindow . Activate ( ) ;
scoobeWindow . ExtendsContentIntoTitleBar = true ;
2025-01-13 17:13:16 +02:00
WindowHelpers . ForceTopBorder1PixelInsetOnWindows10 ( WindowNative . GetWindowHandle ( settingsWindow ) ) ;
2024-04-02 01:09:47 +02:00
SetOobeWindow ( scoobeWindow ) ;
}
else if ( ShowFlyout )
{
POINT ? p = null ;
if ( containsFlyoutPosition )
2022-04-19 22:00:28 +02:00
{
2024-04-02 01:09:47 +02:00
p = new POINT ( flyout_x , flyout_y ) ;
2022-04-19 22:00:28 +02:00
}
2023-02-03 15:10:14 +00:00
2024-04-02 01:09:47 +02:00
ShellPage . OpenFlyoutCallback ( p ) ;
2022-04-19 22:00:28 +02:00
}
2024-04-02 01:09:47 +02:00
}
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched ( Microsoft . UI . Xaml . LaunchActivatedEventArgs args )
{
var cmdArgs = Environment . GetCommandLineArgs ( ) ;
if ( cmdArgs ? . Length > = RequiredArgumentsLaunchedFromRunnerQty )
{
OnLaunchedFromRunner ( cmdArgs ) ;
}
else if ( cmdArgs ? . Length = = RequiredArgumentsSetSettingQty & & cmdArgs [ 1 ] = = "set" )
{
OnLaunchedToSetSetting ( cmdArgs ) ;
}
else if ( cmdArgs ? . Length = = RequiredArgumentsSetAdditionalSettingsQty & & cmdArgs [ 1 ] = = "setAdditional" )
{
OnLaunchedToSetAdditionalSetting ( cmdArgs ) ;
}
else if ( cmdArgs ? . Length = = RequiredArgumentsGetSettingQty & & cmdArgs [ 1 ] = = "get" )
{
OnLaunchedToGetSetting ( cmdArgs ) ;
2022-04-19 22:00:28 +02:00
}
else
{
2023-08-10 10:02:50 +02:00
#if DEBUG
2022-04-19 22:00:28 +02:00
// For debugging purposes
// Window is also needed to show MessageDialog
2023-11-23 18:19:57 +01:00
settingsWindow = new MainWindow ( ) ;
2023-06-11 17:54:01 +02:00
settingsWindow . ExtendsContentIntoTitleBar = true ;
2025-01-13 17:13:16 +02:00
WindowHelpers . ForceTopBorder1PixelInsetOnWindows10 ( WindowNative . GetWindowHandle ( settingsWindow ) ) ;
2022-04-19 22:00:28 +02:00
settingsWindow . Activate ( ) ;
2023-06-11 17:54:01 +02:00
settingsWindow . NavigateToSection ( StartupPage ) ;
2022-07-27 12:39:31 +02:00
#else
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
/* 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. */
2024-04-17 16:39:19 +02:00
Common . UI . SettingsDeepLink . OpenSettings ( Common . UI . SettingsDeepLink . SettingsWindow . Dashboard , true ) ;
2023-08-10 10:02:50 +02:00
Exit ( ) ;
2022-07-27 12:39:31 +02:00
#endif
2022-04-19 22:00:28 +02:00
}
}
public static TwoWayPipeMessageIPCManaged GetTwoWayIPCManager ( )
{
return ipcmanager ;
2020-03-06 17:46:51 -08:00
}
2021-02-26 13:21:58 +02:00
public static bool IsDarkTheme ( )
{
2024-04-17 16:39:19 +02:00
return ThemeService . Theme = = ElementTheme . Dark | | ( ThemeService . Theme = = ElementTheme . Default & & ThemeHelpers . GetAppTheme ( ) = = AppTheme . Dark ) ;
2021-02-26 13:21:58 +02:00
}
2023-11-23 18:19:57 +01:00
public static int UpdateUIThemeMethod ( string themeName )
2023-06-11 17:54:01 +02:00
{
2023-11-23 18:19:57 +01:00
return 0 ;
}
2021-02-26 13:21:58 +02:00
private static ISettingsUtils settingsUtils = new SettingsUtils ( ) ;
2024-04-17 16:39:19 +02:00
private static ThemeService themeService = new ThemeService ( SettingsRepository < GeneralSettings > . GetInstance ( settingsUtils ) ) ;
public static ThemeService ThemeService = > themeService ;
2022-04-19 22:00:28 +02:00
private static MainWindow settingsWindow ;
private static OobeWindow oobeWindow ;
2023-01-31 00:00:11 +01:00
private static FlyoutWindow flyoutWindow ;
2022-04-19 22:00:28 +02:00
public static void ClearSettingsWindow ( )
{
settingsWindow = null ;
}
public static MainWindow GetSettingsWindow ( )
{
return settingsWindow ;
}
public static OobeWindow GetOobeWindow ( )
{
return oobeWindow ;
}
2023-01-31 00:00:11 +01:00
public static FlyoutWindow GetFlyoutWindow ( )
{
return flyoutWindow ;
}
2022-04-19 22:00:28 +02:00
public static void SetOobeWindow ( OobeWindow window )
{
oobeWindow = window ;
}
2023-01-31 00:00:11 +01:00
public static void SetFlyoutWindow ( FlyoutWindow window )
{
flyoutWindow = window ;
}
2022-04-19 22:00:28 +02:00
public static void ClearOobeWindow ( )
{
oobeWindow = null ;
}
2023-01-31 00:00:11 +01:00
public static void ClearFlyoutWindow ( )
{
flyoutWindow = null ;
}
2023-05-02 13:10:54 +02:00
public static Type GetPage ( string settingWindow )
{
switch ( settingWindow )
{
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
case "Dashboard" : return typeof ( DashboardPage ) ;
2023-05-02 13:10:54 +02:00
case "Overview" : return typeof ( GeneralPage ) ;
2024-05-09 10:32:03 -04:00
case "AdvancedPaste" : return typeof ( AdvancedPastePage ) ;
2023-05-02 13:10:54 +02:00
case "AlwaysOnTop" : return typeof ( AlwaysOnTopPage ) ;
case "Awake" : return typeof ( AwakePage ) ;
2024-01-03 07:43:42 -08:00
case "CmdNotFound" : return typeof ( CmdNotFoundPage ) ;
2023-05-02 13:10:54 +02:00
case "ColorPicker" : return typeof ( ColorPickerPage ) ;
case "FancyZones" : return typeof ( FancyZonesPage ) ;
case "FileLocksmith" : return typeof ( FileLocksmithPage ) ;
case "Run" : return typeof ( PowerLauncherPage ) ;
case "ImageResizer" : return typeof ( ImageResizerPage ) ;
case "KBM" : return typeof ( KeyboardManagerPage ) ;
case "MouseUtils" : return typeof ( MouseUtilsPage ) ;
2023-05-15 23:32:26 +01:00
case "MouseWithoutBorders" : return typeof ( MouseWithoutBordersPage ) ;
2025-07-04 09:41:19 +08:00
case "Peek" : return typeof ( PeekPage ) ;
case "PowerAccent" : return typeof ( PowerAccentPage ) ;
case "PowerLauncher" : return typeof ( PowerLauncherPage ) ;
case "PowerPreview" : return typeof ( PowerPreviewPage ) ;
2023-05-02 13:10:54 +02:00
case "PowerRename" : return typeof ( PowerRenamePage ) ;
case "QuickAccent" : return typeof ( PowerAccentPage ) ;
case "FileExplorer" : return typeof ( PowerPreviewPage ) ;
case "ShortcutGuide" : return typeof ( ShortcutGuidePage ) ;
2024-04-02 01:09:47 +02:00
case "PowerOcr" : return typeof ( PowerOcrPage ) ;
2023-05-02 13:10:54 +02:00
case "MeasureTool" : return typeof ( MeasureToolPage ) ;
case "Hosts" : return typeof ( HostsPage ) ;
case "RegistryPreview" : return typeof ( RegistryPreviewPage ) ;
2023-08-24 14:53:33 +02:00
case "CropAndLock" : return typeof ( CropAndLockPage ) ;
2023-10-20 16:28:07 +02:00
case "EnvironmentVariables" : return typeof ( EnvironmentVariablesPage ) ;
2024-09-19 09:12:24 -07:00
case "NewPlus" : return typeof ( NewPlusPage ) ;
[New Module] Workspaces (#34324)
* spell checker
* Adding OOBE Projects page
* changed the default hotkey
* module interface
* rename projects editor
* bug report tool
* installer
* gpo
* exit event constant
* extend search for projects by search over the containing apps' names
* [Projects] fix grammatical issue #43 (1 app - many apps)
* [Projects] Editor: Main page: fix layout if there are many apps, launch button not disappearing on the right side
* dsc
* github
* pipeline
* guid prefix
* [Projects] fixing general settings gpo handling in runner + minor changes
* arm build fix
* Do not allow saving project if name or applist is empty. Also minor UI changes
* version
* editor version
* spellcheck
* editor dll signing
* update projects names to filter them out
* shortcut saving fix
* [Projects] Editor: brining the highlighted app's icon into the foreground. + minor UI fixes
* spell checker
* spellcheck
* [Projects] re-implementing icon size calculation to have similar sized icons for every app.
* [projects] Adding info message for cases: there are no projects or no results for the search
* [Projects] Adding Edit button to the popup. + minor changes
* [Projects] Making popup having rounded corners
* changed "no projects" text color and position
* remove opening the first proj
* fix placing windows of the same app in the project
* [Projects] bringing back the breadcrumb on the editor page. Make it clickable.
* [Projects] optimizing click handlers
* [Projects] Removing not selected apps on save
* moved on thread executor to common
* moved display utils
* added convert rect
* unsigned monitor number
* set awareness
* app placement
* [Projects] Re-implementing preview drawing - one common image
* [Projects] fix boundary calculation, use DPI aware values
* fix launching with command line args
* Fix ARM64 CI build
* launch packaged apps using names when possible
* spell-check
* update packaged apps path
* projects editor single instance
* [Projects] Add Select all checkbox, Delete selected button
* Add Checkbox for per monitor selection
* modifying highlight in preview
* spell checker
* logs
* exclude help windows
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/49
* Add intermediate step to project creation
* minor bugfix
* mutex fix
* modifying highlight for minimized apps
* Fixing bug: re-draw the preview on app deletion in the editor
* Adding helper class for getting the right bounds for screens
* spell checker
* spell checker
* Minor fixes in the capture dialog
* get dpi unaware screen bounds
* refactoring: added utils
* changed window filter
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/2
* clean up
* refactoring
* projects common lib
* localizable default project prefix
* launcher resources
* clean up
* change snapshot project saving
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project data
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project creation save-cancel handles
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* spell-check
* Remove checkboxes, delete feature
* remove unused from the project
* get command line args in the snapshot
* minimized settings snap fix
* set window property after launching
* FZ: ignore projects launched windows
* Implementing major new features: remove button, position manipulation, arguments, admin, minimized, maximized
* modifying colors
* launcher project filters
* clean up
* Hide Admin checkbox
* hide WIP
* spell-check
* Revert "Hide Admin checkbox"
This reverts commit 3036df9d7fe48de6418b0ebeff6422d535cb25e2.
* get app elevated property
* Implementing Launch and Edit feature
* fixing: update of listed projects on the main page after hitting save in editor
* Fix for packaged app's icons
* fixing scroll speed issue
* change scroll speed to 15
* launch elevated apps
* minor fixes
* minor fix
* enhancing shortcut handling
* can-launch-elevated check
* projects module interface telemetry
* Implementing store of setting "order by".
* minor string correction
* moved projects data parsing
* telemetry
* add move apps checkbox
* notification about elevated apps
* restart unelevated
* move existing windows
* keep opened windows at the same positions
* handle powertoys settings
* use common theme
* fix corrupted data: project id and monitor id
* project launch on "launch and edit"
* clean up
* show screen numbers instead of monitor names
* launcher error messages
* fix default shortcut
* Adding launch button to projects settings, dashboard and flyout
* Adding new app which is launched when launching a project. It shows the status of the launch process
* spell checker
* Renaming Projects to App Layouts. Replacing only string values, not the variable names
* Re-ordering modules after Renaming Projects + spell checker
* setting window size according to the screen (making it bigger)
* commenting out feature "move apps if exist"
* spell checker
* Add ProjectsLauncherUI to signing
* opening apps in minimized state which are placed on a monitor, which is not found at the moment of launching
* consistent file name
* removed unused sln
* telemetry: create event
* WindowPosition comparison
* telemetry: edit event
* fix muted Launch as admin checkbox
* telemetry: delete event
* updated Edit telemetry event
* added invoke point to launcher args
* added utils
* parse invoke point
* replaced tuple with struct
* telemetry: launch event
* MonitorRect comparison
* resources
* rename: folders
* remove outdated
* rename: window property
* rename: files and folders
* rename: common data structures
* rename: telemetry namespace
* rename: workspaces data
* rename ProjectsLib -> WorkspacesLib
* rename: gpo
* rename: settings
* rename: launcher UI
* rename: other
* rename: pt run
* rename: fz
* rename: module interface
* rename: icon
* rename: snapshot tool
* rename: editor
* rename: common files
* rename: launcher
* rename: editor resources
* fix empty file crash
* rename: json
* rename: module interface
* fix custom actions build
* added launch editor event constant
* xaml formatting
* Add missing method defition to interop::Constants idl
Remove Any CPU config
* more .sln cleanup
* [Run][PowerToys] Fix Workspaces utility (#34336)
polished workspaces utility
* build fix - align CppWinRT version
* address PR comment: fix isdigit
* indentation
* address PR comment: rename function
* address PR comment: changed version for workspaces and revision
* added supported version definition
* addressPR comment: use BringToForeground
* address PR comments: updated projects
* address PR comment: uncomment gpo in settings
* address PR comment: rename oobe view
* update OOBE image with current module name
* moved AppUtils
* launching with AppUserModel.ID
* fixed module order in settings
* fix xaml formatting
* [Workspaces] Close launcher if there are failed launches. Plus adding new spinner gif
* fix topmost LauncherUI
* clean up
* UI closing
* BugReportTool - omit cmd arg data
* Delete icon on workspace removal
* Adding cancellation to launcher UI.
* reordered launching
* fix terminating UI
* Removing old shortcut on workspace renaming
* Sentence case labels
* get process path without waiting
* comment out unused
* remove unused argument
* logs
* New icon
* fix launch and edit for the new project
* fix launch and edit: save new project
* Update exe icons
---------
Co-authored-by: donlaci <laszlo@janeasystems.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Niels Laute <niels.laute@live.nl>
2024-08-23 09:28:13 +02:00
case "Workspaces" : return typeof ( WorkspacesPage ) ;
Add the Command Palette module (#37908)
Windows Command Palette ("CmdPal") is the next iteration of PowerToys Run. With extensibility at its core, the Command Palette is your one-stop launcher to start _anything_.
By default, CmdPal is bound to <kbd>Win+Alt+Space</kbd>.


----
This brings the current preview version of CmdPal into the upstream PowerToys repo. There are still lots of bugs to work out, but it's reached the state we're ready to start sharing it with the world. From here, we can further collaborate with the community on the features that are important, and ensuring that we've got a most robust API to enable developers to build whatever extensions they want.
Most of the built-in PT Run modules have already been ported to CmdPal's extension API. Those include:
* Installed apps
* Shell commands
* File search (powered by the indexer)
* Windows Registry search
* Web search
* Windows Terminal Profiles
* Windows Services
* Windows settings
There are a couple new extensions built-in
* You can now search for packages on `winget` and install them right from the palette. This also powers searching for extensions for the palette
* The calculator has an entirely new implementation. This is currently less feature complete than the original PT Run one - we're looking forward to updating it to be more complete for future ingestion in Windows
* "Bookmarks" allow you to save shortcuts to files, folders, and webpages as top-level commands in the palette.
We've got a bunch of other samples too, in this repo and elsewhere
### PowerToys specific notes
CmdPal will eventually graduate out of PowerToys to live as its own application, which is why it's implemented just a little differently than most other modules. Enabling CmdPal will install its `msix` package.
The CI was minorly changed to support CmdPal version numbers independent of PowerToys itself. It doesn't make sense for us to start CmdPal at v0.90, and in the future, we want to be able to rev CmdPal independently of PT itself.
Closes #3200, closes #3600, closes #7770, closes #34273, closes #36471, closes #20976, closes #14495
-----
TODOs et al
**Blocking:**
- [ ] Images and descriptions in Settings and OOBE need to be properly defined, as mentioned before
- [ ] Niels is on it
- [x] Doesn't start properly from PowerToys unless the fix PR is merged.
- https://github.com/zadjii-msft/PowerToys/pull/556 merged
- [x] I seem to lose focus a lot when I press on some limits, like between the search bar and the results.
- This is https://github.com/zadjii-msft/PowerToys/issues/427
- [x] Turned off an extension like Calculator and it was still working.
- Need to get rid of that toggle, it doesn't do anything currently
- [x] `ListViewModel.<FetchItems>` crash
- Pretty confident that was fixed in https://github.com/zadjii-msft/PowerToys/pull/553
**Not blocking / improvements:**
- Show the shortcut through settings, as mentioned before, or create a button that would open CmdPalette settings.
- When PowerToys starts, CmdPalette is always shown if enabled. That's weird when just starting PowerToys/ logging in to the computer with PowerToys auto-start activated. I think this should at least be a setting.
- Needing to double press a result for it to do the default action seems quirky. If one is already selected, I think just pressing should be enough for it to do the action.
- This is currently a setting, though we're thinking of changing the setting even more: https://github.com/zadjii-msft/PowerToys/issues/392
- There's no URI extension. Was surprised when typing a URL that it only proposed a web search.
- [x] There's no System commands extension. Was expecting to be able to quickly restart the computer by typing restart but it wasn't there.
- This is in PR https://github.com/zadjii-msft/PowerToys/pull/452
---------
Co-authored-by: joadoumie <98557455+joadoumie@users.noreply.github.com>
Co-authored-by: Jordi Adoumie <jordiadoumie@microsoft.com>
Co-authored-by: Mike Griese <zadjii@gmail.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
Co-authored-by: Seraphima <zykovas91@gmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Kristen Schau <47155823+krschau@users.noreply.github.com>
Co-authored-by: Eric Johnson <ericjohnson327@gmail.com>
Co-authored-by: Ethan Fang <ethanfang@microsoft.com>
Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
2025-03-19 03:39:57 -05:00
case "CmdPal" : return typeof ( CmdPalPage ) ;
2025-01-16 20:52:24 +00:00
case "ZoomIt" : return typeof ( ZoomItPage ) ;
2023-05-02 13:10:54 +02:00
default :
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
// Fallback to Dashboard
2023-05-02 13:10:54 +02:00
Debug . Assert ( false , "Unexpected SettingsWindow argument value" ) ;
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
return typeof ( DashboardPage ) ;
2023-05-02 13:10:54 +02:00
}
}
2020-03-06 17:46:51 -08:00
}
}