repo_name
stringlengths
8
38
pr_number
int64
3
47.1k
pr_title
stringlengths
8
175
pr_description
stringlengths
2
19.8k
author
null
date_created
stringlengths
25
25
date_merged
stringlengths
25
25
filepath
stringlengths
6
136
before_content
stringlengths
54
884k
after_content
stringlengths
56
884k
pr_author
stringlengths
3
21
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
comment
stringlengths
2
25.4k
comment_author
stringlengths
3
29
__index_level_0__
int64
0
5.1k
microsoft/PowerToys
28,775
0.74 changelogs
<!-- 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 Readme update for the 0.74 release. This will be copy / pasted for release notes.
null
2023-09-26 11:20:42+00:00
2023-09-26 21:36:51+00:00
README.md
# Microsoft PowerToys ![Hero image for Microsoft PowerToys](doc/images/overview/PT_hero_image.png) [How to use PowerToys][usingPowerToys-docs-link] | [Downloads & Release notes][github-release-link] | [Contributing to PowerToys](#contributing) | [What's Happening](#whats-happening) | [Roadmap](#powertoys-roadmap) ## Build status | Architecture | Solution (Main) | Solution (Stable) | Installer (Main) | |--------------|-----------------|-------------------|------------------| | x64 | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20x64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main&jobName=Build%20x64%20Release) | [![Build Status for Stable](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=stable&jobName=Build%20x64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_x64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | | ARM64 | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main) | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_arm64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | ## About Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]! | | Current utilities: | | |--------------|--------------------|--------------| | [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) | | [Crop And Lock](https://aka.ms/PowerToysOverview_CropAndLock) | [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) | | [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) | [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) | | [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) | | [Peek](https://aka.ms/PowerToysOverview_Peek) | [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) | | [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) | | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) | [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) | ## Installing and running Microsoft PowerToys ### Requirements - Windows 11 or Windows 10 version 2004 (code name 20H1 / build number 19041) or newer. - Our installer will install the following items: - [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version. ### Via GitHub with EXE [Recommended] Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user. <!-- items that need to be updated release to release --> [github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47 [github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46 [ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysUserSetup-0.73.0-x64.exe [ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysUserSetup-0.73.0-arm64.exe [ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysSetup-0.73.0-x64.exe [ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysSetup-0.73.0-arm64.exe | Description | Filename | sha256 hash | |----------------|----------|-------------| | Per user - x64 | [PowerToysUserSetup-0.73.0-x64.exe][ptUserX64] | BA55D245BDD734FD6F19803DD706A3AB8E0ABC491591195534997CF2122D3B7E | | Per user - ARM64 | [PowerToysUserSetup-0.73.0-arm64.exe][ptUserArm64] | FBFA40EA5FFA05236A7CCDD05E5142EE0C93D7485B965784196ED9B086BFEBF4 | | Machine wide - x64 | [PowerToysSetup-0.73.0-x64.exe][ptMachineX64] | 7FDA06292C7C2E6DA5AEF88D8E9D3DE89D331E9E356A232289F9B37CE4503894 | | Machine wide - ARM64 | [PowerToysSetup-0.73.0-arm64.exe][ptMachineArm64] | 4260AA30A1F52F194EE07E9E7ECD9E9F4CF35289267F213BC933F7A5191AC17C | This is our preferred method. ### Via Microsoft Store Install from the [Microsoft Store's PowerToys page][microsoft-store-link]. You must be using the [new Microsoft Store](https://blogs.windows.com/windowsExperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/) which is available for both Windows 11 and Windows 10. ### Via WinGet Download PowerToys from [WinGet][winget-link]. Updating PowerToys via winget will respect current PowerToys installation scope. To install PowerToys, run the following command from the command line / PowerShell: #### User scope installer [default] ```powershell winget install Microsoft.PowerToys -s winget ``` #### Machine-wide scope installer ```powershell winget install --scope machine Microsoft.PowerToys -s winget ``` ### Other install methods There are [community driven install methods](./doc/unofficialInstallMethods.md) such as Chocolatey and Scoop. If these are your preferred install solutions, you can find the install instructions there. ## Third-Party Run Plugins There is a collection of [third-party plugins](./doc/thirdPartyRunPlugins.md) created by the community that aren't distributed with PowerToys. ## Contributing This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows. We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md). We would be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort. Most contributions require you to agree to a [Contributor License Agreement (CLA)][oss-CLA] declaring that you grant us the rights to use your contribution and that you have permission to do so. For guidance on developing for PowerToys, please read the [developer docs](/doc/devdocs) for a detailed breakdown. This includes how to setup your computer to compile. ## What's Happening ### PowerToys Roadmap Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on. ### 0.73 - August 2023 Update In this release, we focused on releasing new features, stability and improvements. **Highlights** - Keyboard manager now allows Numpad keys to be bound separately from the main keyboard. If using a previous configuration, only the main keyboard (not numpad) keys will be mapped. To restore the previous behavior, manually add separate bindings for numpad keys. - New utility: Crop And Lock allows you to crop a current application into a smaller window or just create a thumbnail. Focus the target window and press the shortcut to start cropping. - FancyZones code improvements and refactor. - Modernized ImageResizer UX. - PowerRename advanced counter functionality. ### General - Added missing CoUninitialize call in elevation logic. Thanks [@sredna](https://github.com/sredna)! - New utility: Crop And Lock. Thanks [@robmikh](https://github.com/robmikh)! and [@kevinguo305](https://github.com/kevinguo305)! - Added new /helped fabric bot command to GitHub repo. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - Fixed crashes caused by invalid settings. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Always On Top - Added border transparency. ### FancyZones - Fixed issue causing canvas zones being drawn only when dragging in the zone area. - Fixed user-defined default layout highlighting issue. - Refactored and improved code quality. - Fixed issue causing the wrong layout to be applied when duplicating a non-selected layout. ### File Locksmith - Icon update. Thanks [@jmaraujouy](https://github.com/jmaraujouy)! ### File Explorer add-ons - Fixed issue causing thumbnail previewers to lock files. - Open URIs from developer files in default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Installer - Fixed PowerToys autorun after installing as SYSTEM user. - Removed CreateScheduledTask custom action to handle task creation only from runner code. ### Image Resizer - Moved from ModernWPF to WpfUI to refresh and modernize UI/UX. Thanks [@niels9001](https://github.com/niels9001)! ### Keyboard Manager - Rephrased labels to enhance clarity. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - Keyboard manager now allows Numpad keys to be bound separately from the main keyboard. If using a previous configuration, only the main keyboard (not numpad) keys will be mapped. To restore the previous behavior, manually add separate bindings for numpad keys. ### Mouse Highlighter - The highlighter is now visible in "Always on Top" windows. - Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Mouse Pointer Crosshairs - Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Peek - Show correct file type for shortcuts. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Fixed issue causing the wrong file size to be displayed. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Show 1 byte instead of 1 bytes file size. Thanks [@Deepak-Sangle](https://github.com/Deepak-Sangle)! - Open URIs from developer files in the default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Show a thumbnail and fallback to an icon for unsupported files. Thanks [@pedrolamas](https://github.com/pedrolamas)! ### PowerRename - Updated the OOBE gif. Thanks [@ChaseKnowlden](https://github.com/ChaseKnowlden)! - Localized the renamed parts combo box. - Introduced advanced counter functionality. - Added remember last window size logic and optimized sorting of items. - Enable "Enumerate items" option by default. ### PowerToys Run - Fixed an issue causing original search to be abandoned when cycling through results. - Updated device and bluetooth results for Settings plugin. Thanks [@htcfreek](https://github.com/htcfreek)! - Fixed InvalidOperationException exception thrown. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Add Base64 Decoding function to the Value Generator plugin. Thanks [@LeagueOfPoro](https://github.com/LeagueOfPoro)! - Added a Keep shell open option for Shell plugin. - Added Crop And Lock to PowerToys plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Registry Preview - Updated AppBarButtons to use an explicit AppBarButton.Icon. Thanks [@randyrants](https://github.com/randyrants)! - Fixed crash on clicking Save As button. ### Runner - Removed unneeded RegisterWindowMessage from tray icon logic. Thanks [@sredna](https://github.com/sredna)! - Fixed startup looping issue. - Improved old logs and installers cleanup logic. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Screen Ruler - Use proper resources file. ### Settings - Fixed issue causing problems with modifier keys and ShortcutControl. Thanks [@sh0ckj0ckey](https://github.com/sh0ckj0ckey)! - Fixed crash when clicking "Windows color settings" link. - Added support for launching Settings app directly. - Fixed issue causing DisplayDescription not showing for PowerToys Run PluginAdditionalOption. - Fixed issue causing FileLocksmith 'Show File Locksmith in' setting not showing correct value. - Fixed issue causing Awake on/off toggle in Settings flyout not to work when Settings Awake page is opened. ### Documentation - Added documentation for PowerToys Run third-party plugins. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Fixed broken links in keyboardmanagerui.md. Thanks [@shubhsardana29](https://github.com/shubhsardana29)! - Updated core team in COMMUNITY.md. - Fixed broken links in ui-architecture.md. Thanks [@SamB](https://github.com/SamB)! - Updated community.valuegenerator.md with Base64DecodeRequest description. ### Development - Updated test packages and StyleCop. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Condense NuGet Restore into MSBuild Tasks. Thanks [@snickler](https://github.com/snickler)! #### What is being planned for version 0.74 For [v0.74][github-next-release-work], we'll work on the items below: - Language selection - Modernize and refresh the UX of PowerToys based on WPF - Stability / bug fixes - Peek: UI improvements ## PowerToys Community The PowerToys team is extremely grateful to have the [support of an amazing active community][community-link]. The work you do is incredibly important. PowerToys wouldn’t be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Month by month, you directly help make PowerToys a better piece of software. ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct][oss-conduct-code]. ## Privacy Statement The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has the trends from the telemetry. Please read the [Microsoft privacy statement][privacy-link] for more information. [oss-CLA]: https://cla.opensource.microsoft.com [oss-conduct-code]: CODE_OF_CONDUCT.md [community-link]: COMMUNITY.md [github-release-link]: https://aka.ms/installPowerToys [microsoft-store-link]: https://aka.ms/getPowertoys [winget-link]: https://github.com/microsoft/winget-cli#installing-the-client [roadmap]: https://github.com/microsoft/PowerToys/wiki/Roadmap [privacy-link]: http://go.microsoft.com/fwlink/?LinkId=521839 [vidConfOverview]: https://aka.ms/PowerToysOverview_VideoConference [loc-bug]: https://github.com/microsoft/PowerToys/issues/new?assignees=&labels=&template=translation_issue.md&title= [usingPowerToys-docs-link]: https://aka.ms/powertoys-docs
# Microsoft PowerToys ![Hero image for Microsoft PowerToys](doc/images/overview/PT_hero_image.png) [How to use PowerToys][usingPowerToys-docs-link] | [Downloads & Release notes][github-release-link] | [Contributing to PowerToys](#contributing) | [What's Happening](#whats-happening) | [Roadmap](#powertoys-roadmap) ## Build status | Architecture | Solution (Main) | Solution (Stable) | Installer (Main) | |--------------|-----------------|-------------------|------------------| | x64 | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20x64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main&jobName=Build%20x64%20Release) | [![Build Status for Stable](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=stable&jobName=Build%20x64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_x64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | | ARM64 | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main) | [![Build Status for Main](https://dev.azure.com/ms/PowerToys/_apis/build/status/microsoft.PowerToys?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_arm64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | ## About Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]! | | Current utilities: | | |--------------|--------------------|--------------| | [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) | | [Crop And Lock](https://aka.ms/PowerToysOverview_CropAndLock) | [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) | | [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) | [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) | | [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) | | [Peek](https://aka.ms/PowerToysOverview_Peek) | [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) | | [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) | | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) | [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) | ## Installing and running Microsoft PowerToys ### Requirements - Windows 11 or Windows 10 version 2004 (code name 20H1 / build number 19041) or newer. - Our installer will install the following items: - [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version. ### Via GitHub with EXE [Recommended] Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user. <!-- items that need to be updated release to release --> [github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48 [github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47 [ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-x64.exe [ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-arm64.exe [ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-x64.exe [ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-arm64.exe | Description | Filename | sha256 hash | |----------------|----------|-------------| | Per user - x64 | [PowerToysUserSetup-0.74.0-x64.exe][ptUserX64] | 1C4ECE9F11488BAFFAE6B76D2B0504FA18BFFEA11EBC38BCC87F5D86AEA87C7C | | Per user - ARM64 | [PowerToysUserSetup-0.74.0-arm64.exe][ptUserArm64] | 4F3842FAB0839A361A15A06B7720BA8A0FE7F9AF98EA94245C08DEF37678CA4A | | Machine wide - x64 | [PowerToysSetup-0.74.0-x64.exe][ptMachineX64] | 648992E8CEA08F3C63C7CCBD554ADDF500ECBC4560187310BC12E6CB9C2F38E3 | | Machine wide - ARM64 | [PowerToysSetup-0.74.0-arm64.exe][ptMachineArm64] | 2B6D92F1A0EA688C7EE882050AC9B030C8B3A18765163FB6D67E5E694A4D4FE3 | This is our preferred method. ### Via Microsoft Store Install from the [Microsoft Store's PowerToys page][microsoft-store-link]. You must be using the [new Microsoft Store](https://blogs.windows.com/windowsExperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/) which is available for both Windows 11 and Windows 10. ### Via WinGet Download PowerToys from [WinGet][winget-link]. Updating PowerToys via winget will respect current PowerToys installation scope. To install PowerToys, run the following command from the command line / PowerShell: #### User scope installer [default] ```powershell winget install Microsoft.PowerToys -s winget ``` #### Machine-wide scope installer ```powershell winget install --scope machine Microsoft.PowerToys -s winget ``` ### Other install methods There are [community driven install methods](./doc/unofficialInstallMethods.md) such as Chocolatey and Scoop. If these are your preferred install solutions, you can find the install instructions there. ## Third-Party Run Plugins There is a collection of [third-party plugins](./doc/thirdPartyRunPlugins.md) created by the community that aren't distributed with PowerToys. ## Contributing This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows. We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md). We would be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort. Most contributions require you to agree to a [Contributor License Agreement (CLA)][oss-CLA] declaring that you grant us the rights to use your contribution and that you have permission to do so. For guidance on developing for PowerToys, please read the [developer docs](/doc/devdocs) for a detailed breakdown. This includes how to setup your computer to compile. ## What's Happening ### PowerToys Roadmap Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on. ### 0.74 - September 2023 Update In this release, we focused on stability and improvements. **Highlights** - Upgraded to Windows App SDK 1.4.1, increasing stability of WinUI3 utilities. Thanks [@dongle-the-gadget](https://github.com/dongle-the-gadget) for starting the upgrade! - Text Extractor was upgraded to its version 2.0, with a new overlay, table mode and more Quality of Life improvements. Thanks [@TheJoeFin](https://github.com/TheJoeFin)! - Improved FancyZones stability, fixing some layout resets and improving handling of newly created windows on Windows 11. - Fixed many silent crashes that were reported to Watson and the user's event viewer. ### General - Turning animations off in Windows Settings will now also turn them off in PowerToys. - Upgraded the Windows App SDK dependency to 1.4.1. Thanks [@dongle-the-gadget](https://github.com/dongle-the-gadget) for the original 1.4.0 upgrade! - Show in the thumbnail label and application titles when running as administrator. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Upgraded the Win UI Community Toolkit dependency to 8.0. Thanks [@niels9001](https://github.com/niels9001)! ### Awake - Added down-sampled variants to the application's icon. Thanks [@morriscurtis](https://github.com/morriscurtis)! ### Color Picker - After adding a new color in the editor, the history will scroll the new color into view. Thanks [@peerpalo](https://github.com/peerpalo)! ### Crop and Lock - Fixed a Crop and Lock crash that would occur when trying to reparent a window crashes the target application. An error message is shown instead. ### FancyZones - Set the process and main thread priority to normal. - Fixed handling newly created windows on Windows 11. - Fixed scenarios where opening the FancyZones Editor would reset the layouts. ### File Explorer add-ons - Optimized CPU usage for generating SVG thumbnails. - Improved handling of Gcode Thumbnails, including JPG and QOI formats. Thanks [@pedrolamas](https://github.com/pedrolamas)! - Better handled errors when sending telemetry, which were causing reported crashes. - Fixed some thumbnails not being shown centered like before the optimization. ### File Locksmith - Shows files opened by processes with PID greater than 65535. Thanks [@poke30744](https://github.com/poke30744)! - Fixed a GDI object leak in the context menu which would crash Explorer. ### Find My Mouse - Added new activation methods, including by hotkey. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Hosts File Editor - Ignore the default ACME sample entries in the hosts file. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Improved save error handling and added better error messages. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Corrected a check for an error when signaling the application to start as administrator. - Refactored the context menu. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Fixed dialogs overlapping the title bar after the upgrade to Windows App SDK 1.4. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Keyboard Manager - Distinguish between the regular minus key and the numpad minus key. ### Mouse Without Borders - Fixed a crash when trying to restart the application. ### Peek - Using Peek on HTML files will show a white background by default, similar to a browser's default behavior. - Fix a white flash on Dark theme when switching file and improved the development file preview detection and adjustments. ### PowerRename - Fixed a crash caused by big counter values on the new enumeration method. ### PowerToys Run - It's now possible to select which shell is used by the Shell plugin. - A combobox option type was added to the plugin options. - Fixed a bug in the Calculator plugin that was causing decimal numbers to be misinterpreted on locales where the dot (`.`) character isn't used as a decimal or digit separator. - Improved the Program plugin stability when it fails to load a program's thumbnail at startup. - The use of Pinyin for querying some plugins can now be turned on in Settings. Thanks [@ChaseKnowlden](https://github.com/ChaseKnowlden)! - Refactored option types for plugin and added number, string and composite types to be used in the future. Thanks [@htcfreek](https://github.com/htcfreek)! - Fixed the entry for searching for Windows updates in the Settings plugin. Thanks [@htcfreek](https://github.com/htcfreek)! ### Quick Accent - The "All languages" character set is now calculated by programmatically querying the characters for every available language. Thanks [@dannysummerlin](https://github.com/dannysummerlin)! - Added é to the Norwegian and Swedish languages. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - Added a runtime cache to the "All languages" character set, to only calculate accents once per key. ### Registry Preview - Fixed focusing issues at startup. - Improved the data visualization to show data in a similar way to the Windows Registry Editor. Thanks [@dillydylann](https://github.com/dillydylann)! ### Runner - Fixed hanging when a bug report was generated from the flyout. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Settings - Improved the way the OOBE window reacts to Windows theme change. - Fixed an issue that made it impossible to change the "Switch between windows in the current zone" "Next window" shortcut for FancyZones. - Fixed a crash when entering a duplicate name for a color in the Color Picker page and improved clean up when cancelling a color edit. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Text Extractor - Text Extractor 2.0, with a new overlay, table mode and more Quality of Life improvements. Thanks [@TheJoeFin](https://github.com/TheJoeFin)! ### Documentation - SECURITY.md was updated from 0.0.2 to 0.0.9. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - Improved the README and main development document for clarity and completeness. Thanks [@codeofdusk](https://github.com/codeofdusk) and [@aprilbbrockhoeft](https://github.com/aprilbbrockhoeft)! ### Development - Fixed PowerToys Run DateTime plugin tests that were failing depending on locale, so that they can be run correctly on all dev machines. - Fixed PowerToys Run System plugin tests that were failing for certain network interfaces, so that they can be run correctly on all dev machines. Thanks [@snickler](https://github.com/snickler)! - Fixed a markdown bug on the GitHub /helped command. - Switched build pipelines to a new agent pool. Thanks [@DHowett](https://github.com/DHowett)! - New .cs files created in Visual Studio get the header added automatically. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! #### What is being planned for version 0.75 For [v0.75][github-next-release-work], we'll work on the items below: - Language selection - .NET 8 upgrade - Policy support for managing PowerToys Run plugins. *Attention*: A breaking change is planned (for 0.75), in which each plugin has to declare its identifier programmatically so that it can be controlled through GPO. For third-party plugin developers, please check https://github.com/microsoft/PowerToys/pull/27468 for more details. - New utility: Environment Variables Editor. Here's a Work in Progress preview: ![Environment Variables Editor WIP](https://github.com/microsoft/PowerToys/assets/26118718/f99532a8-5aae-481b-a662-19a95f4aa03d) - New Settings homepage. Here's a Work in Progress preview: ![PowerToys Settings Dashboard WIP](https://github.com/microsoft/PowerToys/assets/26118718/938a5715-0a9b-4fe9-9e15-adfec92da694) - Modernize and refresh the UX of PowerToys based on WPF. Here's Work in Progress previews for the modules "PowerToys Run" and "Color Picker": ![PowerToys Run UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055) ![ColorPicker UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/ceebe54b-de63-4ce7-afcb-2cd4280bf4d1) - Stability / bug fixes ## PowerToys Community The PowerToys team is extremely grateful to have the [support of an amazing active community][community-link]. The work you do is incredibly important. PowerToys wouldn’t be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Month by month, you directly help make PowerToys a better piece of software. ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct][oss-conduct-code]. ## Privacy Statement The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has the trends from the telemetry. Please read the [Microsoft privacy statement][privacy-link] for more information. [oss-CLA]: https://cla.opensource.microsoft.com [oss-conduct-code]: CODE_OF_CONDUCT.md [community-link]: COMMUNITY.md [github-release-link]: https://aka.ms/installPowerToys [microsoft-store-link]: https://aka.ms/getPowertoys [winget-link]: https://github.com/microsoft/winget-cli#installing-the-client [roadmap]: https://github.com/microsoft/PowerToys/wiki/Roadmap [privacy-link]: http://go.microsoft.com/fwlink/?LinkId=521839 [vidConfOverview]: https://aka.ms/PowerToysOverview_VideoConference [loc-bug]: https://github.com/microsoft/PowerToys/issues/new?assignees=&labels=&template=translation_issue.md&title= [usingPowerToys-docs-link]: https://aka.ms/powertoys-docs
jaimecbernardo
a1e0bd51617b2bea189cb16324eecd0e13fa7b86
77063e0767a0619abfc339db3a2a564d27310b6c
Should we have all the text italic for a nlbetter layout?
htcfreek
436
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
Why remove "VSCodium"? Isn't that still used by some versions?
jaimecbernardo
437
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
Think it is to widen the search
crutkas
438
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
The question here is if this won't break support for older versions that use "codium" instead of "VSCodium". I don't think there's a reason to remove that support.
jaimecbernardo
439
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
@eternalphane , mentioning you just in case the notification didn't reach you.
jaimecbernardo
440
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
It's IgnoreCase search. It is widening the search, so should be ok
stefansjfw
441
microsoft/PowerToys
28,742
[PT Run] [VSCodeWorkspaces] Fix support for VSCodium & add support for Remote - Tunnels
<!-- 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 - Fix support for VSCodium Stable - Add support for VSCodium Insider - Add support for Remote - Tunnels workspace - Minor code changes: - Use `remoteAuthority` to determine workspace type on newer version VSCode - Remove unused `WorkspaceEnvironment.RemoteContainers` <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 N/A <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed 1. Press <kbd>Alt</kbd><kbd>Space</kbd> to activate Powertoys Run 2. Type <kbd>{</kbd> to trigger VSCode Workspace plugin 3. Now VSCodium Stable/Insider workspaces and Remote Tunnel workspaces will correctly show in the result list ![image](https://github.com/microsoft/PowerToys/assets/11267872/6a08a823-a6c5-4c2f-838c-42f07e92fa66)
null
2023-09-24 13:31:43+00:00
2023-10-24 16:03:03+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("VSCodium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; // ? } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); var iconPath = Path.GetDirectoryName(path); if (files.Length > 0) { var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (version != string.Empty) { var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon != null) { using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); } Instances.Add(instance); } } } } } } }
eternalphane
d1e5a57b37beda832a1662bde33bea59a47e6649
cd7a9cc696d6521f27c97abd054a38a245cc16da
Misread these lines. Sorry.
jaimecbernardo
442
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/PowerToys.admx
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> <definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
Needs to be changed to `0.75.0`
htcfreek
443
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/PowerToys.admx
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> <definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
Needs to be changed to `0.75.0`
htcfreek
444
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/PowerToys.admx
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> <definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
Needs to be changed to `0.75.0`
htcfreek
445
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/PowerToys.admx
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> <definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
```suggestion <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> ``` Needs to be upped since there are new strings. And policyDefinitionResources revision in adml also needs to be upped to 1.4.
jaimecbernardo
446
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/PowerToys.admx
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <policyNamespaces> <target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" /> </policyNamespaces> <resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 --> <supportedOn> <definitions> <definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/> <definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/> <definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/> <definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/> <definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/> <definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/> </definitions> </supportedOn> <categories> <category name="PowerToys" displayName="$(string.PowerToys)" /> <category name="InstallerUpdates" displayName="$(string.InstallerUpdates)"> <parentCategory ref="PowerToys" /> </category> </categories> <policies> <policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityAwake" class="Both" displayName="$(string.ConfigureEnabledUtilityAwake)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAwake"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityColorPicker" class="Both" displayName="$(string.ConfigureEnabledUtilityColorPicker)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityColorPicker"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileLocksmith" class="Both" displayName="$(string.ConfigureEnabledUtilityFileLocksmith)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileLocksmith"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMarkdownPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMarkdownPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMarkdownPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerMonacoPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerMonacoPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerMonacoPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFPreview)" explainText="$(string.ConfigureEnabledUtilityDescriptionPDFPreviewHandler)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodePreview" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodePreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodePreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSVGThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSVGThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSVGThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerPDFThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerPDFThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerPDFThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerGcodeThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerGcodeThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerGcodeThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFileExplorerSTLThumbnails" class="Both" displayName="$(string.ConfigureEnabledUtilityFileExplorerSTLThumbnails)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFileExplorerSTLThumbnails"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityHostsFileEditor" class="Both" displayName="$(string.ConfigureEnabledUtilityHostsFileEditor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityHostsFileEditor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityImageResizer" class="Both" displayName="$(string.ConfigureEnabledUtilityImageResizer)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityImageResizer"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityKeyboardManager" class="Both" displayName="$(string.ConfigureEnabledUtilityKeyboardManager)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityKeyboardManager"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityFindMyMouse" class="Both" displayName="$(string.ConfigureEnabledUtilityFindMyMouse)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFindMyMouse"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseHighlighter" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseHighlighter)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseHighlighter"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMousePointerCrosshairs" class="Both" displayName="$(string.ConfigureEnabledUtilityMousePointerCrosshairs)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMousePointerCrosshairs"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseJump" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseJump)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseJump"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityMouseWithoutBorders" class="Both" displayName="$(string.ConfigureEnabledUtilityMouseWithoutBorders)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityMouseWithoutBorders"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPastePlain" class="Both" displayName="$(string.ConfigureEnabledUtilityPastePlain)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPastePlain"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPeek" class="Both" displayName="$(string.ConfigureEnabledUtilityPeek)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPeek"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_70_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerRename" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerRename)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerRename"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityPowerLauncher" class="Both" displayName="$(string.ConfigureEnabledUtilityPowerLauncher)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityPowerLauncher"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityRegistryPreview" class="Both" displayName="$(string.ConfigureEnabledUtilityRegistryPreview)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityRegistryPreview"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityScreenRuler" class="Both" displayName="$(string.ConfigureEnabledUtilityScreenRuler)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityScreenRuler"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityShortcutGuide" class="Both" displayName="$(string.ConfigureEnabledUtilityShortcutGuide)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityShortcutGuide"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityTextExtractor" class="Both" displayName="$(string.ConfigureEnabledUtilityTextExtractor)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityTextExtractor"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="ConfigureEnabledUtilityVideoConferenceMute" class="Both" displayName="$(string.ConfigureEnabledUtilityVideoConferenceMute)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityVideoConferenceMute"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisablePerUserInstallation" class="Machine" displayName="$(string.DisablePerUserInstallation)" explainText="$(string.DisablePerUserInstallationDescription)" key="Software\Policies\PowerToys" valueName="PerUserInstallationDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_69_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="DisableAutomaticUpdateDownload" class="Both" displayName="$(string.DisableAutomaticUpdateDownload)" explainText="$(string.DisableAutomaticUpdateDownloadDescription)" key="Software\Policies\PowerToys" valueName="AutomaticUpdateDownloadDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <policy name="SuspendNewUpdateToast" class="Both" displayName="$(string.SuspendNewUpdateToast)" explainText="$(string.SuspendNewUpdateToastDescription)" key="Software\Policies\PowerToys" valueName="SuspendNewUpdateAvailableToast"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> <!-- This policy is implemented for later usage (PT v1.0 and later) and therefore inactive. (To make it working please update `src/runner/UpdateUtils.cpp`) <policy name="DisablePeriodicUpdateCheck" class="Both" displayName="$(string.DisablePeriodicUpdateCheck)" explainText="$(string.DisablePeriodicUpdateCheckDescription)" key="Software\Policies\PowerToys" valueName="PeriodicUpdateCheckDisabled"> <parentCategory ref="InstallerUpdates" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> --> <policy name="AllowExperimentation" class="Both" displayName="$(string.AllowExperimentation)" explainText="$(string.AllowExperimentationDescription)" key="Software\Policies\PowerToys" valueName="AllowExperimentation"> <parentCategory ref="PowerToys" /> <supportedOn ref="SUPPORTED_POWERTOYS_0_68_0" /> <enabledValue> <decimal value="1" /> </enabledValue> <disabledValue> <decimal value="0" /> </disabledValue> </policy> </policies> </policyDefinitions>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
fixed
htcfreek
447
microsoft/PowerToys
28,731
[Enterprise] Global enabled state for all utilities GPO
<!-- 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 PR adds a "global enabled state for all utilities" policy. It can be overridden using the individual utility policies. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #25953 - [x] **Communication:** I've discussed this with core contributors already. If 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
null
2023-09-23 15:12:03+00:00
2023-10-06 10:28:50+00:00
src/gpo/assets/en-US/PowerToys.adml
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <displayName>PowerToys</displayName> <description>PowerToys</description> <resources> <stringTable> <string id="PowerToys">Microsoft PowerToys</string> <string id="InstallerUpdates">Installer and Updates</string> <string id="SUPPORTED_POWERTOYS_0_64_0">PowerToys version 0.64.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_68_0">PowerToys version 0.68.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string> <string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility. If you enable this setting, the utility will be always enabled and the user won't be able to disable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you don't configure this setting, users are able to disable or enable the utility. </string> <string id="ConfigureEnabledUtilityDescriptionPDFPreviewHandler">(Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) This policy configures the enabled state for a PowerToys utility. If you enable this setting, the utility will be always enabled and the user won't be able to disable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you don't configure this setting, users are able to disable or enable the utility. </string> <string id="DisablePerUserInstallationDescription">This policy configures whether per-user PowerToys installation is allowed or not. If enabled, per-user installation is not allowed. If disabled or not configured, per-user installation is allowed. </string> <string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether automatic downloads of available updates are disabled or not. (On metered connections updates are never downloaded.) If enabled, automatic downloads are disabled. If disabled or not configured, the user is in control of automatic downloads setting. </string> <string id="SuspendNewUpdateToastDescription">This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.) If enabled, the notification is suspended. If disabled or not configured, the notification is shown. Note: The notification about new major versions is always displayed. </string> <string id="DisablePeriodicUpdateCheckDescription">This policy allows you to disable automatic update checks running in the background. (The manual check in PT Settings is not affected by this policy.) If enabled, the automatic update checks are disabled. If disabled or not configured, the automatic update checks are enabled. </string> <string id="AllowExperimentationDescription">This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.) If this setting is not configured or enabled, the user can control experimentation in the PowerToys settings menu. If this setting is disabled, experimentation is not allowed. </string> <string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string> <string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string> <string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string> <string id="ConfigureEnabledUtilityCropAndLock">Crop And Lock: Configure enabled state</string> <string id="ConfigureEnabledUtilityFancyZones">FancyZones: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileLocksmith">File Locksmith: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSVGPreview">SVG file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerMarkdownPreview">Markdown file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerMonacoPreview">Source code file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerPDFPreview">PDF file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerGcodePreview">Gcode file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSVGThumbnails">SVG file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerPDFThumbnails">PDF file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerGcodeThumbnails">Gcode file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSTLThumbnails">STL file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityHostsFileEditor">Hosts file editor: Configure enabled state</string> <string id="ConfigureEnabledUtilityImageResizer">Image Resizer: Configure enabled state</string> <string id="ConfigureEnabledUtilityKeyboardManager">Keyboard Manager: Configure enabled state</string> <string id="ConfigureEnabledUtilityFindMyMouse">Find My Mouse: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseHighlighter">Mouse Highlighter: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseJump">Mouse Jump: Configure enabled state</string> <string id="ConfigureEnabledUtilityMousePointerCrosshairs">Mouse Pointer Crosshairs: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseWithoutBorders">Mouse Without Borders: Configure enabled state</string> <string id="ConfigureEnabledUtilityPastePlain">Paste as Plain Text: Configure enabled state</string> <string id="ConfigureEnabledUtilityPeek">Peek: Configure enabled state</string> <string id="ConfigureEnabledUtilityPowerRename">Power Rename: Configure enabled state</string> <string id="ConfigureEnabledUtilityPowerLauncher">PowerToys Run: Configure enabled state</string> <string id="ConfigureEnabledUtilityQuickAccent">Quick Accent: Configure enabled state</string> <string id="ConfigureEnabledUtilityRegistryPreview">Registry Preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityScreenRuler">Screen Ruler: Configure enabled state</string> <string id="ConfigureEnabledUtilityShortcutGuide">Shortcut Guide: Configure enabled state</string> <string id="ConfigureEnabledUtilityTextExtractor">Text Extractor: Configure enabled state</string> <string id="ConfigureEnabledUtilityVideoConferenceMute">Video Conference Mute: Configure enabled state</string> <string id="DisablePerUserInstallation">Disable per-user installation</string> <string id="DisableAutomaticUpdateDownload">Disable automatic downloads</string> <string id="SuspendNewUpdateToast">Suspend Action Center notification for new updates</string> <string id="DisablePeriodicUpdateCheck">Disable automatic update checks</string> <string id="AllowExperimentation">Allow Experimentation</string> </stringTable> </resources> </policyDefinitionResources>
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. --> <policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"> <displayName>PowerToys</displayName> <description>PowerToys</description> <resources> <stringTable> <string id="PowerToys">Microsoft PowerToys</string> <string id="InstallerUpdates">Installer and Updates</string> <string id="SUPPORTED_POWERTOYS_0_64_0">PowerToys version 0.64.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_68_0">PowerToys version 0.68.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string> <string id="SUPPORTED_POWERTOYS_0_75_0">PowerToys version 0.75.0 or later</string> <string id="ConfigureGlobalUtilityEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities. If you enable this setting, all utilities will be always enabled and the user won't be able to disable it. If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. If you don't configure this setting, users are able to disable or enable the utilities. The individual enabled state policies for the utilities will override this policy. </string> <string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility. If you enable this setting, the utility will be always enabled and the user won't be able to disable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you don't configure this setting, users are able to disable or enable the utility. This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. </string> <string id="ConfigureEnabledUtilityDescriptionPDFPreviewHandler">(Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) This policy configures the enabled state for a PowerToys utility. If you enable this setting, the utility will be always enabled and the user won't be able to disable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you don't configure this setting, users are able to disable or enable the utility. This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. </string> <string id="DisablePerUserInstallationDescription">This policy configures whether per-user PowerToys installation is allowed or not. If enabled, per-user installation is not allowed. If disabled or not configured, per-user installation is allowed. </string> <string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether automatic downloads of available updates are disabled or not. (On metered connections updates are never downloaded.) If enabled, automatic downloads are disabled. If disabled or not configured, the user is in control of automatic downloads setting. </string> <string id="SuspendNewUpdateToastDescription">This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.) If enabled, the notification is suspended. If disabled or not configured, the notification is shown. Note: The notification about new major versions is always displayed. </string> <string id="DisablePeriodicUpdateCheckDescription">This policy allows you to disable automatic update checks running in the background. (The manual check in PT Settings is not affected by this policy.) If enabled, the automatic update checks are disabled. If disabled or not configured, the automatic update checks are enabled. </string> <string id="AllowExperimentationDescription">This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.) If this setting is not configured or enabled, the user can control experimentation in the PowerToys settings menu. If this setting is disabled, experimentation is not allowed. </string> <string id="ConfigureGlobalUtilityEnabledState">Configure global utility enabled state</string> <string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string> <string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string> <string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string> <string id="ConfigureEnabledUtilityCropAndLock">Crop And Lock: Configure enabled state</string> <string id="ConfigureEnabledUtilityFancyZones">FancyZones: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileLocksmith">File Locksmith: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSVGPreview">SVG file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerMarkdownPreview">Markdown file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerMonacoPreview">Source code file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerPDFPreview">PDF file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerGcodePreview">Gcode file preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSVGThumbnails">SVG file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerPDFThumbnails">PDF file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerGcodeThumbnails">Gcode file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityFileExplorerSTLThumbnails">STL file thumbnail: Configure enabled state</string> <string id="ConfigureEnabledUtilityHostsFileEditor">Hosts file editor: Configure enabled state</string> <string id="ConfigureEnabledUtilityImageResizer">Image Resizer: Configure enabled state</string> <string id="ConfigureEnabledUtilityKeyboardManager">Keyboard Manager: Configure enabled state</string> <string id="ConfigureEnabledUtilityFindMyMouse">Find My Mouse: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseHighlighter">Mouse Highlighter: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseJump">Mouse Jump: Configure enabled state</string> <string id="ConfigureEnabledUtilityMousePointerCrosshairs">Mouse Pointer Crosshairs: Configure enabled state</string> <string id="ConfigureEnabledUtilityMouseWithoutBorders">Mouse Without Borders: Configure enabled state</string> <string id="ConfigureEnabledUtilityPastePlain">Paste as Plain Text: Configure enabled state</string> <string id="ConfigureEnabledUtilityPeek">Peek: Configure enabled state</string> <string id="ConfigureEnabledUtilityPowerRename">Power Rename: Configure enabled state</string> <string id="ConfigureEnabledUtilityPowerLauncher">PowerToys Run: Configure enabled state</string> <string id="ConfigureEnabledUtilityQuickAccent">Quick Accent: Configure enabled state</string> <string id="ConfigureEnabledUtilityRegistryPreview">Registry Preview: Configure enabled state</string> <string id="ConfigureEnabledUtilityScreenRuler">Screen Ruler: Configure enabled state</string> <string id="ConfigureEnabledUtilityShortcutGuide">Shortcut Guide: Configure enabled state</string> <string id="ConfigureEnabledUtilityTextExtractor">Text Extractor: Configure enabled state</string> <string id="ConfigureEnabledUtilityVideoConferenceMute">Video Conference Mute: Configure enabled state</string> <string id="DisablePerUserInstallation">Disable per-user installation</string> <string id="DisableAutomaticUpdateDownload">Disable automatic downloads</string> <string id="SuspendNewUpdateToast">Suspend Action Center notification for new updates</string> <string id="DisablePeriodicUpdateCheck">Disable automatic update checks</string> <string id="AllowExperimentation">Allow Experimentation</string> </stringTable> </resources> </policyDefinitionResources>
htcfreek
99882508bcdfdec568a2a5efaf25f7a719453aed
2d3e11a7079d93241ba641b0cd1fce8fc19a77ca
Needs to be changed to `0.75.0`
htcfreek
448
microsoft/PowerToys
28,722
🚧 [new module] Environment variables editor
<!-- 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 Co-authored very much by @niels9001 Environment Variables app offers a nice and easy way to manage environment variables. Also, you can create a profile (set of environment variables) to apply multiple variables at once. Applying the profile adds variables to User env variables. On profile apply, If there is an existing variable with the same name in User variables, backup <var name>_PowerToys_<profile name> variable is created to be able to revert it on profile un-apply (and prevent possible issues causing lost variable values). The applied variables pane on the right shows the status of applied variables, taking in order which (duplicated or not) variables take precedence, i.e. Profile -> User -> System. TODO: [ ] Icon [ ] Settings and OOBE screenshots [ ] Docs PR ![image](https://github.com/microsoft/PowerToys/assets/57057282/20ac1e0a-0e5e-4e9c-82e5-b8edbeada091) ![image](https://github.com/microsoft/PowerToys/assets/57057282/088769e7-f5a3-43c5-87fd-c7c19f329e38) ![image](https://github.com/microsoft/PowerToys/assets/57057282/436b6744-14d4-45e4-b468-5d4ec3931e66) ![image](https://github.com/microsoft/PowerToys/assets/57057282/937cf656-9298-49b6-8f1c-ba52f147920d) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #16424 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [x] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [x] [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
null
2023-09-22 21:42:08+00:00
2023-10-20 14:28:08+00:00
.github/actions/spell-check/expect.txt
aaaa abcdefghjkmnpqrstuvxyz abgr abi ABlocked ABOUTBOX Abug accctrl Acceleratorkeys ACCEPTFILES ACCESSDENIED accessibilityinsights Acl aclapi AClient AColumn acrt activatable ACTIVATEAPP activationaction ADDUNDORECORD ADifferent adio administra ADMINS adml admx advapi advfirewall AFeature AFFINETRANSFORM AFX AGGREGATABLE AHybrid ALarger alekhyareddy ALLAPPS ALLINPUT ALLOWUNDO ALLVIEW ALPHATYPE altdown alwaysontop amd AModifier AMPROPERTY AMPROPSETID ANDSCANS anges angularsen Animatable ansicolor ANull AOC aocfnapldcnfbofgmbbllojgocaelgdd APARTMENTTHREADED APeriod apidl APIENTRY APIIs Apm APPBARDATA appdata APPEXECLINK appium Applets Applicationcan applicationframehost appmanifest APPNAME appref apps appsettings appwindow appwiz APSTUDIO AQS ARandom ARCHITEW arcosh ARemapped argb ari arik Arity arjunbalgovind ARPINSTALLLOCATION ARPPRODUCTICON ARRAYSIZE arsinh artanh arw asdf asf AShortcut ASingle ASSOCCHANGED ASYNCWINDOWPLACEMENT ASYNCWINDOWPOS atl atlbase atlcom atleast atlfile atlstr ATRIOX Attribs aumid Aut Authenticode AUTHN AUTHZ AUTOHIDE AUTOMATIONPROPERTIES Autorun AUTOUPDATE AValid awakeness AWAYMODE AYUV azman backtracer bak bbwe bck BESTEFFORT betadele betsegaw BGR bgra bhid bigbar bigobj binlog BITMAPFILEHEADER bitmapimage BITMAPINFO BITMAPINFOHEADER bitmask BITSPIXEL bla BLACKONWHITE Blockquotes blogs Blt BLUEGRAY Bluetooth BLURBEHIND BLURREGION bmi bms BNumber Bokm BOKMAL bootstrapper BOOTSTRAPPERINSTALLFOLDER Bopomofo bostrot BOTTOMALIGN BPBF bpmf bpp bricelam BRIGHTGREEN Browsable bsd bstr bthprops bti btn BTNFACE Bto buf bugreport BUILDNUMBER buildtask buildtransitive BUTTONUP BVal BValue byapp BYPOSITION bytearray CALG callbackptr calpwstr Cangjie CANRENAME CAPTUREBLT CAPTURECHANGED CAtl cch CCHDEVICENAME CCHFORMNAME CCom CContext cdecl CDeclaration CDEF cdpx CElems CENTERALIGN ceq certlm certmgr cguid CHANGECBCHAIN changecursor Changemove chdir CHILDACTIVATE CHILDWINDOW chrdavis Chrzan CHT cidl CIELAB CIEXYZ cim CImage cla clangformat CLASSDC CLASSNOTAVAILABLE clayton clickable clickonce CLIENTEDGE clientid clientside CLIPBOARDUPDATE CLIPCHILDREN CLIPSIBLINGS Cloneable closesocket clrcall Cls CLSCTX clsid Clusion cmder cmdline Cmds CMIC CMINVOKECOMMANDINFO CMINVOKECOMMANDINFOEX CMock CMONITORS cmpgt cmyk cne cnt coclass CODENAME codeofconduct codereview Codespaces codicon COINIT colorconv colorformat colorhistory colorhistorylimit COLORKEY COLORONCOLOR colorpicker COLORREF comctl COMDAT comdef comdlg comexp cominterop commandline COMMANDTITLE commctrl compmgmt COMPOSITIONFULL comsupp comsuppw comsuppwd comutil CONFIGW CONFLICTINGMODIFIERKEY CONFLICTINGMODIFIERSHORTCUT CONOUT Consolas constexpr consts contentdialog contentfiles CONTEXTHELP CONTEXTMENUHANDLER CONTROLL CONTROLPARENT Controlz copiedcolorrepresentation cortana cotaskmem COULDNOT countof CPower cppblog cppruntime cppstd cppwinrt CProj createdump CREATESCHEDULEDTASK CREATESTRUCT CREATEWINDOWFAILED CRECT critsec Crossdevice CRSEL crw CSearch CSettings CSIDL cso CSRW CStyle CSY CTest CTRLALTDEL Ctrls Ctx CUI currentculture CURRENTDIR CURSORINFO cursorpos customaction CUSTOMACTIONTEST CVal cvd CVirtual cvtepu cvtsi cwd cxfksword CXSCREEN CXSMICON CXVIRTUALSCREEN cyberrex CYSCREEN CYSMICON CYVIRTUALSCREEN cziplib Dac dacl damienleroy DARKPURPLE DARKTEAL DARKYELLOW datareader datatracker Datavalue dataversion DATAW davidegiacometti Dayof Dbg Dbghelp DBLCLKS DBLEPSILON DCapture DCBA DCOM dcommon dcomp DComposition dcr dcs DDEIf DDevice ddf DDxgi Deact debian debugbreak DECLAR declspec decryptor Dedup DEFAULTBOOTSTRAPPERINSTALLFOLDER DEFAULTCOLOR DEFAULTFLAGS DEFAULTONLY DEFAULTTONEAREST DEFAULTTONULL DEFAULTTOPRIMARY DEFERERASE DEFPUSHBUTTON deinitialization DELA DELETEDKEYIMAGE DELETESCANS deletethis Delimarsky dend DENORMAL Deondre depersist deprioritized deref DESKTOPABSOLUTEEDITING DESKTOPABSOLUTEPARSING desktopshorcutinstalled desktopwindowxamlsource DEU devblogs devdocs devenum devmgmt DEVMODEW DEVMON devpkey DEVSOURCE DIIRFLAG dimm directshow DISABLEASACTIONKEY diskmgmt DISPLAYCHANGE DISPLAYCONFIG displayname divyan Dlg DLGFRAME DLGMODALFRAME dlib dllexport dllhost dllmain DNLEN dns DONOTROUND DONTVALIDATEPATH dotnet DPICHANGED DPIs DPolicy DPSAPI DQTAT DQTYPE DRAWCLIPBOARD DRAWFRAME drawingcolor dreamsofameaningfullife drf drivedetectionwarning dsc dshow DSTINVERT DUMMYUNIONNAME dutil DVASPECT DVASPECTINFO DVH DVHD dvr DVSD DVSL DVTARGETDEVICE dwl dwm dwmapi DWMCOLORIZATIONCOLORCHANGED DWMCOMPOSITIONCHANGED DWMNCRENDERINGCHANGED Dwmp DWMSENDICONICLIVEPREVIEWBITMAP DWMSENDICONICTHUMBNAIL DWMWA DWMWCP DWMWINDOWATTRIBUTE DWMWINDOWMAXIMIZEDCHANGE DWORDLONG dworigin dwrite dxgi dxgidebug dxgiformat dxguid ecount EData Edid EDITKEYBOARD editkeyboardwindow EDITSHORTCUTS editshortcutswindow EFile eip ekus emmintrin Emoji ENABLEDELAYEDEXPANSION enabledisable ENABLEDPOPUP encodedlaunch encryptor endpointvolume endregion ENDSESSION ENTERSIZEMOVE ENU EOAC epicgames epu ERASEBKGND EREOF EResize ERole ERRORIMAGE ERRORLEVEL ERRORTITLE ESettings esize esrp etl etstat etw EUQ eurochange eventlog eventvwr everytime evt EWXFORCE EWXFORCEIFHUNG EWXLOGOFF EWXPOWEROFF EWXREBOOT EWXSHUTDOWN Exa exabyte examplehandler examplepowertoy EXAND EXCLUDEFROMCAPTURE exdisp executionpolicy exename exif EXITSIZEMOVE exlist EXPCMDFLAGS EXPCMDSTATE explr exsb EXSEL exstyle EXTENDEDKEY EXTENDEDVERBS EXTRINSICPROPERTIES eyetracker fancymouse fancyzone FANCYZONESDRAWLAYOUTTEST FANCYZONESEDITOR Farbraum FARPROC fdw feimage fff FILEEXPLORER FILEFLAGS FILEFLAGSMASK FILELOCKSMITH FILELOCKSMITHEXT FILELOCKSMITHLIB FILELOCKSMITHLIBINTEROP FILEOP FILEOS FILESUBTYPE FILESYSPATH filetime FILEVERSION Filtergraph Filterkeyboard Filterx Finalizers findfast firefox FIXEDFILEINFO flyout FOF FOFX FOLDERID folderpath FORCEMINIMIZE formatetc FRAMECHANGED frankychen frm Froml FROMTOUCH FSCTL fsmgmt FTYPE Functiondiscoverykeys fwlink FZE gabime GAC gacutil Gaeilge Gaidhlig Galaxi GBarm Gbits Gbps GBs GCLP gcnew gcode gdi gdiplus GDISCALED GEmoji GETCLIENTAREAANIMATION GETDESKWALLPAPER GETDLGCODE GETDPISCALEDSIZE GETICON GETMINMAXINFO GETPROPERTYSTOREFLAGS GETSCREENSAVERRUNNING GETSECKEY GETSTATE GETTEXT GETTEXTLENGTH GHND GMEM GNumber google gpedit gpo GPOCA gpp GPT gpu GSM gtm gui guiddata guiddef guidgenerator GUITHREADINFO GValue gwl GWLP HACCEL handlekeyboardhookevent hangeul hanselman Hanzi Hardlines hardlinks HARDWAREINPUT hashcode Hashset Hashtable hashtag HASHVAL hbitmap hbm hbmp hbr HBRBACKGROUND HBRUSH hcblack HCERTSTORE HCRYPTHASH HCRYPTPROV hcursor hcwhite hdc hdrop hdwwiz HEB Heiko Helpline helptext HGFE hglobal hhk HHmmss HHOOK hhx Hiber Hiberboot HIBYTE hicon HIDEWINDOW hif highlighter HIMAGELIST himl hinst hinstance HIWORD HKCC HKCR HKCU hkey HKL HKLM HKPD HKU hlaueriksson HLOCAL HMD hmenu hmodule hmonitor HOLDENTER HOLDESC HOMEPATH homljgmgpmcbpjbnjpfijnhipfkiclkd HOOKPROC Horvalds Hostbackdropbrush hotkeycontrol hotkeys hotlight hotspot HPAINTBUFFER HPALETTE HRAWINPUT hread HREDRAW hres hresult hrgn HRSRC hsb HSCROLL hsi hsl hstring hsv htcfreek HTCLIENT hthumbnail HTOUCHINPUT HTTRANSPARENT HVal HValue Hvci hwb HWHEEL HWINEVENTHOOK hwnd HWNDFIRST HWNDLAST HWNDNEXT HWNDPREV hyjiacan IBase IBeam ICapture ICEBLUE IClass ICONERROR IData IDD IDesktop IDirect idl idlist IDOn IDR idx IDXGI IEnum ietf IExec IEXPLORE Iface IFACEMETHOD IFACEMETHODIMP IFile IFilter IGraphics IGT iid Iindex IIO iiq Ijwhost IKs ILogon IMAGEHLP imageresizer IMAGERESIZERCONTEXTMENU IMAGERESIZEREXT imageresizerinput imageresizersettings imagingdevices ime imeutil inetcpl Infobar INFOEXAMPLE Infotip ingbuffer inheritdoc initguid Inkscape Inlines inorder INPC inproc INPUTHARDWARE INPUTKEYBOARD INPUTLANGCHANGED INPUTMOUSE inputparser INPUTSINK INPUTTYPE INSTALLDESKTOPSHORTCUT INSTALLDIR INSTALLFOLDER INSTALLFOLDERTOBOOTSTRAPPERINSTALLFOLDER INSTALLFOLDERTOPREVIOUSINSTALLFOLDER INSTALLLOCATION INSTALLMESSAGE INSTALLPROPERTY installscopeperuser INSTALLSTARTMENUSHORTCUT INSTALLSTATE Inste Intelli interactable Interlop INTRESOURCE INVALIDARG invalidoperatioexception ipc ipcmanager IPlugin IPower IPREVIEW ipreviewhandlervisualssetfont IProperty IPublic irprops isbi ISearch ISettings isfinite IShell isocpp iss ITask ith ITHUMBNAIL IUI IUnknown IWbem IWeb IWIC iwr IYUV JArray jfi jfif jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi jif jjw jobject joefinapps jpe JPN jpnime Jsons jsonval junja jxr jyuwono KBDLLHOOKSTRUCT kbm kdc keybd KEYBDDATA KEYBDINPUT keyboardeventhandlers keyboardmanager keyboardmanagercommon KEYBOARDMANAGEREDITOR keyboardmanagerstate keyboardmanagerui keydown keydropdowncontrol keyevent KEYEVENTF KEYIMAGE keynum keyremaps Keytool keyup KILLFOCUS killrunner Knownfolders KSPROPERTY Kybd LAlt Lambson langword lastcodeanalysissucceeded Lastdevice Laute laviusmotileng LAYOUTRTL LBUTTON LBUTTONDBLCLK LBUTTONDOWN LBUTTONUP Lcid LCIDTo lcl Lclean LCONTROL LCtrl Ldone ldx LEFTDOWN LEFTSCROLLBAR LEFTUP lego len lepo LError Lessthan LEVELID LExit lhs lhwnd LIBID licate LIGHTORANGE LIGHTTURQUOISE lindex linkedin LINKOVERLAY linq LINQTo listview lld LLKH llkhf lmcons LMEM LMENU lnk LOADFROMFILE LOBYTE LOCALAPPDATA LOCALDISPLAY LOCALPACKAGE localport LOCALSYSTEM LOCATIONCHANGE LOGFONT LOGFONTW logon LOGPIXELSX LOn longdate LONGLONG lowlevel LOWORD lparam LPBITMAPINFOHEADER LPBYTE LPCITEMIDLIST LPCMINVOKECOMMANDINFO LPCREATESTRUCT LPCRECT LPCTSTR LPCWSTR lpdw lpfn LPINPUT lpmi LPMINMAXINFO LPMONITORINFO LPOSVERSIONINFOEXW LPPOINT LPQUERY lprc LPRECT LPSAFEARRAY LPSTR lpsz lpt LPTHREAD LPTOP lptpm LPTR LPTSTR LPVOID LPW lpwndpl LPWSTR LReader LRESULT lshift lstrcmp lstrcmpi lstrlen LTRB LTRREADING luid LUMA lusrmgr LVal LWA lwin LZero lzw Mainwindow majortype MAJORVERSION makecab MAKEINTRESOURCE MAKEINTRESOURCEW makepri manifestdependency MAPPEDTOSAMEKEY MAPTOSAMESHORTCUT MAPVK Markdig markdownpreviewhandler MARKDOWNPREVIEWHANDLERCPP Markovic martinchrzan martinmoene Maximizable MAXIMIZEBOX MAXSHORTCUTSIZE maxversiontested Mbits MBR MBs MBUTTON MBUTTONDBLCLK MBUTTONDOWN MBUTTONUP mdc MDICHILD MDL mdtext mdtxt mdwn MEDIASUBTYPE mediatype mef Mega Melman MENUBREAK MENUITEMINFO MENUITEMINFOW MERGECOPY MERGEPAINT Metadatas metafile mfapi mfc mfidl mfobjects mfplat Mfsensorgroup mftransform Mgmt mic microsoft MIDDLEDOWN MIDDLEUP midl mii MIIM millis mindaro Minimatch Minimizable MINIMIZEBOX MINIMIZEEND MINIMIZESTART miniz MINORVERSION Miracast mjpg mkd mkdn mkv mlcfg mmc mmcexe MMdd mmdeviceapi mmi mmsys mmsystem mockapi MODECHANGE modernwpf MODESPRUNED MONITORENUMPROC MONITORINFO MONITORINFOEX MONITORINFOEXW monitorinfof Monthand Moq MOUSEACTIVATE MOUSEDATA MOUSEEVENTF MOUSEHWHEEL MOUSEINPUT MOUSELEAVE MOUSEMOVE MOUSEWHEEL MOVESIZEEND MOVESIZESTART mozilla mpmc MRM MRT mru mrw msbuild msc msclr mscorlib msdata msedge MSGFLT MSIFASTINSTALL MSIHANDLE msiquery MSIRESTARTMANAGERCONTROL msix MSIXCA MSLLHOOKSTRUCT Mso msp mspaint msrc msstore mst msvc MTND Mul MULTIPLEUSE multizone mvvm mwb MWBEx myfile MYICON NAMECHANGE nameof namespaceanddescendants nao NCACTIVATE ncc NCCALCSIZE NCCREATE NCDESTROY NCHITTEST NCLBUTTONDBLCLK NCLBUTTONDOWN NCLBUTTONUP NCMBUTTONDBLCLK NCMBUTTONDOWN NCMBUTTONUP NCMOUSELEAVE NCMOUSEMOVE NCol ncpa NCPAINT NCRBUTTONDBLCLK NCRBUTTONDOWN NCRBUTTONUP NCRENDERING ndp NEEDDISPATCH needinfo Nemeth NESW netcore netcoreapp netcpl netframework netsetup netsh Neue newcolor newdev newitem newpath newrow Newtonsoft niels nielslaute NIF nint NLD NLog NLSTEXT NNN NOACTIVATE NOAGGREGATION NOASYNC NOCLOSEPROCESS NOCOALESCE NOCOPYBITS nodeca nodiscard nodoc NOINHERITLAYOUT NOINTERFACE NOLINKINFO NOMINMAX NOMIRRORBITMAP NOMOVE NONAME nonclient NONCONVERT NONELEVATED NONINFRINGEMENT nonstd NOOWNERZORDER NOPARENTNOTIFY NOREDIRECTIONBITMAP NOREDRAW NOREMOVE norename NOREPEAT NOREPOSITION norestart NORMALDISPLAY NORMALUSER NOSEARCH NOSENDCHANGING NOSIZE notfound NOTIFICATIONSDLL NOTIFYICONDATAW NOTIMPL notmatch Noto NOTOPMOST NOTRACK NOTSRCCOPY NOTSRCERASE NOUPDATE NOZORDER NPH NResize nrw NTAPI ntdll ntfs NTSTATUS nugets nuint nullonfailure numberbox NUMLOCK numpad nupkg nwc Objbase OBJID objidl oblitum ocr Ocrsettings odbc odbccp Oem officehubintl ofs oid oldcolor olditem oldnewthing oldpath oldtheme oleaut OLECHAR OLEDB OLIVEGREEN onebranch onenote onstd oobe OOBEPT opencode opensource openxmlformats OPTIMIZEFORINVOKE ORAW ori ORPHANEDDIALOGTITLE ORSCANS oss ostr OSVERSIONINFOEX OSVERSIONINFOEXW osvi OUTOFCONTEXT OUTOFMEMORY outpin Outptr outputtype outro outsettings OVERLAPPEDWINDOW overlaywindow Oversampling OWNDC OWNERDRAW Packagemanager PACL PAINTSTRUCT PALEBLUE palenshus PALETTEWINDOW paramref PARENTNOTIFY PARENTRELATIVEEDITING PARENTRELATIVEFORADDRESSBAR PARENTRELATIVEPARSING PArgb parray PARTIALCONFIRMATIONDIALOGTITLE pasteplain PATCOPY pathcch Pathto PATINVERT PATPAINT PAUDIO pbc Pbgra PBlob pcb pcch pcelt pch PCIDLIST pcs PCWSTR pdb pdbonly pdisp pdo pdto pdtobj pdw PDWORD pedrolamas pef PElems Pels PERCEIVEDFLAG perfmon pesi petabyte peteblois pevent PEXCEPTION pfn pfo pft pgp pguid PHANDLE phbm phbmp phwnd pici pid pidl PIDLIST PINDIR pinfo pinvoke pipename PKBDLLHOOKSTRUCT pkey plib PLK ploc ploca plocm plugins pluginsmodel PMSIHANDLE Pnp Popups POPUPWINDOW posix poweraccent powerlauncher POWEROCR powerpreview powerrename POWERRENAMECONTEXTMENU powerrenameinput POWERRENAMETEST powertoy POWERTOYNAME powertoyssetup powertoysusersetup Powrprof ppenum ppidl ppmt pprm pproc ppshv ppsi ppsid ppsrm ppsrree ppstm ppsz pptal ppv prc precomp Prefixer Preinstalled prevhost previewer PREVIEWHANDLERFRAMEINFO previewpane previouscamera PREVIOUSINSTALLFOLDER PREVIOUSVERSIONSINSTALLED prevpane prgms pri PRINTCLIENT printmanagement prm proactively PROCESSKEY processthreadsapi PRODEXT PRODUCTVERSION Progman programdata PROGRAMFILES projectname PROPBAG PROPERTYKEY propkey propvarutil prvpane psapi pscid PSECURITY psfgao psfi Psr psrm psrree pstatstg pstm pstr pstream pstrm PSYSTEM psz ptb ptc ptd PTOKEN PToy ptrun ptstr pui PULONG pwa pwcs pwsh PWSTR pwsz pwtd QDC qianlifeng qit QITAB QITABENT qoi qps Quarternary QUERYENDSESSION QUERYOPEN QUEUESYNC Quickime QUNS qwertyuiopasdfghjklzxcvbnm qword qwrtyuiopsghjklzxvnm raf RAII RAlt randyrants Rasterize RAWINPUT RAWINPUTDEVICE RAWINPUTHEADER RAWPATH rbhid Rbp RBUTTON RBUTTONDBLCLK RBUTTONDOWN RBUTTONUP rclsid RCONTROL RCtrl READMODE READOBJECTS READWRITE recents RECTDESTINATION RECTL rectp rects RECTSOURCE redirectedfrom Redist redistributable reencode reencoded REFCLSID REFGUID REFIID Refreshable REGCLS regedit regfile REGFILTER REGFILTERPINS REGISTERCLASSFAILED REGISTRYHEADER registrypath registrypreview REGISTRYPREVIEWEXT registryroot regkey REGPINTYPES regroot regsvr reinit REINSTALLMODE reloadable Remapper remappings REMAPSUCCESSFUL REMAPUNSUCCESSFUL Remotable remoteip Removelnk renamable RENAMEONCOLLISION Renamer reparent reparenting reparse reportbug requery requerying rescap resgen resheader resizers RESIZETOFIT resmimetype RESOURCEID RESTORETOMAXIMIZED restrictedcapabilities restrictederrorinfo resultlist resw resx retval rfc RGBQUAD rgbs rgelt rgf rgn rgs rhs ricardosantos RIDEV RIGHTDOWN RIGHTSCROLLBAR RIGHTUP riid RKey RLO RMENU RNumber roadmap robmensching Roboto rooler rop roslyn roundf ROUNDSMALL Rpc rpcrt RRF rrr RSAT rshift rsop Rsp Rstrtmgr RTB RTLREADING ruleset runas rundll rungameid RUNLEVEL runsettings runtimeclass runtimeobject runtimepack runtimes RUS Rutkas RValue rvm rwin rwl rwz ryanbodrug saahmedm sachaple sacl safeprojectname SAMEKEYPREVIOUSLYMAPPED SAMESHORTCUTPREVIOUSLYMAPPED Santossio SAVEFAILED scancode scanled schedtasks SCID Scip scipbe Scode scoobe SCOPEID screenshot scrollviewer sddl SDKDDK sdns searchterm secpol Secur Segoe Sekan SENDCHANGE sendinput sendvirtualinput Seraphima serverside SETCONTEXT setcursor setenv SETFOCUS SETFOREGROUND SETICON setlocal SETREDRAW SETTEXT SETTINGCHANGE settingsheader settingshotkeycontrol SETWORKAREA setzero sfgao SFGAOF SFP SHANDLE sharpkeys SHCNE SHCNF SHCONTF shcore shellapi SHELLDETAILS SHELLDLL shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW shellscalingapi SHFILEINFO SHGDNF SHGFI shinfo Shl shldisp shlobj shlwapi shmem shobjidl SHORTCUTATLEAST shortcutcontrol shortcutguide SHORTCUTMAXONEACTIONKEY SHORTCUTNOREPEATEDMODIFIER SHORTCUTONEACTIONKEY SHORTCUTSTARTWITHMODIFIER Shortcuttool shortdate SHORTPATH shortsplit should't showcolorname SHOWDEFAULT SHOWELEVATIONPROMPT SHOWMAXIMIZED SHOWMINIMIZED SHOWMINNOACTIVE SHOWNA SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW shtypes sia SIATTRIBFLAGS SICHINT sid siex sigdn SIGNINGSCENARIO Signtool SINGLEKEY singlekeyremapcontrol singletones sipolicy SIZEBOX Sizename SIZENESW SIZENS SIZENWSE sizeread SIZEWE SKIPOWNPROCESS skttl sku SLGP sln SMALLICON smartphone SMTO snd snwprintf softline somil Soref SOURCECLIENTAREAONLY SOURCEHEADER sourcesdirectory spam spdisp spdlog spdo spesi splitwstring spsi spsia spsrm spsv SRCAND SRCCOPY SRCERASE Srch SRCINVERT SRCPAINT sre SResize srf srme srre srw srwlock sse ssf STACKFRAME stackoverflow stackpanel standalone STARTF startupapps STARTUPINFO STARTUPINFOEX STARTUPINFOW startupscreen STATFLAG STATICEDGE STATSTG stdafx STDAPI stdcall stdcpp stdcpplatest STDMETHODCALLTYPE STDMETHODIMP stefan Stereolithography STGC STGM STGMEDIUM sticpl stl storelogo STRINGIZE stringtable stringval Strm Strmiids Strret strsafe strutil sttngs Stubless STYLECHANGED STYLECHANGING stylecop Subdir subfolders subkey SUBLANG subquery subresource Superbar sut svchost SVE SVGIn SVGIO svgz SWC SWFO SWP SWRESTORE SYMED SYMOPT SYNCMFT SYNCPAINT SYSCHAR SYSCOLORCHANGE SYSCOMMAND SYSDEADCHAR sysdm SYSICONINDEX SYSKEY syskeydown SYSKEYUP SYSLIB SYSMENU SYSTEMAPPS systemroot SYSTEMTIME sysvol Tadele talynone TApp TApplication TApplied targ TARGETAPPHEADER TARGETDIR targetentrypoint TARGETHEADER targetnametoken targetver taskbar taskkill tasklist taskschd TBM tchar Tcollab tcp tcs tcscpy TCustom tdbuild TDefault TDevice telem telephon Templated templatenamespace terabyte testapp testcase testhost testprocess TEXCOORD textblock TEXTEXTRACTOR TEXTINCLUDE tgz themeresources THH THICKFRAME THISCOMPONENT THotkey thumbcache TILEDWINDOW timedate timediff timeunion timeutil Titlecase TKey TLayout tlb tlbimp TMPVAR TNP toggleswitch toolkitcontrols toolkitconverters Toolset toolwindow TOPDOWNDIB TOUCHEVENTF TOUCHINPUT touchpad Towindow tracelogging traies transicc TRAYMOUSEMESSAGE triaging TRK trl Tsd TServer TStr TValue TWF tymed typedef TYPEKEY TYPEKEYBOARD TYPELIB TYPEMOUSE typeparam TYPESHORTCUT UAC UAL uap udit Udp uefi UHash UIA uid UIEx uipi UIs ULARGE ULONGLONG ums unapply unassign uncompilable Uncompress UNCPRIORITY UNDNAME UNICODETEXT Uninitialize uninstalling uninstantiated uniquifier Uniquifies unitconverter unittests Unk unknwn UNLEN Unmap unmute UNORM unregistering unremapped unsubscribe unvirtualized unwide UOffset UOI Updatelayout UPGRADINGPRODUCTCODE Uptool Usb USEDEFAULT USEFILEATTRIBUTES USERDATA USERDOMAIN Userenv userprofile USESHOWWINDOW USESTDHANDLES USRDLL Utc utf UType uuidof uwp uxtheme UYVY vabdq validmodulename valuegenerator Vanara variantassignment vcamp vcdl vcgtq VCINSTALLDIR vcm Vcpkg VCRT vcvars VDesktop vdi vdupq vec VERBSONLY VERBW VERIFYCONTEXT verrsrc VERSIONINFO Versioning VFT vget vgetq vid VIDCAP videoconference videoconferencevirtualdriver VIDEOINFOHEADER viewbox viewmodel vih VIRTUALDESK visiblecolorformats Visibletrue VKey VKTAB vmovl vorrq VOS vpaddlq Vpn vqsubq VREDRAW vreinterpretq VSC VSCBD vscdb vsconfig VSCROLL vsetq VSM vsonline vstemplate VSTHRD VSTT vswhere vtable Vtbl WANTPALM wbem wbemuuid WBounds Wca wcautil WCE wcex WClass wcsnicmp WDA wdp wdupenv weakme webcam webpage websearch webserver website wekyb Wevtapi wgpocpl WHITEONBLACK whitespaces WIC wifi wikipedia wildcards winapi winappdriver wincodec Wincodecsdk wincolor windef windir WINDOWCREATED WINDOWEDGE WINDOWNAME WINDOWPLACEMENT WINDOWPOSCHANGED WINDOWPOSCHANGING windowsapp WINDOWSBUILDNUMBER Windowscodecs windowssearch windowssettings WINDOWSTYLES WINDOWSTYLESICON windowsx windowwalker winerror WINEVENT winevt winexe winforms winfx winget wingetcreate Winhook winkey WINL winlogon winmd winmm winnt winres winrt winsdk winsdkver Winsock winspool winsta winternl WINTHRESHOLD winui winuiex WINVER winxamlmanager wistd withinrafael Withscript wix wixproj wixtoolset WIXUI WKSG Wlkr wmain Wman wmi WMICIM wmimgmt WMKEYDOWN WMKEYUP wmp WMSYSKEYDOWN WMSYSKEYUP wnd WNDCLASS WNDCLASSEX WNDCLASSEXW WNDCLASSW WNDPROC wordpad workaround workflows workspaces wox wparam wpf wpftmp wpfui wpr wprp wql wregex WReserved WResize writefile WRITEOBJECTS Wrk wrl WSAEADDRINUSE WSAEADDRNOTAVAIL WSAECONNRESET wscui wsf wsh wsl wss wstr wsz wtoi WTS wtsapi WTSAT Wubi WVC Wwan Wwanpp xamlstyler Xavalon XAxis xbf Xbox XBUTTON XBUTTONDBLCLK XBUTTONDOWN XBUTTONUP XDocument XDOWN XElement xfd XFile XIncrement XLoc XNamespace XOffset XPels XPixel XResource xsi xstyler XStr XUP XVIRTUALSCREEN xxxxxx YAxis ycv Yeet YIncrement yinle yinwang yinyue YOffset Youdao YPels YResolution YStr YUY yuyoyuppe YUYV YVIRTUALSCREEN YVU YVYU ZEROINIT ZIndex zipfile zipfolder zonable zoneset Zoneszonabletester Zykova zzz
aaaa abcdefghjkmnpqrstuvxyz abgr abi ABlocked ABOUTBOX Abug accctrl Acceleratorkeys ACCEPTFILES ACCESSDENIED accessibilityinsights Acl aclapi AClient AColumn acrt activatable ACTIVATEAPP activationaction ADDUNDORECORD ADifferent adio administra ADMINS adml admx advapi advfirewall AFeature AFFINETRANSFORM AFX AGGREGATABLE AHybrid ALarger alekhyareddy ALLAPPS ALLINPUT ALLOWUNDO ALLVIEW ALPHATYPE altdown alwaysontop amd AModifier AMPROPERTY AMPROPSETID ANDSCANS anges angularsen Animatable ansicolor ANull AOC aocfnapldcnfbofgmbbllojgocaelgdd APARTMENTTHREADED APeriod apidl APIENTRY APIIs Apm APPBARDATA appdata APPEXECLINK appium Applets Applicationcan applicationframehost appmanifest APPNAME appref apps appsettings appwindow appwiz APSTUDIO AQS ARandom ARCHITEW arcosh ARemapped argb ari arik Arity arjunbalgovind ARPINSTALLLOCATION ARPPRODUCTICON ARRAYSIZE arsinh artanh arw asdf asf AShortcut ASingle ASSOCCHANGED ASYNCWINDOWPLACEMENT ASYNCWINDOWPOS atl atlbase atlcom atleast atlfile atlstr ATRIOX Attribs aumid Aut Authenticode AUTHN AUTHZ AUTOHIDE AUTOMATIONPROPERTIES Autorun AUTOUPDATE AValid awakeness AWAYMODE AYUV azman backtracer bak bbwe bck BESTEFFORT betadele betsegaw BGR bgra bhid bigbar bigobj binlog BITMAPFILEHEADER bitmapimage BITMAPINFO BITMAPINFOHEADER bitmask BITSPIXEL bla BLACKONWHITE Blockquotes blogs Blt BLUEGRAY Bluetooth BLURBEHIND BLURREGION bmi bms BNumber Bokm BOKMAL bootstrapper BOOTSTRAPPERINSTALLFOLDER Bopomofo bostrot BOTTOMALIGN BPBF bpmf bpp bricelam BRIGHTGREEN Browsable bsd bstr bthprops bti btn BTNFACE Bto buf bugreport BUILDNUMBER buildtask buildtransitive BUTTONUP BVal BValue byapp BYPOSITION bytearray CALG callbackptr calpwstr Cangjie CANRENAME CAPTUREBLT CAPTURECHANGED CAtl cch CCHDEVICENAME CCHFORMNAME CCom CContext cdecl CDeclaration CDEF cdpx CElems CENTERALIGN ceq certlm certmgr cguid CHANGECBCHAIN changecursor Changemove chdir CHILDACTIVATE CHILDWINDOW chrdavis Chrzan CHT cidl CIELAB CIEXYZ cim CImage cla clangformat CLASSDC CLASSNOTAVAILABLE clayton clickable clickonce CLIENTEDGE clientid clientside CLIPBOARDUPDATE CLIPCHILDREN CLIPSIBLINGS Cloneable closesocket clrcall Cls CLSCTX clsid Clusion cmder cmdline Cmds CMIC CMINVOKECOMMANDINFO CMINVOKECOMMANDINFOEX CMock CMONITORS cmpgt cmyk cne cnt coclass CODENAME codeofconduct codereview Codespaces codicon COINIT colorconv colorformat colorhistory colorhistorylimit COLORKEY COLORONCOLOR colorpicker COLORREF comctl COMDAT comdef comdlg comexp cominterop commandline COMMANDTITLE commctrl compmgmt COMPOSITIONFULL comsupp comsuppw comsuppwd comutil CONFIGW CONFLICTINGMODIFIERKEY CONFLICTINGMODIFIERSHORTCUT CONOUT Consolas constexpr consts contentdialog contentfiles CONTEXTHELP CONTEXTMENUHANDLER CONTROLL CONTROLPARENT Controlz copiedcolorrepresentation cortana cotaskmem COULDNOT countof CPower cppblog cppruntime cppstd cppwinrt CProj createdump CREATESCHEDULEDTASK CREATESTRUCT CREATEWINDOWFAILED CRECT critsec Crossdevice CRSEL crw CSearch CSettings CSIDL cso CSRW CStyle CSY CTest CTRLALTDEL Ctrls Ctx CUI currentculture CURRENTDIR CURSORINFO cursorpos customaction CUSTOMACTIONTEST CVal cvd CVirtual cvtepu cvtsi cwd cxfksword CXSCREEN CXSMICON CXVIRTUALSCREEN cyberrex CYSCREEN CYSMICON CYVIRTUALSCREEN cziplib Dac dacl damienleroy DARKPURPLE DARKTEAL DARKYELLOW datareader datatracker Datavalue dataversion DATAW davidegiacometti Dayof Dbg Dbghelp DBLCLKS DBLEPSILON DCapture DCBA DCOM dcommon dcomp DComposition dcr dcs DDEIf DDevice ddf DDxgi Deact debian debugbreak DECLAR declspec decryptor Dedup DEFAULTBOOTSTRAPPERINSTALLFOLDER DEFAULTCOLOR DEFAULTFLAGS DEFAULTONLY DEFAULTTONEAREST DEFAULTTONULL DEFAULTTOPRIMARY DEFERERASE DEFPUSHBUTTON deinitialization DELA DELETEDKEYIMAGE DELETESCANS deletethis Delimarsky dend DENORMAL Deondre depersist deprioritized deref DESKTOPABSOLUTEEDITING DESKTOPABSOLUTEPARSING desktopshorcutinstalled desktopwindowxamlsource DEU devblogs devdocs devenum devmgmt DEVMODEW DEVMON devpkey DEVSOURCE DIIRFLAG dimm directshow DISABLEASACTIONKEY diskmgmt DISPLAYCHANGE DISPLAYCONFIG displayname divyan Dlg DLGFRAME DLGMODALFRAME dlib dllexport dllhost dllmain DNLEN dns DONOTROUND DONTVALIDATEPATH dotnet DPICHANGED DPIs DPolicy DPSAPI DQTAT DQTYPE DRAWCLIPBOARD DRAWFRAME drawingcolor dreamsofameaningfullife drf drivedetectionwarning dsc dshow DSTINVERT DUMMYUNIONNAME dutil DVASPECT DVASPECTINFO DVH DVHD dvr DVSD DVSL DVTARGETDEVICE dwl dwm dwmapi DWMCOLORIZATIONCOLORCHANGED DWMCOMPOSITIONCHANGED DWMNCRENDERINGCHANGED Dwmp DWMSENDICONICLIVEPREVIEWBITMAP DWMSENDICONICTHUMBNAIL DWMWA DWMWCP DWMWINDOWATTRIBUTE DWMWINDOWMAXIMIZEDCHANGE DWORDLONG dworigin dwrite dxgi dxgidebug dxgiformat dxguid ecount EData Edid EDITKEYBOARD editkeyboardwindow EDITSHORTCUTS editshortcutswindow EFile eip ekus emmintrin Emoji ENABLEDELAYEDEXPANSION enabledisable ENABLEDPOPUP encodedlaunch encryptor endpointvolume endregion ENDSESSION ENTERSIZEMOVE ENU EOAC epicgames epu ERASEBKGND EREOF EResize ERole ERRORIMAGE ERRORLEVEL ERRORTITLE ESettings esize esrp etl etstat etw EUQ eurochange eventlog eventvwr everytime evt EWXFORCE EWXFORCEIFHUNG EWXLOGOFF EWXPOWEROFF EWXREBOOT EWXSHUTDOWN Exa exabyte examplehandler examplepowertoy EXAND EXCLUDEFROMCAPTURE exdisp executionpolicy exename exif EXITSIZEMOVE exlist EXPCMDFLAGS EXPCMDSTATE explr exsb EXSEL exstyle EXTENDEDKEY EXTENDEDVERBS EXTRINSICPROPERTIES eyetracker fancymouse fancyzone FANCYZONESDRAWLAYOUTTEST FANCYZONESEDITOR Farbraum FARPROC fdw feimage fff FILEEXPLORER FILEFLAGS FILEFLAGSMASK FILELOCKSMITH FILELOCKSMITHEXT FILELOCKSMITHLIB FILELOCKSMITHLIBINTEROP FILEOP FILEOS FILESUBTYPE FILESYSPATH filetime FILEVERSION Filtergraph Filterkeyboard Filterx Finalizers findfast firefox FIXEDFILEINFO flyout FOF FOFX FOLDERID folderpath FORCEMINIMIZE formatetc FRAMECHANGED frankychen frm Froml FROMTOUCH FSCTL fsmgmt FTYPE Functiondiscoverykeys fwlink FZE gabime GAC gacutil Gaeilge Gaidhlig Galaxi GBarm Gbits Gbps GBs GCLP gcnew gcode gdi gdiplus GDISCALED GEmoji GETCLIENTAREAANIMATION GETDESKWALLPAPER GETDLGCODE GETDPISCALEDSIZE GETICON GETMINMAXINFO GETPROPERTYSTOREFLAGS GETSCREENSAVERRUNNING GETSECKEY GETSTATE GETTEXT GETTEXTLENGTH GHND GMEM GNumber google gpedit gpo GPOCA gpp GPT gpu GSM gtm gui guiddata guiddef guidgenerator GUITHREADINFO GValue gwl GWLP HACCEL handlekeyboardhookevent hangeul hanselman Hanzi Hardlines hardlinks HARDWAREINPUT hashcode Hashset Hashtable hashtag HASHVAL hbitmap hbm hbmp hbr HBRBACKGROUND HBRUSH hcblack HCERTSTORE HCRYPTHASH HCRYPTPROV hcursor hcwhite hdc hdrop hdwwiz HEB Heiko Helpline helptext HGFE hglobal hhk HHmmss HHOOK hhx Hiber Hiberboot HIBYTE hicon HIDEWINDOW hif highlighter HIMAGELIST himl hinst hinstance HIWORD HKCC HKCR HKCU hkey HKL HKLM HKPD HKU hlaueriksson HLOCAL HMD hmenu hmodule hmonitor HOLDENTER HOLDESC HOMEPATH homljgmgpmcbpjbnjpfijnhipfkiclkd HOOKPROC Horvalds Hostbackdropbrush hotkeycontrol hotkeys hotlight hotspot HPAINTBUFFER HPALETTE HRAWINPUT hread HREDRAW hres hresult hrgn HRSRC hsb HSCROLL hsi hsl hstring hsv htcfreek HTCLIENT hthumbnail HTOUCHINPUT HTTRANSPARENT HVal HValue Hvci hwb HWHEEL HWINEVENTHOOK hwnd HWNDFIRST HWNDLAST HWNDNEXT HWNDPREV hyjiacan IBase IBeam ICapture ICEBLUE IClass ICONERROR IData IDD IDesktop IDirect idl idlist IDOn IDR idx IDXGI IEnum ietf IExec IEXPLORE Iface IFACEMETHOD IFACEMETHODIMP IFile IFilter IGraphics IGT iid Iindex IIO iiq IJson Ijwhost IKs ILogon IMAGEHLP imageresizer IMAGERESIZERCONTEXTMENU IMAGERESIZEREXT imageresizerinput imageresizersettings imagingdevices ime imeutil inetcpl Infobar INFOEXAMPLE Infotip ingbuffer inheritdoc initguid Inkscape Inlines inorder INPC inproc INPUTHARDWARE INPUTKEYBOARD INPUTLANGCHANGED INPUTMOUSE inputparser INPUTSINK INPUTTYPE INSTALLDESKTOPSHORTCUT INSTALLDIR INSTALLFOLDER INSTALLFOLDERTOBOOTSTRAPPERINSTALLFOLDER INSTALLFOLDERTOPREVIOUSINSTALLFOLDER INSTALLLOCATION INSTALLMESSAGE INSTALLPROPERTY installscopeperuser INSTALLSTARTMENUSHORTCUT INSTALLSTATE Inste Intelli interactable Interlop INTRESOURCE INVALIDARG invalidoperatioexception ipc ipcmanager IPlugin IPower IPREVIEW ipreviewhandlervisualssetfont IProperty IPublic irprops isbi ISearch ISettings isfinite IShell isocpp iss ITask ith ITHUMBNAIL IUI IUnknown IWbem IWeb IWIC iwr IYUV JArray jfi jfif jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi jif jjw jobject joefinapps jpe JPN jpnime Jsons jsonval junja jxr jyuwono KBDLLHOOKSTRUCT kbm kdc keybd KEYBDDATA KEYBDINPUT keyboardeventhandlers keyboardmanager keyboardmanagercommon KEYBOARDMANAGEREDITOR keyboardmanagerstate keyboardmanagerui keydown keydropdowncontrol keyevent KEYEVENTF KEYIMAGE keynum keyremaps Keytool keyup KILLFOCUS killrunner Knownfolders KSPROPERTY Kybd LAlt Lambson langword lastcodeanalysissucceeded Lastdevice Laute laviusmotileng LAYOUTRTL Lbl LBUTTON LBUTTONDBLCLK LBUTTONDOWN LBUTTONUP Lcid LCIDTo lcl Lclean LCONTROL LCtrl Ldone ldx LEFTDOWN LEFTSCROLLBAR LEFTUP lego len lepo LError Lessthan LEVELID LExit lhs lhwnd LIBID licate LIGHTORANGE LIGHTTURQUOISE lindex linkedin LINKOVERLAY linq LINQTo listview lld LLKH llkhf lmcons LMEM LMENU lnk LOADFROMFILE LOBYTE LOCALAPPDATA LOCALDISPLAY LOCALPACKAGE localport LOCALSYSTEM LOCATIONCHANGE LOGFONT LOGFONTW logon LOGPIXELSX LOn longdate LONGLONG lowlevel LOWORD lparam LPBITMAPINFOHEADER LPBYTE LPCITEMIDLIST LPCMINVOKECOMMANDINFO LPCREATESTRUCT LPCRECT LPCTSTR LPCWSTR lpdw lpfn LPINPUT lpmi LPMINMAXINFO LPMONITORINFO LPOSVERSIONINFOEXW LPPOINT LPQUERY lprc LPRECT LPSAFEARRAY LPSTR lpsz lpt LPTHREAD LPTOP lptpm LPTR LPTSTR LPVOID LPW lpwndpl LPWSTR LReader LRESULT lshift lstrcmp lstrcmpi lstrlen LTRB LTRREADING luid LUMA lusrmgr LVal LWA lwin LZero lzw Mainwindow majortype MAJORVERSION makecab MAKEINTRESOURCE MAKEINTRESOURCEW makepri manifestdependency MAPPEDTOSAMEKEY MAPTOSAMESHORTCUT MAPVK Markdig markdownpreviewhandler MARKDOWNPREVIEWHANDLERCPP Markovic martinchrzan martinmoene Maximizable MAXIMIZEBOX MAXSHORTCUTSIZE maxversiontested Mbits MBR MBs MBUTTON MBUTTONDBLCLK MBUTTONDOWN MBUTTONUP mdc MDICHILD MDL mdtext mdtxt mdwn MEDIASUBTYPE mediatype mef Mega Melman MENUBREAK MENUITEMINFO MENUITEMINFOW MERGECOPY MERGEPAINT Metadatas metafile mfapi mfc mfidl mfobjects mfplat Mfsensorgroup mftransform Mgmt mic microsoft MIDDLEDOWN MIDDLEUP midl mii MIIM millis mindaro Minimatch Minimizable MINIMIZEBOX MINIMIZEEND MINIMIZESTART miniz MINORVERSION Miracast mjpg mkd mkdn mkv mlcfg mmc mmcexe MMdd mmdeviceapi mmi mmsys mmsystem mockapi MODECHANGE modernwpf MODESPRUNED MONITORENUMPROC MONITORINFO MONITORINFOEX MONITORINFOEXW monitorinfof Monthand Moq MOUSEACTIVATE MOUSEDATA MOUSEEVENTF MOUSEHWHEEL MOUSEINPUT MOUSELEAVE MOUSEMOVE MOUSEWHEEL MOVESIZEEND MOVESIZESTART mozilla mpmc MRM MRT mru mrw msbuild msc msclr mscorlib msdata msedge MSGFLT MSIFASTINSTALL MSIHANDLE msiquery MSIRESTARTMANAGERCONTROL msix MSIXCA MSLLHOOKSTRUCT Mso msp mspaint msrc msstore mst msvc MTND Mul MULTIPLEUSE multizone mvvm mwb MWBEx myfile MYICON NAMECHANGE nameof namespaceanddescendants nao NCACTIVATE ncc NCCALCSIZE NCCREATE NCDESTROY NCHITTEST NCLBUTTONDBLCLK NCLBUTTONDOWN NCLBUTTONUP NCMBUTTONDBLCLK NCMBUTTONDOWN NCMBUTTONUP NCMOUSELEAVE NCMOUSEMOVE NCol ncpa NCPAINT NCRBUTTONDBLCLK NCRBUTTONDOWN NCRBUTTONUP NCRENDERING ndp NEEDDISPATCH needinfo Nemeth NESW netcore netcoreapp netcpl netframework netsetup netsh Neue newcolor newdev newitem newpath newrow Newtonsoft niels nielslaute NIF nint NLD NLog NLSTEXT NNN NOACTIVATE NOAGGREGATION NOASYNC NOCLOSEPROCESS NOCOALESCE NOCOPYBITS nodeca nodiscard nodoc NOINHERITLAYOUT NOINTERFACE NOLINKINFO NOMINMAX NOMIRRORBITMAP NOMOVE NONAME nonclient NONCONVERT NONELEVATED NONINFRINGEMENT nonstd NOOWNERZORDER NOPARENTNOTIFY NOREDIRECTIONBITMAP NOREDRAW NOREMOVE norename NOREPEAT NOREPOSITION norestart NORMALDISPLAY NORMALUSER NOSEARCH NOSENDCHANGING NOSIZE notfound NOTIFICATIONSDLL NOTIFYICONDATAW NOTIMPL notmatch Noto NOTOPMOST NOTRACK NOTSRCCOPY NOTSRCERASE NOUPDATE NOZORDER NPH NResize nrw NTAPI ntdll ntfs NTSTATUS nugets nuint nullonfailure numberbox NUMLOCK numpad nupkg nwc Objbase OBJID objidl oblitum ocr Ocrsettings odbc odbccp Oem officehubintl ofs oid oldcolor olditem oldnewthing oldpath oldtheme oleaut OLECHAR OLEDB OLIVEGREEN onebranch onenote onstd oobe OOBEPT opencode opensource openxmlformats OPTIMIZEFORINVOKE ORAW ori ORPHANEDDIALOGTITLE ORSCANS oss ostr OSVERSIONINFOEX OSVERSIONINFOEXW osvi OUTOFCONTEXT OUTOFMEMORY outpin Outptr outputtype outro outsettings OVERLAPPEDWINDOW overlaywindow Oversampling OWNDC OWNERDRAW Packagemanager PACL PAINTSTRUCT PALEBLUE palenshus PALETTEWINDOW paramref PARENTNOTIFY PARENTRELATIVEEDITING PARENTRELATIVEFORADDRESSBAR PARENTRELATIVEPARSING PArgb parray PARTIALCONFIRMATIONDIALOGTITLE pasteplain PATCOPY pathcch PATHEXT Pathto PATINVERT PATPAINT PAUDIO pbc Pbgra PBlob pcb pcch pcelt pch PCIDLIST pcs PCWSTR pdb pdbonly pdisp pdo pdto pdtobj pdw PDWORD pedrolamas pef PElems Pels PERCEIVEDFLAG perfmon pesi petabyte peteblois pevent PEXCEPTION pfn pfo pft pgp pguid PHANDLE phbm phbmp phwnd pici pid pidl PIDLIST PINDIR pinfo pinvoke pipename PKBDLLHOOKSTRUCT pkey plib PLK ploc ploca plocm plugins pluginsmodel PMSIHANDLE Pnp Popups POPUPWINDOW posix poweraccent powerlauncher POWEROCR powerpreview powerrename POWERRENAMECONTEXTMENU powerrenameinput POWERRENAMETEST powertoy POWERTOYNAME powertoyssetup powertoysusersetup Powrprof ppenum ppidl ppmt pprm pproc ppshv ppsi ppsid ppsrm ppsrree ppstm ppsz pptal ppv prc precomp Prefixer Preinstalled prevhost previewer PREVIEWHANDLERFRAMEINFO previewpane previouscamera PREVIOUSINSTALLFOLDER PREVIOUSVERSIONSINSTALLED prevpane prgms pri PRINTCLIENT printmanagement prm proactively PROCESSKEY processthreadsapi PRODEXT PRODUCTVERSION Progman programdata PROGRAMFILES projectname PROPBAG PROPERTYKEY propkey propvarutil prvpane psapi pscid PSECURITY psfgao psfi PSMODULEPATH Psr psrm psrree pstatstg pstm pstr pstream pstrm PSYSTEM psz ptb ptc ptd PTOKEN PToy ptrun ptstr pui PULONG pwa pwcs pwsh PWSTR pwsz pwtd QDC qianlifeng qit QITAB QITABENT qoi qps Quarternary QUERYENDSESSION QUERYOPEN QUEUESYNC Quickime QUNS qwertyuiopasdfghjklzxcvbnm qword qwrtyuiopsghjklzxvnm raf RAII RAlt randyrants Rasterize RAWINPUT RAWINPUTDEVICE RAWINPUTHEADER RAWPATH rbhid Rbp RBUTTON RBUTTONDBLCLK RBUTTONDOWN RBUTTONUP rclsid RCONTROL RCtrl READMODE READOBJECTS READWRITE recents RECTDESTINATION RECTL rectp rects RECTSOURCE redirectedfrom Redist redistributable reencode reencoded REFCLSID REFGUID REFIID Refreshable REGCLS regedit regfile REGFILTER REGFILTERPINS REGISTERCLASSFAILED REGISTRYHEADER registrypath registrypreview REGISTRYPREVIEWEXT registryroot regkey REGPINTYPES regroot regsvr reinit REINSTALLMODE reloadable Remapper remappings REMAPSUCCESSFUL REMAPUNSUCCESSFUL Remotable remoteip Removelnk renamable RENAMEONCOLLISION Renamer reparent reparenting reparse reportbug requery requerying rescap resgen resheader resizers RESIZETOFIT resmimetype RESOURCEID RESTORETOMAXIMIZED restrictedcapabilities restrictederrorinfo resultlist resw resx retval rfc RGBQUAD rgbs rgelt rgf rgn rgs rhs ricardosantos RIDEV RIGHTDOWN RIGHTSCROLLBAR RIGHTUP riid RKey RLO RMENU RNumber roadmap robmensching Roboto rooler rop roslyn roundf ROUNDSMALL Rpc rpcrt RRF rrr RSAT rshift rsop Rsp Rstrtmgr RTB RTLREADING ruleset runas rundll rungameid RUNLEVEL runsettings runtimeclass runtimeobject runtimepack runtimes RUS Rutkas RValue rvm rwin rwl rwz ryanbodrug saahmedm sachaple sacl safeprojectname SAMEKEYPREVIOUSLYMAPPED SAMESHORTCUTPREVIOUSLYMAPPED Santossio SAVEFAILED scancode scanled schedtasks SCID Scip scipbe Scode scoobe SCOPEID screenshot scrollviewer sddl SDKDDK sdns searchterm secpol Secur Segoe Sekan SENDCHANGE sendinput sendvirtualinput Seraphima serverside SETCONTEXT setcursor setenv SETFOCUS SETFOREGROUND SETICON setlocal SETREDRAW SETTEXT SETTINGCHANGE SETTINGSCHANGED settingsheader settingshotkeycontrol SETWORKAREA setzero sfgao SFGAOF SFP SHANDLE sharpkeys SHCNE SHCNF SHCONTF shcore shellapi SHELLDETAILS SHELLDLL shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW shellscalingapi SHFILEINFO SHGDNF SHGFI shinfo Shl shldisp shlobj shlwapi shmem shobjidl SHORTCUTATLEAST shortcutcontrol shortcutguide SHORTCUTMAXONEACTIONKEY SHORTCUTNOREPEATEDMODIFIER SHORTCUTONEACTIONKEY SHORTCUTSTARTWITHMODIFIER Shortcuttool shortdate SHORTPATH shortsplit should't showcolorname SHOWDEFAULT SHOWELEVATIONPROMPT SHOWMAXIMIZED SHOWMINIMIZED SHOWMINNOACTIVE SHOWNA SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW shtypes sia SIATTRIBFLAGS SICHINT sid siex sigdn SIGNINGSCENARIO Signtool SINGLEKEY singlekeyremapcontrol singletones sipolicy SIZEBOX Sizename SIZENESW SIZENS SIZENWSE sizeread SIZEWE SKIPOWNPROCESS skttl sku SLGP sln SMALLICON smartphone SMTO snd snwprintf softline somil Soref SOURCECLIENTAREAONLY SOURCEHEADER sourcesdirectory spam spdisp spdlog spdo spesi splitwstring spsi spsia spsrm spsv SRCAND SRCCOPY SRCERASE Srch SRCINVERT SRCPAINT sre SResize srf srme srre srw srwlock sse ssf STACKFRAME stackoverflow stackpanel standalone STARTF startupapps STARTUPINFO STARTUPINFOEX STARTUPINFOW startupscreen STATFLAG STATICEDGE STATSTG stdafx STDAPI stdcall stdcpp stdcpplatest STDMETHODCALLTYPE STDMETHODIMP stefan Stereolithography STGC STGM STGMEDIUM sticpl stl storelogo STRINGIZE stringtable stringval Strm Strmiids Strret strsafe strutil sttngs Stubless STYLECHANGED STYLECHANGING stylecop Subdir subfolders subkey SUBLANG subquery subresource Superbar sut svchost SVE SVGIn SVGIO svgz SWC SWFO SWP SWRESTORE SYMED SYMOPT SYNCMFT SYNCPAINT SYSCHAR SYSCOLORCHANGE SYSCOMMAND SYSDEADCHAR sysdm SYSICONINDEX SYSKEY syskeydown SYSKEYUP SYSLIB SYSMENU SYSTEMAPPS systemroot SYSTEMTIME sysvol Tadele talynone TApp TApplication TApplied targ TARGETAPPHEADER TARGETDIR targetentrypoint TARGETHEADER targetnametoken targetver taskbar taskkill tasklist taskschd TBM tchar Tcollab tcp tcs tcscpy TCustom tdbuild TDefault TDevice telem telephon Templated templatenamespace terabyte testapp testcase testhost testprocess TEXCOORD textblock TEXTEXTRACTOR TEXTINCLUDE tgz themeresources THH THICKFRAME THISCOMPONENT THotkey thumbcache TILEDWINDOW timedate timediff timeunion timeutil Titlecase TKey TLayout tlb tlbimp TMPVAR TNP toggleswitch toolkitcontrols toolkitconverters Toolset toolwindow TOPDOWNDIB TOUCHEVENTF TOUCHINPUT touchpad Towindow tracelogging traies transicc TRAYMOUSEMESSAGE triaging TRK trl Tsd TServer TStr TValue TWF tymed typedef TYPEKEY TYPEKEYBOARD TYPELIB TYPEMOUSE typeparam TYPESHORTCUT UAC UAL uap udit Udp uefi UHash UIA uid UIEx uipi UIs ULARGE ULONGLONG ums unapply unassign uncompilable Uncompress UNCPRIORITY UNDNAME UNICODETEXT Uninitialize uninstalling uninstantiated uniquifier Uniquifies unitconverter unittests Unk unknwn UNLEN Unmap unmute UNORM unregistering unremapped unsubscribe unvirtualized unwide UOffset UOI Updatelayout UPGRADINGPRODUCTCODE Uptool Usb USEDEFAULT USEFILEATTRIBUTES USERDATA USERDOMAIN Userenv userprofile USESHOWWINDOW USESTDHANDLES USRDLL Utc utf UType uuidof uwp uxtheme UYVY vabdq validmodulename valuegenerator Vanara variantassignment vcamp vcdl vcgtq VCINSTALLDIR vcm Vcpkg VCRT vcvars VDesktop vdi vdupq vec VERBSONLY VERBW VERIFYCONTEXT verrsrc VERSIONINFO Versioning VFT vget vgetq vid VIDCAP videoconference videoconferencevirtualdriver VIDEOINFOHEADER viewbox viewmodel vih VIRTUALDESK visiblecolorformats Visibletrue VKey VKTAB vmovl vorrq VOS vpaddlq Vpn vqsubq VREDRAW vreinterpretq VSC VSCBD vscdb vsconfig VSCROLL vsetq VSM vsonline vstemplate VSTHRD VSTT vswhere vtable Vtbl WANTPALM wbem wbemuuid WBounds Wca wcautil WCE wcex WClass wcsnicmp WDA wdp wdupenv weakme webcam webpage websearch webserver website wekyb Wevtapi wgpocpl WHITEONBLACK whitespaces WIC wifi wikipedia wildcards winapi winappdriver wincodec Wincodecsdk wincolor windef windir WINDOWCREATED WINDOWEDGE WINDOWNAME WINDOWPLACEMENT WINDOWPOSCHANGED WINDOWPOSCHANGING windowsapp WINDOWSBUILDNUMBER Windowscodecs windowssearch windowssettings WINDOWSTYLES WINDOWSTYLESICON windowsx windowwalker winerror WINEVENT winevt winexe winforms winfx winget wingetcreate Winhook winkey WINL winlogon winmd winmm winnt winres winrt winsdk winsdkver Winsock winspool winsta winternl WINTHRESHOLD winui winuiex WINVER winxamlmanager wistd withinrafael Withscript wix wixproj wixtoolset WIXUI WKSG Wlkr wmain Wman wmi WMICIM wmimgmt WMKEYDOWN WMKEYUP wmp WMSYSKEYDOWN WMSYSKEYUP wnd WNDCLASS WNDCLASSEX WNDCLASSEXW WNDCLASSW WNDPROC wordpad workaround workflows workspaces wox wparam wpf wpftmp wpfui wpr wprp wql wregex WReserved WResize writefile WRITEOBJECTS Wrk wrl WSAEADDRINUSE WSAEADDRNOTAVAIL WSAECONNRESET wscui wsf wsh wsl wss wstr wsz wtoi WTS wtsapi WTSAT Wubi WVC Wwan Wwanpp xamlstyler Xavalon XAxis xbf Xbox XBUTTON XBUTTONDBLCLK XBUTTONDOWN XBUTTONUP XDocument XDOWN XElement xfd XFile XIncrement XLoc XNamespace XOffset XPels XPixel XResource xsi xstyler XStr XUP XVIRTUALSCREEN xxxxxx YAxis ycv Yeet YIncrement yinle yinwang yinyue YOffset Youdao YPels YResolution YStr YUY yuyoyuppe YUYV YVIRTUALSCREEN YVU YVYU ZEROINIT ZIndex zipfile zipfolder zonable zoneset Zoneszonabletester Zykova zzz
stefansjfw
1f936df3ebce73b726ed11c9fa38fd477b4b0fbd
812b343776b5f0cbda734182e4996571803c35d8
This entry shouldn't be needed. There's an issue in some file. Let's remove it and the issue in the file too.
jaimecbernardo
449
microsoft/PowerToys
28,722
🚧 [new module] Environment variables editor
<!-- 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 Co-authored very much by @niels9001 Environment Variables app offers a nice and easy way to manage environment variables. Also, you can create a profile (set of environment variables) to apply multiple variables at once. Applying the profile adds variables to User env variables. On profile apply, If there is an existing variable with the same name in User variables, backup <var name>_PowerToys_<profile name> variable is created to be able to revert it on profile un-apply (and prevent possible issues causing lost variable values). The applied variables pane on the right shows the status of applied variables, taking in order which (duplicated or not) variables take precedence, i.e. Profile -> User -> System. TODO: [ ] Icon [ ] Settings and OOBE screenshots [ ] Docs PR ![image](https://github.com/microsoft/PowerToys/assets/57057282/20ac1e0a-0e5e-4e9c-82e5-b8edbeada091) ![image](https://github.com/microsoft/PowerToys/assets/57057282/088769e7-f5a3-43c5-87fd-c7c19f329e38) ![image](https://github.com/microsoft/PowerToys/assets/57057282/436b6744-14d4-45e4-b468-5d4ec3931e66) ![image](https://github.com/microsoft/PowerToys/assets/57057282/937cf656-9298-49b6-8f1c-ba52f147920d) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #16424 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [x] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [x] [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
null
2023-09-22 21:42:08+00:00
2023-10-20 14:28:08+00:00
src/common/utils/gpo.h
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getConfiguredEnvironmentVariablesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
stefansjfw
1f936df3ebce73b726ed11c9fa38fd477b4b0fbd
812b343776b5f0cbda734182e4996571803c35d8
If https://github.com/microsoft/PowerToys/pull/28731 gets merged the way of implementing the utility policies changes a bit. Please be aware of this change.
htcfreek
450
microsoft/PowerToys
28,722
🚧 [new module] Environment variables editor
<!-- 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 Co-authored very much by @niels9001 Environment Variables app offers a nice and easy way to manage environment variables. Also, you can create a profile (set of environment variables) to apply multiple variables at once. Applying the profile adds variables to User env variables. On profile apply, If there is an existing variable with the same name in User variables, backup <var name>_PowerToys_<profile name> variable is created to be able to revert it on profile un-apply (and prevent possible issues causing lost variable values). The applied variables pane on the right shows the status of applied variables, taking in order which (duplicated or not) variables take precedence, i.e. Profile -> User -> System. TODO: [ ] Icon [ ] Settings and OOBE screenshots [ ] Docs PR ![image](https://github.com/microsoft/PowerToys/assets/57057282/20ac1e0a-0e5e-4e9c-82e5-b8edbeada091) ![image](https://github.com/microsoft/PowerToys/assets/57057282/088769e7-f5a3-43c5-87fd-c7c19f329e38) ![image](https://github.com/microsoft/PowerToys/assets/57057282/436b6744-14d4-45e4-b468-5d4ec3931e66) ![image](https://github.com/microsoft/PowerToys/assets/57057282/937cf656-9298-49b6-8f1c-ba52f147920d) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #16424 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [x] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [x] [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
null
2023-09-22 21:42:08+00:00
2023-10-20 14:28:08+00:00
src/common/utils/gpo.h
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getConfiguredEnvironmentVariablesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
stefansjfw
1f936df3ebce73b726ed11c9fa38fd477b4b0fbd
812b343776b5f0cbda734182e4996571803c35d8
PR is merged. Please update your new code.
htcfreek
451
microsoft/PowerToys
28,722
🚧 [new module] Environment variables editor
<!-- 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 Co-authored very much by @niels9001 Environment Variables app offers a nice and easy way to manage environment variables. Also, you can create a profile (set of environment variables) to apply multiple variables at once. Applying the profile adds variables to User env variables. On profile apply, If there is an existing variable with the same name in User variables, backup <var name>_PowerToys_<profile name> variable is created to be able to revert it on profile un-apply (and prevent possible issues causing lost variable values). The applied variables pane on the right shows the status of applied variables, taking in order which (duplicated or not) variables take precedence, i.e. Profile -> User -> System. TODO: [ ] Icon [ ] Settings and OOBE screenshots [ ] Docs PR ![image](https://github.com/microsoft/PowerToys/assets/57057282/20ac1e0a-0e5e-4e9c-82e5-b8edbeada091) ![image](https://github.com/microsoft/PowerToys/assets/57057282/088769e7-f5a3-43c5-87fd-c7c19f329e38) ![image](https://github.com/microsoft/PowerToys/assets/57057282/436b6744-14d4-45e4-b468-5d4ec3931e66) ![image](https://github.com/microsoft/PowerToys/assets/57057282/937cf656-9298-49b6-8f1c-ba52f147920d) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #16424 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [x] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [x] [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
null
2023-09-22 21:42:08+00:00
2023-10-20 14:28:08+00:00
src/common/utils/gpo.h
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getConfiguredEnvironmentVariablesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
stefansjfw
1f936df3ebce73b726ed11c9fa38fd477b4b0fbd
812b343776b5f0cbda734182e4996571803c35d8
thanks. I'll update it
stefansjfw
452
microsoft/PowerToys
28,722
🚧 [new module] Environment variables editor
<!-- 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 Co-authored very much by @niels9001 Environment Variables app offers a nice and easy way to manage environment variables. Also, you can create a profile (set of environment variables) to apply multiple variables at once. Applying the profile adds variables to User env variables. On profile apply, If there is an existing variable with the same name in User variables, backup <var name>_PowerToys_<profile name> variable is created to be able to revert it on profile un-apply (and prevent possible issues causing lost variable values). The applied variables pane on the right shows the status of applied variables, taking in order which (duplicated or not) variables take precedence, i.e. Profile -> User -> System. TODO: [ ] Icon [ ] Settings and OOBE screenshots [ ] Docs PR ![image](https://github.com/microsoft/PowerToys/assets/57057282/20ac1e0a-0e5e-4e9c-82e5-b8edbeada091) ![image](https://github.com/microsoft/PowerToys/assets/57057282/088769e7-f5a3-43c5-87fd-c7c19f329e38) ![image](https://github.com/microsoft/PowerToys/assets/57057282/436b6744-14d4-45e4-b468-5d4ec3931e66) ![image](https://github.com/microsoft/PowerToys/assets/57057282/937cf656-9298-49b6-8f1c-ba52f147920d) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #16424 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [x] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [x] [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
null
2023-09-22 21:42:08+00:00
2023-10-20 14:28:08+00:00
src/common/utils/gpo.h
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
#pragma once #include <Windows.h> #include <optional> namespace powertoys_gpo { enum gpo_rule_configured_t { gpo_rule_configured_wrong_value = -3, // The policy is set to an unrecognized value gpo_rule_configured_unavailable = -2, // Couldn't access registry gpo_rule_configured_not_configured = -1, // Policy is not configured gpo_rule_configured_disabled = 0, // Policy is disabled gpo_rule_configured_enabled = 1, // Policy is enabled }; // Registry path where gpo policy values are stored. const std::wstring POLICIES_PATH = L"SOFTWARE\\Policies\\PowerToys"; const std::wstring POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH = POLICIES_PATH + L"\\PowerLauncherIndividualPluginEnabledList"; // Registry scope where gpo policy values are stored. const HKEY POLICIES_SCOPE_MACHINE = HKEY_LOCAL_MACHINE; const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER; // The registry value names for PowerToys utilities enabled and disabled policies. const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState"; const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop"; const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake"; const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker"; const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock"; const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones"; const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMarkdownPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW = L"ConfigureEnabledUtilityFileExplorerMonacoPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPDFPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW = L"ConfigureEnabledUtilityFileExplorerGcodePreview"; const std::wstring POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSVGThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerPDFThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerGcodeThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerSTLThumbnails"; const std::wstring POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR = L"ConfigureEnabledUtilityHostsFileEditor"; const std::wstring POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER = L"ConfigureEnabledUtilityImageResizer"; const std::wstring POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER = L"ConfigureEnabledUtilityKeyboardManager"; const std::wstring POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE = L"ConfigureEnabledUtilityFindMyMouse"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER = L"ConfigureEnabledUtilityMouseHighlighter"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_JUMP = L"ConfigureEnabledUtilityMouseJump"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS = L"ConfigureEnabledUtilityMousePointerCrosshairs"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_RENAME = L"ConfigureEnabledUtilityPowerRename"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER = L"ConfigureEnabledUtilityPowerLauncher"; const std::wstring POLICY_CONFIGURE_ENABLED_QUICK_ACCENT = L"ConfigureEnabledUtilityQuickAccent"; const std::wstring POLICY_CONFIGURE_ENABLED_SCREEN_RULER = L"ConfigureEnabledUtilityScreenRuler"; const std::wstring POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE = L"ConfigureEnabledUtilityShortcutGuide"; const std::wstring POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR = L"ConfigureEnabledUtilityTextExtractor"; const std::wstring POLICY_CONFIGURE_ENABLED_PASTE_PLAIN = L"ConfigureEnabledUtilityPastePlain"; const std::wstring POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE = L"ConfigureEnabledUtilityVideoConferenceMute"; const std::wstring POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW = L"ConfigureEnabledUtilityRegistryPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS = L"ConfigureEnabledUtilityMouseWithoutBorders"; const std::wstring POLICY_CONFIGURE_ENABLED_PEEK = L"ConfigureEnabledUtilityPeek"; const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; const std::wstring POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD = L"AutomaticUpdateDownloadDisabled"; const std::wstring POLICY_SUSPEND_NEW_UPDATE_TOAST = L"SuspendNewUpdateAvailableToast"; const std::wstring POLICY_DISABLE_PERIODIC_UPDATE_CHECK = L"PeriodicUpdateCheckDisabled"; // The registry value names for other PowerToys policies. const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation"; const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState"; inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name) { DWORD reg_value_type = REG_SZ; DWORD reg_flags = RRF_RT_REG_SZ; DWORD string_buffer_capacity; // Request required buffer capacity / string length if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, NULL, &string_buffer_capacity) != ERROR_SUCCESS) { return std::nullopt; } else if (string_buffer_capacity == 0) { return std::nullopt; } // RegGetValueW overshoots sometimes. Use a buffer first to not have characters past the string end. wchar_t* temp_buffer = new wchar_t[string_buffer_capacity / sizeof(wchar_t) + 1]; // Read string if (RegGetValueW(hRootKey, subKey.c_str(), value_name.c_str(), reg_flags, &reg_value_type, temp_buffer, &string_buffer_capacity) != ERROR_SUCCESS) { delete temp_buffer; return std::nullopt; } // Convert buffer to std::wstring, delete buffer and return REG_SZ value std::wstring string_value = temp_buffer; delete temp_buffer; return string_value; } inline gpo_rule_configured_t getConfiguredValue(const std::wstring& registry_value_name) { HKEY key{}; DWORD value = 0xFFFFFFFE; DWORD valueSize = sizeof(value); bool machine_key_found = true; if (auto res = RegOpenKeyExW(POLICIES_SCOPE_MACHINE, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { machine_key_found = false; } if(machine_key_found) { // If the path was found in the machine, we need to check if the value for the policy exists. auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { // Value not found on the path. machine_key_found=false; } } if (!machine_key_found) { // If there's no value found on the machine scope, try to get it from the user scope. if (auto res = RegOpenKeyExW(POLICIES_SCOPE_USER, POLICIES_PATH.c_str(), 0, KEY_READ, &key); res != ERROR_SUCCESS) { if (res == ERROR_FILE_NOT_FOUND) { return gpo_rule_configured_not_configured; } return gpo_rule_configured_unavailable; } auto res = RegQueryValueExW(key, registry_value_name.c_str(), nullptr, nullptr, reinterpret_cast<LPBYTE>(&value), &valueSize); RegCloseKey(key); if (res != ERROR_SUCCESS) { return gpo_rule_configured_not_configured; } } switch (value) { case 0: return gpo_rule_configured_disabled; case 1: return gpo_rule_configured_enabled; default: return gpo_rule_configured_wrong_value; } } inline std::optional<std::wstring> getPolicyListValue(const std::wstring& registry_list_path, const std::wstring& registry_list_value_name) { // This function returns the value of an entry of an policy list. The user scope is only checked, if the list is not enabled for the machine to not mix the lists. HKEY key{}; // Try to read from the machine list. bool machine_list_found = false; if (RegOpenKeyExW(POLICIES_SCOPE_MACHINE, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { machine_list_found = true; RegCloseKey(key); // If the path exists in the machine registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_MACHINE, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the machine list. return *regValueData; } } // If no list exists for machine, we try to read from the user list. if (!machine_list_found) { if (RegOpenKeyExW(POLICIES_SCOPE_USER, registry_list_path.c_str(), 0, KEY_READ, &key) == ERROR_SUCCESS) { RegCloseKey(key); // If the path exists in the user registry, we try to read the value. auto regValueData = readRegistryStringValue(POLICIES_SCOPE_USER, registry_list_path, registry_list_value_name); if (regValueData.has_value()) { // Return the value from the user list. return *regValueData; } } } // No list exists for machine and user, or no value was found in the list, or an error ocurred while reading the value. return std::nullopt; } inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name) { auto individual_value = getConfiguredValue(utility_name); if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled) { return individual_value; } else { return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); } } inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); } inline gpo_rule_configured_t getConfiguredAwakeEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE); } inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER); } inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK); } inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES); } inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH); } inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR); } inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER); } inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER); } inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE); } inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER); } inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP); } inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS); } inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME); } inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER); } inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT); } inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER); } inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE); } inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR); } inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN); } inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE); } inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS); } inline gpo_rule_configured_t getConfiguredPeekEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK); } inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW); } inline gpo_rule_configured_t getConfiguredEnvironmentVariablesEnabledValue() { return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES); } inline gpo_rule_configured_t getDisablePerUserInstallationValue() { return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); } inline gpo_rule_configured_t getDisableAutomaticUpdateDownloadValue() { return getConfiguredValue(POLICY_DISABLE_AUTOMATIC_UPDATE_DOWNLOAD); } inline gpo_rule_configured_t getSuspendNewUpdateToastValue() { return getConfiguredValue(POLICY_SUSPEND_NEW_UPDATE_TOAST); } inline gpo_rule_configured_t getDisablePeriodicUpdateCheckValue() { return getConfiguredValue(POLICY_DISABLE_PERIODIC_UPDATE_CHECK); } inline gpo_rule_configured_t getAllowExperimentationValue() { return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION); } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry return gpo_rule_configured_not_configured; } std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") { // force disabled return gpo_rule_configured_disabled; } else if (*individual_plugin_setting == L"1") { // force enabled return gpo_rule_configured_enabled; } else if (*individual_plugin_setting == L"2") { // user takes control return gpo_rule_configured_not_configured; } else { return gpo_rule_configured_wrong_value; } } else { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); } } }
stefansjfw
1f936df3ebce73b726ed11c9fa38fd477b4b0fbd
812b343776b5f0cbda734182e4996571803c35d8
done
stefansjfw
453
microsoft/PowerToys
28,690
[Peek] Add support for preview handlers
<!-- 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 PR adds support for [preview handlers](https://learn.microsoft.com/en-us/windows/win32/shell/preview-handlers) that displays previews from supported applications like Microsoft Office (assuming the user has it installed). This should also help with: - #26422 as these previewers uses a standard API ([`IPreviewHandler`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ipreviewhandler)) that's built into Windows and gets hosted by file managers like File Explorer and [Everything](https://www.voidtools.com/support/everything/). - #26726 as File Explorer plans to move away from its preview pane. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** https://github.com/microsoft/PowerToys/issues/26210 - [X] **Communication:** I've discussed this with core contributors already - [X] **Tests:** No tests exist - [X] **Localization:** No changes made - [X] **Dev docs:** No changes needed - [X] **New binaries:** No changes made - [X] **Documentation updated:** https://github.com/MicrosoftDocs/windows-dev-docs/pull/4635 <!-- 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 ### Word ![image](https://github.com/microsoft/PowerToys/assets/3975545/4e525fa4-a65a-40bd-9633-7e4591a9fd33) ### Excel ![image](https://github.com/microsoft/PowerToys/assets/3975545/343bc2d6-d6f7-4565-8271-52e8aa38aed1) ### PowerPoint ![image](https://github.com/microsoft/PowerToys/assets/3975545/feca4750-090a-434e-8773-c127177b00bd) ### Visio ![image](https://github.com/microsoft/PowerToys/assets/3975545/09b169af-759c-4bb2-96e7-6b056f5be64b) ### Fonts ![image](https://github.com/microsoft/PowerToys/assets/3975545/52bd8261-cb7a-4a02-b874-76f568d38d32)
null
2023-09-21 19:35:33+00:00
2023-10-10 14:51:37+00:00
src/modules/peek/Peek.FilePreviewer/FilePreview.xaml
<!-- Copyright (c) Microsoft Corporation and Contributors. --> <!-- Licensed under the MIT License. --> <UserControl x:Class="Peek.FilePreviewer.FilePreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Peek.FilePreviewer.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Peek.FilePreviewer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:previewers="using:Peek.FilePreviewer.Previewers" mc:Ignorable="d"> <Grid> <ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" /> <Image x:Name="ImagePreview" MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}" MaxHeight="{x:Bind ImagePreviewer.MaxImageSize.Height, Mode=OneWay}" Source="{x:Bind ImagePreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ImagePreviewer, Previewer.State), Mode=OneWay}" /> <MediaPlayerElement x:Name="VideoPreview" AreTransportControlsEnabled="True" AutoPlay="True" Source="{x:Bind VideoPreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(VideoPreviewer, Previewer.State), Mode=OneWay}"> <MediaPlayerElement.TransportControls> <MediaTransportControls x:Name="mediaTransport" Width="auto" MaxWidth="420" IsCompact="True" /> </MediaPlayerElement.TransportControls> </MediaPlayerElement> <controls:BrowserControl x:Name="BrowserPreview" x:Load="True" DOMContentLoaded="BrowserPreview_DOMContentLoaded" IsDevFilePreview="{x:Bind BrowserPreviewer.IsDevFilePreview, Mode=OneWay}" NavigationCompleted="PreviewBrowser_NavigationCompleted" Source="{x:Bind BrowserPreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(BrowserPreviewer, Previewer.State), Mode=OneWay, FallbackValue=Collapsed}" /> <controls:ArchiveControl x:Name="ArchivePreview" DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}" FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}" LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}" Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}" Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" /> <controls:UnsupportedFilePreview x:Name="UnsupportedFilePreview" LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}" Source="{x:Bind UnsupportedFilePreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsUnsupportedPreviewVisible(UnsupportedFilePreviewer, Previewer.State), Mode=OneWay}" /> </Grid> <UserControl.KeyboardAccelerators> <KeyboardAccelerator Key="C" Invoked="KeyboardAccelerator_CtrlC_Invoked" Modifiers="Control" /> </UserControl.KeyboardAccelerators> </UserControl>
<!-- Copyright (c) Microsoft Corporation and Contributors. --> <!-- Licensed under the MIT License. --> <UserControl x:Class="Peek.FilePreviewer.FilePreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Peek.FilePreviewer.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Peek.FilePreviewer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:previewers="using:Peek.FilePreviewer.Previewers" mc:Ignorable="d"> <Grid> <ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" /> <controls:ShellPreviewHandlerControl x:Name="ShellPreviewHandlerPreview" Source="{x:Bind ShellPreviewHandlerPreviewer.Preview, Mode=OneWay}" HandlerVisibility="{x:Bind IsPreviewVisible(ShellPreviewHandlerPreviewer, Previewer.State), Mode=OneWay}" HandlerLoaded="ShellPreviewHandlerPreview_HandlerLoaded" HandlerError="ShellPreviewHandlerPreview_HandlerError" /> <Image x:Name="ImagePreview" MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}" MaxHeight="{x:Bind ImagePreviewer.MaxImageSize.Height, Mode=OneWay}" Source="{x:Bind ImagePreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ImagePreviewer, Previewer.State), Mode=OneWay}" /> <MediaPlayerElement x:Name="VideoPreview" AreTransportControlsEnabled="True" AutoPlay="True" Source="{x:Bind VideoPreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(VideoPreviewer, Previewer.State), Mode=OneWay}"> <MediaPlayerElement.TransportControls> <MediaTransportControls x:Name="mediaTransport" Width="auto" MaxWidth="420" IsCompact="True" /> </MediaPlayerElement.TransportControls> </MediaPlayerElement> <controls:BrowserControl x:Name="BrowserPreview" x:Load="True" DOMContentLoaded="BrowserPreview_DOMContentLoaded" IsDevFilePreview="{x:Bind BrowserPreviewer.IsDevFilePreview, Mode=OneWay}" NavigationCompleted="PreviewBrowser_NavigationCompleted" Source="{x:Bind BrowserPreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(BrowserPreviewer, Previewer.State), Mode=OneWay, FallbackValue=Collapsed}" /> <controls:ArchiveControl x:Name="ArchivePreview" DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}" FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}" LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}" Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}" Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" /> <controls:UnsupportedFilePreview x:Name="UnsupportedFilePreview" LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}" Source="{x:Bind UnsupportedFilePreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsUnsupportedPreviewVisible(UnsupportedFilePreviewer, Previewer.State), Mode=OneWay}" /> </Grid> <UserControl.KeyboardAccelerators> <KeyboardAccelerator Key="C" Invoked="KeyboardAccelerator_CtrlC_Invoked" Modifiers="Control" /> </UserControl.KeyboardAccelerators> </UserControl>
dillydylann
e1a2d18d5d424819af499ab2ea878cf7dce5fc62
e1944df89af4576d2bf383e7772091beccf47702
Is it always visible? Should it have a toggle for visibility?
SamChaps
454
microsoft/PowerToys
28,690
[Peek] Add support for preview handlers
<!-- 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 PR adds support for [preview handlers](https://learn.microsoft.com/en-us/windows/win32/shell/preview-handlers) that displays previews from supported applications like Microsoft Office (assuming the user has it installed). This should also help with: - #26422 as these previewers uses a standard API ([`IPreviewHandler`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ipreviewhandler)) that's built into Windows and gets hosted by file managers like File Explorer and [Everything](https://www.voidtools.com/support/everything/). - #26726 as File Explorer plans to move away from its preview pane. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** https://github.com/microsoft/PowerToys/issues/26210 - [X] **Communication:** I've discussed this with core contributors already - [X] **Tests:** No tests exist - [X] **Localization:** No changes made - [X] **Dev docs:** No changes needed - [X] **New binaries:** No changes made - [X] **Documentation updated:** https://github.com/MicrosoftDocs/windows-dev-docs/pull/4635 <!-- 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 ### Word ![image](https://github.com/microsoft/PowerToys/assets/3975545/4e525fa4-a65a-40bd-9633-7e4591a9fd33) ### Excel ![image](https://github.com/microsoft/PowerToys/assets/3975545/343bc2d6-d6f7-4565-8271-52e8aa38aed1) ### PowerPoint ![image](https://github.com/microsoft/PowerToys/assets/3975545/feca4750-090a-434e-8773-c127177b00bd) ### Visio ![image](https://github.com/microsoft/PowerToys/assets/3975545/09b169af-759c-4bb2-96e7-6b056f5be64b) ### Fonts ![image](https://github.com/microsoft/PowerToys/assets/3975545/52bd8261-cb7a-4a02-b874-76f568d38d32)
null
2023-09-21 19:35:33+00:00
2023-10-10 14:51:37+00:00
src/modules/peek/Peek.FilePreviewer/FilePreview.xaml
<!-- Copyright (c) Microsoft Corporation and Contributors. --> <!-- Licensed under the MIT License. --> <UserControl x:Class="Peek.FilePreviewer.FilePreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Peek.FilePreviewer.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Peek.FilePreviewer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:previewers="using:Peek.FilePreviewer.Previewers" mc:Ignorable="d"> <Grid> <ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" /> <Image x:Name="ImagePreview" MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}" MaxHeight="{x:Bind ImagePreviewer.MaxImageSize.Height, Mode=OneWay}" Source="{x:Bind ImagePreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ImagePreviewer, Previewer.State), Mode=OneWay}" /> <MediaPlayerElement x:Name="VideoPreview" AreTransportControlsEnabled="True" AutoPlay="True" Source="{x:Bind VideoPreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(VideoPreviewer, Previewer.State), Mode=OneWay}"> <MediaPlayerElement.TransportControls> <MediaTransportControls x:Name="mediaTransport" Width="auto" MaxWidth="420" IsCompact="True" /> </MediaPlayerElement.TransportControls> </MediaPlayerElement> <controls:BrowserControl x:Name="BrowserPreview" x:Load="True" DOMContentLoaded="BrowserPreview_DOMContentLoaded" IsDevFilePreview="{x:Bind BrowserPreviewer.IsDevFilePreview, Mode=OneWay}" NavigationCompleted="PreviewBrowser_NavigationCompleted" Source="{x:Bind BrowserPreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(BrowserPreviewer, Previewer.State), Mode=OneWay, FallbackValue=Collapsed}" /> <controls:ArchiveControl x:Name="ArchivePreview" DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}" FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}" LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}" Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}" Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" /> <controls:UnsupportedFilePreview x:Name="UnsupportedFilePreview" LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}" Source="{x:Bind UnsupportedFilePreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsUnsupportedPreviewVisible(UnsupportedFilePreviewer, Previewer.State), Mode=OneWay}" /> </Grid> <UserControl.KeyboardAccelerators> <KeyboardAccelerator Key="C" Invoked="KeyboardAccelerator_CtrlC_Invoked" Modifiers="Control" /> </UserControl.KeyboardAccelerators> </UserControl>
<!-- Copyright (c) Microsoft Corporation and Contributors. --> <!-- Licensed under the MIT License. --> <UserControl x:Class="Peek.FilePreviewer.FilePreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Peek.FilePreviewer.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Peek.FilePreviewer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:previewers="using:Peek.FilePreviewer.Previewers" mc:Ignorable="d"> <Grid> <ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" /> <controls:ShellPreviewHandlerControl x:Name="ShellPreviewHandlerPreview" Source="{x:Bind ShellPreviewHandlerPreviewer.Preview, Mode=OneWay}" HandlerVisibility="{x:Bind IsPreviewVisible(ShellPreviewHandlerPreviewer, Previewer.State), Mode=OneWay}" HandlerLoaded="ShellPreviewHandlerPreview_HandlerLoaded" HandlerError="ShellPreviewHandlerPreview_HandlerError" /> <Image x:Name="ImagePreview" MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}" MaxHeight="{x:Bind ImagePreviewer.MaxImageSize.Height, Mode=OneWay}" Source="{x:Bind ImagePreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ImagePreviewer, Previewer.State), Mode=OneWay}" /> <MediaPlayerElement x:Name="VideoPreview" AreTransportControlsEnabled="True" AutoPlay="True" Source="{x:Bind VideoPreviewer.Preview, Mode=OneWay}" ToolTipService.ToolTip="{x:Bind ImageInfoTooltip, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(VideoPreviewer, Previewer.State), Mode=OneWay}"> <MediaPlayerElement.TransportControls> <MediaTransportControls x:Name="mediaTransport" Width="auto" MaxWidth="420" IsCompact="True" /> </MediaPlayerElement.TransportControls> </MediaPlayerElement> <controls:BrowserControl x:Name="BrowserPreview" x:Load="True" DOMContentLoaded="BrowserPreview_DOMContentLoaded" IsDevFilePreview="{x:Bind BrowserPreviewer.IsDevFilePreview, Mode=OneWay}" NavigationCompleted="PreviewBrowser_NavigationCompleted" Source="{x:Bind BrowserPreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(BrowserPreviewer, Previewer.State), Mode=OneWay, FallbackValue=Collapsed}" /> <controls:ArchiveControl x:Name="ArchivePreview" DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}" FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}" LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}" Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}" Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}" Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" /> <controls:UnsupportedFilePreview x:Name="UnsupportedFilePreview" LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}" Source="{x:Bind UnsupportedFilePreviewer.Preview, Mode=OneWay}" Visibility="{x:Bind IsUnsupportedPreviewVisible(UnsupportedFilePreviewer, Previewer.State), Mode=OneWay}" /> </Grid> <UserControl.KeyboardAccelerators> <KeyboardAccelerator Key="C" Invoked="KeyboardAccelerator_CtrlC_Invoked" Modifiers="Control" /> </UserControl.KeyboardAccelerators> </UserControl>
dillydylann
e1a2d18d5d424819af499ab2ea878cf7dce5fc62
e1944df89af4576d2bf383e7772091beccf47702
It has its own way of handling visibility so resize events would work, but I could add another visibility property for consistency.
dillydylann
455
microsoft/PowerToys
28,688
[FancyZones] Fix moved to the current active monitor when maximized
<!-- 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 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #29209 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 - Fix moved to the current active monitor when maximized not keep maximized <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Enable `Move newly created windows to the current active monitor` > Maximized window > Create new window on other monitor > New window should maximized
null
2023-09-21 18:53:00+00:00
2023-12-18 16:04:47+00:00
src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp
#include "pch.h" #include "MonitorUtils.h" #include <WbemCli.h> #include <comutil.h> #include <FancyZonesLib/WindowUtils.h> #include <FancyZonesLib/util.h> #include <common/logger/logger.h> #include <common/utils/winapi_error.h> namespace MonitorUtils { constexpr int CUSTOM_POSITIONING_LEFT_TOP_PADDING = 16; namespace WMI { FancyZonesDataTypes::DeviceId SplitWMIDeviceId(const std::wstring& str) noexcept { // format: DISPLAY\{device id}\{instance id} // example: DISPLAY\GSM0001\4&125707d6&0&UID28741_0 // output: { GSM0001, 4&125707d6&0&UID28741 } size_t nameStartPos = str.find_first_of('\\'); size_t uidStartPos = str.find_last_of('\\'); size_t uidEndPos = str.find_last_of('_'); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { .id = str }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } std::wstring GetWMIProp(IWbemClassObject* wbemClassObj, std::wstring_view prop) { if (!wbemClassObj) { return {}; } VARIANT vtProp{}; // Get the value of the Name property auto hres = wbemClassObj->Get(prop.data(), 0, &vtProp, 0, 0); if (FAILED(hres)) { Logger::error(L"Get {} Error code = {} ", prop, get_last_error_or_default(hres)); return {}; } std::wstring result{}; switch (vtProp.vt) { case VT_BSTR: //BSTR { result = vtProp.bstrVal; } break; case VT_ARRAY: // parray case 8195: // also parray { std::u32string str(static_cast<const char32_t*>(vtProp.parray->pvData)); std::wstring wstr; for (const char32_t& c : str) { wstr += (wchar_t)c; } result = wstr; } break; default: break; } VariantClear(&vtProp); return result; } std::vector<FancyZonesDataTypes::MonitorId> GetHardwareMonitorIds() { HRESULT hres; // Obtain the initial locator to Windows Management // on a particular host computer. IWbemLocator* pLocator = 0; hres = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, reinterpret_cast<LPVOID*>(&pLocator)); if (FAILED(hres)) { Logger::error(L"Failed to create IWbemLocator object. {}", get_last_error_or_default(hres)); return {}; } IWbemServices* pServices = 0; hres = pLocator->ConnectServer(_bstr_t(L"ROOT\\WMI"), NULL, NULL, 0, NULL, 0, 0, &pServices); if (FAILED(hres)) { Logger::error(L"Could not connect WMI server. {}", get_last_error_or_default(hres)); pLocator->Release(); return {}; } // Set the IWbemServices proxy so that impersonation // of the user (client) occurs. hres = CoSetProxyBlanket(pServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); if (FAILED(hres)) { Logger::error(L"Could not set proxy blanket. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } // Use the IWbemServices pointer to make requests of WMI. // Make requests here: IEnumWbemClassObject* pEnumerator = NULL; hres = pServices->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM WmiMonitorID"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(hres)) { Logger::error(L"Query for monitors failed. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } IWbemClassObject* pClassObject; ULONG uReturn = 0; std::vector<FancyZonesDataTypes::MonitorId> result{}; while (pEnumerator) { hres = pEnumerator->Next(WBEM_INFINITE, 1, &pClassObject, &uReturn); if (0 == uReturn) { break; } LPSAFEARRAY pFieldArray = NULL; hres = pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS, NULL, &pFieldArray); if (FAILED(hres)) { Logger::error(L"Failed to get field names. {}", get_last_error_or_default(hres)); break; } auto name = GetWMIProp(pClassObject, L"InstanceName"); FancyZonesDataTypes::MonitorId data{}; data.deviceId = SplitWMIDeviceId(name); data.serialNumber = GetWMIProp(pClassObject, L"SerialNumberID"); Logger::info(L"InstanceName: {}", name); Logger::info(L"Serial number: {}", data.serialNumber); result.emplace_back(std::move(data)); pClassObject->Release(); pClassObject = NULL; } pServices->Release(); pLocator->Release(); pEnumerator->Release(); return result; } } namespace Display { FancyZonesDataTypes::DeviceId SplitDisplayDeviceId(const std::wstring& str) noexcept { // format: \\?\DISPLAY#{device id}#{instance id}#{some other id} // example: \\?\DISPLAY#GSM1388#4&125707d6&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t nameStartPos = str.find_first_of('#'); size_t uidStartPos = str.find('#', nameStartPos + 1); size_t uidEndPos = str.find('#', uidStartPos + 1); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } FancyZonesDataTypes::DeviceId ConvertObsoleteDeviceId(const std::wstring& str) noexcept { // format: {device id}#{instance id} // example: GSM1388#4&125707d6&0&UID8388688 // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t dividerPos = str.find_first_of('#'); if (dividerPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(0, dividerPos), .instanceId = str.substr(dividerPos + 1) }; } constexpr inline bool not_digit(wchar_t ch) { return '0' <= ch && ch <= '9'; } std::wstring remove_non_digits(const std::wstring& input) { std::wstring result; std::copy_if(input.begin(), input.end(), std::back_inserter(result), not_digit); return result; } std::pair<bool, std::vector<FancyZonesDataTypes::MonitorId>> GetDisplays() { bool success = true; std::vector<FancyZonesDataTypes::MonitorId> result{}; auto allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); for (auto& monitorData : allMonitors) { auto monitorInfo = monitorData.second; DISPLAY_DEVICE displayDevice{ .cb = sizeof(displayDevice) }; FancyZonesDataTypes::MonitorId monitorId { .monitor = monitorData.first }; bool foundActiveMonitor = false; DWORD displayDeviceIndex = 0; while (EnumDisplayDevicesW(monitorInfo.szDevice, displayDeviceIndex, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME)) { Logger::info(L"Get display device for display {} : {}", monitorInfo.szDevice, displayDevice.DeviceID); if (WI_IsFlagSet(displayDevice.StateFlags, DISPLAY_DEVICE_ACTIVE) && WI_IsFlagClear(displayDevice.StateFlags, DISPLAY_DEVICE_MIRRORING_DRIVER)) { // Find display devices associated with the display. foundActiveMonitor = true; break; } displayDeviceIndex++; } if (foundActiveMonitor) { monitorId.deviceId = SplitDisplayDeviceId(displayDevice.DeviceID); try { std::wstring numberStr = displayDevice.DeviceName; // \\.\DISPLAY1\Monitor0 numberStr = numberStr.substr(0, numberStr.find_last_of('\\')); // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get monitor number from {}", displayDevice.DeviceName); monitorId.deviceId.number = 0; } } else { success = false; // Use the display name as a fallback value when no proper device was found. monitorId.deviceId.id = monitorInfo.szDevice; monitorId.deviceId.instanceId = L""; try { std::wstring numberStr = monitorInfo.szDevice; // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get display number from {}", monitorInfo.szDevice); monitorId.deviceId.number = 0; } } result.push_back(std::move(monitorId)); } return {success, result}; } } namespace { inline int RectWidth(const RECT& rect) { return rect.right - rect.left; } inline int RectHeight(const RECT& rect) { return rect.bottom - rect.top; } RECT FitOnScreen(const RECT& windowRect, const RECT& originMonitorRect, const RECT& destMonitorRect) { // New window position on active monitor. If window fits the screen, this will be final position. int left = destMonitorRect.left + (windowRect.left - originMonitorRect.left); int top = destMonitorRect.top + (windowRect.top - originMonitorRect.top); int W = RectWidth(windowRect); int H = RectHeight(windowRect); if ((left < destMonitorRect.left) || (left + W > destMonitorRect.right)) { // Set left window border to left border of screen (add padding). Resize window width if needed. left = destMonitorRect.left + CUSTOM_POSITIONING_LEFT_TOP_PADDING; W = min(W, RectWidth(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } if ((top < destMonitorRect.top) || (top + H > destMonitorRect.bottom)) { // Set top window border to top border of screen (add padding). Resize window height if needed. top = destMonitorRect.top + CUSTOM_POSITIONING_LEFT_TOP_PADDING; H = min(H, RectHeight(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } return { .left = left, .top = top, .right = left + W, .bottom = top + H }; } } void OpenWindowOnActiveMonitor(HWND window, HMONITOR monitor) noexcept { // By default Windows opens new window on primary monitor. // Try to preserve window width and height, adjust top-left corner if needed. HMONITOR origin = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); if (origin == monitor) { // Certain applications by design open in last known position, regardless of FancyZones. // If that position is on currently active monitor, skip custom positioning. return; } WINDOWPLACEMENT placement{}; if (GetWindowPlacement(window, &placement)) { MONITORINFOEX originMi; originMi.cbSize = sizeof(originMi); if (GetMonitorInfo(origin, &originMi)) { MONITORINFOEX destMi; destMi.cbSize = sizeof(destMi); if (GetMonitorInfo(monitor, &destMi)) { RECT newPosition = FitOnScreen(placement.rcNormalPosition, originMi.rcWork, destMi.rcWork); FancyZonesWindowUtils::SizeWindowToRect(window, newPosition); } } } } std::vector<FancyZonesDataTypes::MonitorId> IdentifyMonitors() noexcept { Logger::info(L"Identifying monitors"); auto displaysResult = Display::GetDisplays(); auto monitors = WMI::GetHardwareMonitorIds(); // retry int retryCounter = 0; while (!displaysResult.first && retryCounter < 100) { Logger::info("Retry display identification"); std::this_thread::sleep_for(std::chrono::milliseconds(30)); displaysResult = Display::GetDisplays(); retryCounter++; } for (const auto& monitor : monitors) { for (auto& display : displaysResult.second) { if (monitor.deviceId.id == display.deviceId.id) { display.serialNumber = monitor.serialNumber; } } } return displaysResult.second; } FancyZonesUtils::Rect GetWorkAreaRect(HMONITOR monitor) { if (monitor) { MONITORINFO mi{}; mi.cbSize = sizeof(mi); if (GetMonitorInfoW(monitor, &mi)) { return FancyZonesUtils::Rect(mi.rcWork); } } return FancyZonesUtils::Rect{}; } }
#include "pch.h" #include "MonitorUtils.h" #include <WbemCli.h> #include <comutil.h> #include <FancyZonesLib/WindowUtils.h> #include <FancyZonesLib/util.h> #include <common/logger/logger.h> #include <common/utils/winapi_error.h> namespace MonitorUtils { constexpr int CUSTOM_POSITIONING_LEFT_TOP_PADDING = 16; namespace WMI { FancyZonesDataTypes::DeviceId SplitWMIDeviceId(const std::wstring& str) noexcept { // format: DISPLAY\{device id}\{instance id} // example: DISPLAY\GSM0001\4&125707d6&0&UID28741_0 // output: { GSM0001, 4&125707d6&0&UID28741 } size_t nameStartPos = str.find_first_of('\\'); size_t uidStartPos = str.find_last_of('\\'); size_t uidEndPos = str.find_last_of('_'); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { .id = str }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } std::wstring GetWMIProp(IWbemClassObject* wbemClassObj, std::wstring_view prop) { if (!wbemClassObj) { return {}; } VARIANT vtProp{}; // Get the value of the Name property auto hres = wbemClassObj->Get(prop.data(), 0, &vtProp, 0, 0); if (FAILED(hres)) { Logger::error(L"Get {} Error code = {} ", prop, get_last_error_or_default(hres)); return {}; } std::wstring result{}; switch (vtProp.vt) { case VT_BSTR: //BSTR { result = vtProp.bstrVal; } break; case VT_ARRAY: // parray case 8195: // also parray { std::u32string str(static_cast<const char32_t*>(vtProp.parray->pvData)); std::wstring wstr; for (const char32_t& c : str) { wstr += (wchar_t)c; } result = wstr; } break; default: break; } VariantClear(&vtProp); return result; } std::vector<FancyZonesDataTypes::MonitorId> GetHardwareMonitorIds() { HRESULT hres; // Obtain the initial locator to Windows Management // on a particular host computer. IWbemLocator* pLocator = 0; hres = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, reinterpret_cast<LPVOID*>(&pLocator)); if (FAILED(hres)) { Logger::error(L"Failed to create IWbemLocator object. {}", get_last_error_or_default(hres)); return {}; } IWbemServices* pServices = 0; hres = pLocator->ConnectServer(_bstr_t(L"ROOT\\WMI"), NULL, NULL, 0, NULL, 0, 0, &pServices); if (FAILED(hres)) { Logger::error(L"Could not connect WMI server. {}", get_last_error_or_default(hres)); pLocator->Release(); return {}; } // Set the IWbemServices proxy so that impersonation // of the user (client) occurs. hres = CoSetProxyBlanket(pServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); if (FAILED(hres)) { Logger::error(L"Could not set proxy blanket. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } // Use the IWbemServices pointer to make requests of WMI. // Make requests here: IEnumWbemClassObject* pEnumerator = NULL; hres = pServices->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM WmiMonitorID"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(hres)) { Logger::error(L"Query for monitors failed. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } IWbemClassObject* pClassObject; ULONG uReturn = 0; std::vector<FancyZonesDataTypes::MonitorId> result{}; while (pEnumerator) { hres = pEnumerator->Next(WBEM_INFINITE, 1, &pClassObject, &uReturn); if (0 == uReturn) { break; } LPSAFEARRAY pFieldArray = NULL; hres = pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS, NULL, &pFieldArray); if (FAILED(hres)) { Logger::error(L"Failed to get field names. {}", get_last_error_or_default(hres)); break; } auto name = GetWMIProp(pClassObject, L"InstanceName"); FancyZonesDataTypes::MonitorId data{}; data.deviceId = SplitWMIDeviceId(name); data.serialNumber = GetWMIProp(pClassObject, L"SerialNumberID"); Logger::info(L"InstanceName: {}", name); Logger::info(L"Serial number: {}", data.serialNumber); result.emplace_back(std::move(data)); pClassObject->Release(); pClassObject = NULL; } pServices->Release(); pLocator->Release(); pEnumerator->Release(); return result; } } namespace Display { FancyZonesDataTypes::DeviceId SplitDisplayDeviceId(const std::wstring& str) noexcept { // format: \\?\DISPLAY#{device id}#{instance id}#{some other id} // example: \\?\DISPLAY#GSM1388#4&125707d6&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t nameStartPos = str.find_first_of('#'); size_t uidStartPos = str.find('#', nameStartPos + 1); size_t uidEndPos = str.find('#', uidStartPos + 1); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } FancyZonesDataTypes::DeviceId ConvertObsoleteDeviceId(const std::wstring& str) noexcept { // format: {device id}#{instance id} // example: GSM1388#4&125707d6&0&UID8388688 // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t dividerPos = str.find_first_of('#'); if (dividerPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(0, dividerPos), .instanceId = str.substr(dividerPos + 1) }; } constexpr inline bool not_digit(wchar_t ch) { return '0' <= ch && ch <= '9'; } std::wstring remove_non_digits(const std::wstring& input) { std::wstring result; std::copy_if(input.begin(), input.end(), std::back_inserter(result), not_digit); return result; } std::pair<bool, std::vector<FancyZonesDataTypes::MonitorId>> GetDisplays() { bool success = true; std::vector<FancyZonesDataTypes::MonitorId> result{}; auto allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); for (auto& monitorData : allMonitors) { auto monitorInfo = monitorData.second; DISPLAY_DEVICE displayDevice{ .cb = sizeof(displayDevice) }; FancyZonesDataTypes::MonitorId monitorId { .monitor = monitorData.first }; bool foundActiveMonitor = false; DWORD displayDeviceIndex = 0; while (EnumDisplayDevicesW(monitorInfo.szDevice, displayDeviceIndex, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME)) { Logger::info(L"Get display device for display {} : {}", monitorInfo.szDevice, displayDevice.DeviceID); if (WI_IsFlagSet(displayDevice.StateFlags, DISPLAY_DEVICE_ACTIVE) && WI_IsFlagClear(displayDevice.StateFlags, DISPLAY_DEVICE_MIRRORING_DRIVER)) { // Find display devices associated with the display. foundActiveMonitor = true; break; } displayDeviceIndex++; } if (foundActiveMonitor) { monitorId.deviceId = SplitDisplayDeviceId(displayDevice.DeviceID); try { std::wstring numberStr = displayDevice.DeviceName; // \\.\DISPLAY1\Monitor0 numberStr = numberStr.substr(0, numberStr.find_last_of('\\')); // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get monitor number from {}", displayDevice.DeviceName); monitorId.deviceId.number = 0; } } else { success = false; // Use the display name as a fallback value when no proper device was found. monitorId.deviceId.id = monitorInfo.szDevice; monitorId.deviceId.instanceId = L""; try { std::wstring numberStr = monitorInfo.szDevice; // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get display number from {}", monitorInfo.szDevice); monitorId.deviceId.number = 0; } } result.push_back(std::move(monitorId)); } return {success, result}; } } namespace { inline int RectWidth(const RECT& rect) { return rect.right - rect.left; } inline int RectHeight(const RECT& rect) { return rect.bottom - rect.top; } RECT FitOnScreen(const RECT& windowRect, const RECT& originMonitorRect, const RECT& destMonitorRect) { // New window position on active monitor. If window fits the screen, this will be final position. int left = destMonitorRect.left + (windowRect.left - originMonitorRect.left); int top = destMonitorRect.top + (windowRect.top - originMonitorRect.top); int W = RectWidth(windowRect); int H = RectHeight(windowRect); if ((left < destMonitorRect.left) || (left + W > destMonitorRect.right)) { // Set left window border to left border of screen (add padding). Resize window width if needed. left = destMonitorRect.left + CUSTOM_POSITIONING_LEFT_TOP_PADDING; W = min(W, RectWidth(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } if ((top < destMonitorRect.top) || (top + H > destMonitorRect.bottom)) { // Set top window border to top border of screen (add padding). Resize window height if needed. top = destMonitorRect.top + CUSTOM_POSITIONING_LEFT_TOP_PADDING; H = min(H, RectHeight(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } return { .left = left, .top = top, .right = left + W, .bottom = top + H }; } } void OpenWindowOnActiveMonitor(HWND window, HMONITOR monitor) noexcept { // By default Windows opens new window on primary monitor. // Try to preserve window width and height, adjust top-left corner if needed. HMONITOR origin = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); if (origin == monitor) { // Certain applications by design open in last known position, regardless of FancyZones. // If that position is on currently active monitor, skip custom positioning. return; } WINDOWPLACEMENT placement{}; if (GetWindowPlacement(window, &placement)) { MONITORINFOEX originMi; originMi.cbSize = sizeof(originMi); if (GetMonitorInfo(origin, &originMi)) { MONITORINFOEX destMi; destMi.cbSize = sizeof(destMi); if (GetMonitorInfo(monitor, &destMi)) { RECT newPosition = FitOnScreen(placement.rcNormalPosition, originMi.rcWork, destMi.rcWork); FancyZonesWindowUtils::SizeWindowToRect(window, newPosition, false); } } } } std::vector<FancyZonesDataTypes::MonitorId> IdentifyMonitors() noexcept { Logger::info(L"Identifying monitors"); auto displaysResult = Display::GetDisplays(); auto monitors = WMI::GetHardwareMonitorIds(); // retry int retryCounter = 0; while (!displaysResult.first && retryCounter < 100) { Logger::info("Retry display identification"); std::this_thread::sleep_for(std::chrono::milliseconds(30)); displaysResult = Display::GetDisplays(); retryCounter++; } for (const auto& monitor : monitors) { for (auto& display : displaysResult.second) { if (monitor.deviceId.id == display.deviceId.id) { display.serialNumber = monitor.serialNumber; } } } return displaysResult.second; } FancyZonesUtils::Rect GetWorkAreaRect(HMONITOR monitor) { if (monitor) { MONITORINFO mi{}; mi.cbSize = sizeof(mi); if (GetMonitorInfoW(monitor, &mi)) { return FancyZonesUtils::Rect(mi.rcWork); } } return FancyZonesUtils::Rect{}; } }
quyenvsp
4c3e5348f08b7ae7b8b8ba3af2dc9b61b9f27e78
3299ecfece9128cfd6791bacee1351b1c9a32c73
I don't see the need to change the window size. With this code, when you restore the window from a maximized state, it keeps its size equal to the work area size. But if we use just `rcNormalPosition,` it will return to the previous size when restored. So I think this change should be reverted.
SeraphimaZykova
456
microsoft/PowerToys
28,688
[FancyZones] Fix moved to the current active monitor when maximized
<!-- 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 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #29209 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 - Fix moved to the current active monitor when maximized not keep maximized <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Enable `Move newly created windows to the current active monitor` > Maximized window > Create new window on other monitor > New window should maximized
null
2023-09-21 18:53:00+00:00
2023-12-18 16:04:47+00:00
src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp
#include "pch.h" #include "MonitorUtils.h" #include <WbemCli.h> #include <comutil.h> #include <FancyZonesLib/WindowUtils.h> #include <FancyZonesLib/util.h> #include <common/logger/logger.h> #include <common/utils/winapi_error.h> namespace MonitorUtils { constexpr int CUSTOM_POSITIONING_LEFT_TOP_PADDING = 16; namespace WMI { FancyZonesDataTypes::DeviceId SplitWMIDeviceId(const std::wstring& str) noexcept { // format: DISPLAY\{device id}\{instance id} // example: DISPLAY\GSM0001\4&125707d6&0&UID28741_0 // output: { GSM0001, 4&125707d6&0&UID28741 } size_t nameStartPos = str.find_first_of('\\'); size_t uidStartPos = str.find_last_of('\\'); size_t uidEndPos = str.find_last_of('_'); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { .id = str }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } std::wstring GetWMIProp(IWbemClassObject* wbemClassObj, std::wstring_view prop) { if (!wbemClassObj) { return {}; } VARIANT vtProp{}; // Get the value of the Name property auto hres = wbemClassObj->Get(prop.data(), 0, &vtProp, 0, 0); if (FAILED(hres)) { Logger::error(L"Get {} Error code = {} ", prop, get_last_error_or_default(hres)); return {}; } std::wstring result{}; switch (vtProp.vt) { case VT_BSTR: //BSTR { result = vtProp.bstrVal; } break; case VT_ARRAY: // parray case 8195: // also parray { std::u32string str(static_cast<const char32_t*>(vtProp.parray->pvData)); std::wstring wstr; for (const char32_t& c : str) { wstr += (wchar_t)c; } result = wstr; } break; default: break; } VariantClear(&vtProp); return result; } std::vector<FancyZonesDataTypes::MonitorId> GetHardwareMonitorIds() { HRESULT hres; // Obtain the initial locator to Windows Management // on a particular host computer. IWbemLocator* pLocator = 0; hres = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, reinterpret_cast<LPVOID*>(&pLocator)); if (FAILED(hres)) { Logger::error(L"Failed to create IWbemLocator object. {}", get_last_error_or_default(hres)); return {}; } IWbemServices* pServices = 0; hres = pLocator->ConnectServer(_bstr_t(L"ROOT\\WMI"), NULL, NULL, 0, NULL, 0, 0, &pServices); if (FAILED(hres)) { Logger::error(L"Could not connect WMI server. {}", get_last_error_or_default(hres)); pLocator->Release(); return {}; } // Set the IWbemServices proxy so that impersonation // of the user (client) occurs. hres = CoSetProxyBlanket(pServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); if (FAILED(hres)) { Logger::error(L"Could not set proxy blanket. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } // Use the IWbemServices pointer to make requests of WMI. // Make requests here: IEnumWbemClassObject* pEnumerator = NULL; hres = pServices->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM WmiMonitorID"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(hres)) { Logger::error(L"Query for monitors failed. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } IWbemClassObject* pClassObject; ULONG uReturn = 0; std::vector<FancyZonesDataTypes::MonitorId> result{}; while (pEnumerator) { hres = pEnumerator->Next(WBEM_INFINITE, 1, &pClassObject, &uReturn); if (0 == uReturn) { break; } LPSAFEARRAY pFieldArray = NULL; hres = pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS, NULL, &pFieldArray); if (FAILED(hres)) { Logger::error(L"Failed to get field names. {}", get_last_error_or_default(hres)); break; } auto name = GetWMIProp(pClassObject, L"InstanceName"); FancyZonesDataTypes::MonitorId data{}; data.deviceId = SplitWMIDeviceId(name); data.serialNumber = GetWMIProp(pClassObject, L"SerialNumberID"); Logger::info(L"InstanceName: {}", name); Logger::info(L"Serial number: {}", data.serialNumber); result.emplace_back(std::move(data)); pClassObject->Release(); pClassObject = NULL; } pServices->Release(); pLocator->Release(); pEnumerator->Release(); return result; } } namespace Display { FancyZonesDataTypes::DeviceId SplitDisplayDeviceId(const std::wstring& str) noexcept { // format: \\?\DISPLAY#{device id}#{instance id}#{some other id} // example: \\?\DISPLAY#GSM1388#4&125707d6&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t nameStartPos = str.find_first_of('#'); size_t uidStartPos = str.find('#', nameStartPos + 1); size_t uidEndPos = str.find('#', uidStartPos + 1); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } FancyZonesDataTypes::DeviceId ConvertObsoleteDeviceId(const std::wstring& str) noexcept { // format: {device id}#{instance id} // example: GSM1388#4&125707d6&0&UID8388688 // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t dividerPos = str.find_first_of('#'); if (dividerPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(0, dividerPos), .instanceId = str.substr(dividerPos + 1) }; } constexpr inline bool not_digit(wchar_t ch) { return '0' <= ch && ch <= '9'; } std::wstring remove_non_digits(const std::wstring& input) { std::wstring result; std::copy_if(input.begin(), input.end(), std::back_inserter(result), not_digit); return result; } std::pair<bool, std::vector<FancyZonesDataTypes::MonitorId>> GetDisplays() { bool success = true; std::vector<FancyZonesDataTypes::MonitorId> result{}; auto allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); for (auto& monitorData : allMonitors) { auto monitorInfo = monitorData.second; DISPLAY_DEVICE displayDevice{ .cb = sizeof(displayDevice) }; FancyZonesDataTypes::MonitorId monitorId { .monitor = monitorData.first }; bool foundActiveMonitor = false; DWORD displayDeviceIndex = 0; while (EnumDisplayDevicesW(monitorInfo.szDevice, displayDeviceIndex, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME)) { Logger::info(L"Get display device for display {} : {}", monitorInfo.szDevice, displayDevice.DeviceID); if (WI_IsFlagSet(displayDevice.StateFlags, DISPLAY_DEVICE_ACTIVE) && WI_IsFlagClear(displayDevice.StateFlags, DISPLAY_DEVICE_MIRRORING_DRIVER)) { // Find display devices associated with the display. foundActiveMonitor = true; break; } displayDeviceIndex++; } if (foundActiveMonitor) { monitorId.deviceId = SplitDisplayDeviceId(displayDevice.DeviceID); try { std::wstring numberStr = displayDevice.DeviceName; // \\.\DISPLAY1\Monitor0 numberStr = numberStr.substr(0, numberStr.find_last_of('\\')); // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get monitor number from {}", displayDevice.DeviceName); monitorId.deviceId.number = 0; } } else { success = false; // Use the display name as a fallback value when no proper device was found. monitorId.deviceId.id = monitorInfo.szDevice; monitorId.deviceId.instanceId = L""; try { std::wstring numberStr = monitorInfo.szDevice; // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get display number from {}", monitorInfo.szDevice); monitorId.deviceId.number = 0; } } result.push_back(std::move(monitorId)); } return {success, result}; } } namespace { inline int RectWidth(const RECT& rect) { return rect.right - rect.left; } inline int RectHeight(const RECT& rect) { return rect.bottom - rect.top; } RECT FitOnScreen(const RECT& windowRect, const RECT& originMonitorRect, const RECT& destMonitorRect) { // New window position on active monitor. If window fits the screen, this will be final position. int left = destMonitorRect.left + (windowRect.left - originMonitorRect.left); int top = destMonitorRect.top + (windowRect.top - originMonitorRect.top); int W = RectWidth(windowRect); int H = RectHeight(windowRect); if ((left < destMonitorRect.left) || (left + W > destMonitorRect.right)) { // Set left window border to left border of screen (add padding). Resize window width if needed. left = destMonitorRect.left + CUSTOM_POSITIONING_LEFT_TOP_PADDING; W = min(W, RectWidth(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } if ((top < destMonitorRect.top) || (top + H > destMonitorRect.bottom)) { // Set top window border to top border of screen (add padding). Resize window height if needed. top = destMonitorRect.top + CUSTOM_POSITIONING_LEFT_TOP_PADDING; H = min(H, RectHeight(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } return { .left = left, .top = top, .right = left + W, .bottom = top + H }; } } void OpenWindowOnActiveMonitor(HWND window, HMONITOR monitor) noexcept { // By default Windows opens new window on primary monitor. // Try to preserve window width and height, adjust top-left corner if needed. HMONITOR origin = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); if (origin == monitor) { // Certain applications by design open in last known position, regardless of FancyZones. // If that position is on currently active monitor, skip custom positioning. return; } WINDOWPLACEMENT placement{}; if (GetWindowPlacement(window, &placement)) { MONITORINFOEX originMi; originMi.cbSize = sizeof(originMi); if (GetMonitorInfo(origin, &originMi)) { MONITORINFOEX destMi; destMi.cbSize = sizeof(destMi); if (GetMonitorInfo(monitor, &destMi)) { RECT newPosition = FitOnScreen(placement.rcNormalPosition, originMi.rcWork, destMi.rcWork); FancyZonesWindowUtils::SizeWindowToRect(window, newPosition); } } } } std::vector<FancyZonesDataTypes::MonitorId> IdentifyMonitors() noexcept { Logger::info(L"Identifying monitors"); auto displaysResult = Display::GetDisplays(); auto monitors = WMI::GetHardwareMonitorIds(); // retry int retryCounter = 0; while (!displaysResult.first && retryCounter < 100) { Logger::info("Retry display identification"); std::this_thread::sleep_for(std::chrono::milliseconds(30)); displaysResult = Display::GetDisplays(); retryCounter++; } for (const auto& monitor : monitors) { for (auto& display : displaysResult.second) { if (monitor.deviceId.id == display.deviceId.id) { display.serialNumber = monitor.serialNumber; } } } return displaysResult.second; } FancyZonesUtils::Rect GetWorkAreaRect(HMONITOR monitor) { if (monitor) { MONITORINFO mi{}; mi.cbSize = sizeof(mi); if (GetMonitorInfoW(monitor, &mi)) { return FancyZonesUtils::Rect(mi.rcWork); } } return FancyZonesUtils::Rect{}; } }
#include "pch.h" #include "MonitorUtils.h" #include <WbemCli.h> #include <comutil.h> #include <FancyZonesLib/WindowUtils.h> #include <FancyZonesLib/util.h> #include <common/logger/logger.h> #include <common/utils/winapi_error.h> namespace MonitorUtils { constexpr int CUSTOM_POSITIONING_LEFT_TOP_PADDING = 16; namespace WMI { FancyZonesDataTypes::DeviceId SplitWMIDeviceId(const std::wstring& str) noexcept { // format: DISPLAY\{device id}\{instance id} // example: DISPLAY\GSM0001\4&125707d6&0&UID28741_0 // output: { GSM0001, 4&125707d6&0&UID28741 } size_t nameStartPos = str.find_first_of('\\'); size_t uidStartPos = str.find_last_of('\\'); size_t uidEndPos = str.find_last_of('_'); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { .id = str }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } std::wstring GetWMIProp(IWbemClassObject* wbemClassObj, std::wstring_view prop) { if (!wbemClassObj) { return {}; } VARIANT vtProp{}; // Get the value of the Name property auto hres = wbemClassObj->Get(prop.data(), 0, &vtProp, 0, 0); if (FAILED(hres)) { Logger::error(L"Get {} Error code = {} ", prop, get_last_error_or_default(hres)); return {}; } std::wstring result{}; switch (vtProp.vt) { case VT_BSTR: //BSTR { result = vtProp.bstrVal; } break; case VT_ARRAY: // parray case 8195: // also parray { std::u32string str(static_cast<const char32_t*>(vtProp.parray->pvData)); std::wstring wstr; for (const char32_t& c : str) { wstr += (wchar_t)c; } result = wstr; } break; default: break; } VariantClear(&vtProp); return result; } std::vector<FancyZonesDataTypes::MonitorId> GetHardwareMonitorIds() { HRESULT hres; // Obtain the initial locator to Windows Management // on a particular host computer. IWbemLocator* pLocator = 0; hres = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, reinterpret_cast<LPVOID*>(&pLocator)); if (FAILED(hres)) { Logger::error(L"Failed to create IWbemLocator object. {}", get_last_error_or_default(hres)); return {}; } IWbemServices* pServices = 0; hres = pLocator->ConnectServer(_bstr_t(L"ROOT\\WMI"), NULL, NULL, 0, NULL, 0, 0, &pServices); if (FAILED(hres)) { Logger::error(L"Could not connect WMI server. {}", get_last_error_or_default(hres)); pLocator->Release(); return {}; } // Set the IWbemServices proxy so that impersonation // of the user (client) occurs. hres = CoSetProxyBlanket(pServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); if (FAILED(hres)) { Logger::error(L"Could not set proxy blanket. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } // Use the IWbemServices pointer to make requests of WMI. // Make requests here: IEnumWbemClassObject* pEnumerator = NULL; hres = pServices->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM WmiMonitorID"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(hres)) { Logger::error(L"Query for monitors failed. {}", get_last_error_or_default(hres)); pServices->Release(); pLocator->Release(); return {}; } IWbemClassObject* pClassObject; ULONG uReturn = 0; std::vector<FancyZonesDataTypes::MonitorId> result{}; while (pEnumerator) { hres = pEnumerator->Next(WBEM_INFINITE, 1, &pClassObject, &uReturn); if (0 == uReturn) { break; } LPSAFEARRAY pFieldArray = NULL; hres = pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS, NULL, &pFieldArray); if (FAILED(hres)) { Logger::error(L"Failed to get field names. {}", get_last_error_or_default(hres)); break; } auto name = GetWMIProp(pClassObject, L"InstanceName"); FancyZonesDataTypes::MonitorId data{}; data.deviceId = SplitWMIDeviceId(name); data.serialNumber = GetWMIProp(pClassObject, L"SerialNumberID"); Logger::info(L"InstanceName: {}", name); Logger::info(L"Serial number: {}", data.serialNumber); result.emplace_back(std::move(data)); pClassObject->Release(); pClassObject = NULL; } pServices->Release(); pLocator->Release(); pEnumerator->Release(); return result; } } namespace Display { FancyZonesDataTypes::DeviceId SplitDisplayDeviceId(const std::wstring& str) noexcept { // format: \\?\DISPLAY#{device id}#{instance id}#{some other id} // example: \\?\DISPLAY#GSM1388#4&125707d6&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t nameStartPos = str.find_first_of('#'); size_t uidStartPos = str.find('#', nameStartPos + 1); size_t uidEndPos = str.find('#', uidStartPos + 1); if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), .instanceId = str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) }; } FancyZonesDataTypes::DeviceId ConvertObsoleteDeviceId(const std::wstring& str) noexcept { // format: {device id}#{instance id} // example: GSM1388#4&125707d6&0&UID8388688 // output: { GSM1388, 4&125707d6&0&UID8388688 } size_t dividerPos = str.find_first_of('#'); if (dividerPos == std::string::npos) { return { str, L"" }; } return { .id = str.substr(0, dividerPos), .instanceId = str.substr(dividerPos + 1) }; } constexpr inline bool not_digit(wchar_t ch) { return '0' <= ch && ch <= '9'; } std::wstring remove_non_digits(const std::wstring& input) { std::wstring result; std::copy_if(input.begin(), input.end(), std::back_inserter(result), not_digit); return result; } std::pair<bool, std::vector<FancyZonesDataTypes::MonitorId>> GetDisplays() { bool success = true; std::vector<FancyZonesDataTypes::MonitorId> result{}; auto allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); for (auto& monitorData : allMonitors) { auto monitorInfo = monitorData.second; DISPLAY_DEVICE displayDevice{ .cb = sizeof(displayDevice) }; FancyZonesDataTypes::MonitorId monitorId { .monitor = monitorData.first }; bool foundActiveMonitor = false; DWORD displayDeviceIndex = 0; while (EnumDisplayDevicesW(monitorInfo.szDevice, displayDeviceIndex, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME)) { Logger::info(L"Get display device for display {} : {}", monitorInfo.szDevice, displayDevice.DeviceID); if (WI_IsFlagSet(displayDevice.StateFlags, DISPLAY_DEVICE_ACTIVE) && WI_IsFlagClear(displayDevice.StateFlags, DISPLAY_DEVICE_MIRRORING_DRIVER)) { // Find display devices associated with the display. foundActiveMonitor = true; break; } displayDeviceIndex++; } if (foundActiveMonitor) { monitorId.deviceId = SplitDisplayDeviceId(displayDevice.DeviceID); try { std::wstring numberStr = displayDevice.DeviceName; // \\.\DISPLAY1\Monitor0 numberStr = numberStr.substr(0, numberStr.find_last_of('\\')); // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get monitor number from {}", displayDevice.DeviceName); monitorId.deviceId.number = 0; } } else { success = false; // Use the display name as a fallback value when no proper device was found. monitorId.deviceId.id = monitorInfo.szDevice; monitorId.deviceId.instanceId = L""; try { std::wstring numberStr = monitorInfo.szDevice; // \\.\DISPLAY1 numberStr = remove_non_digits(numberStr); monitorId.deviceId.number = std::stoi(numberStr); } catch (...) { Logger::error(L"Failed to get display number from {}", monitorInfo.szDevice); monitorId.deviceId.number = 0; } } result.push_back(std::move(monitorId)); } return {success, result}; } } namespace { inline int RectWidth(const RECT& rect) { return rect.right - rect.left; } inline int RectHeight(const RECT& rect) { return rect.bottom - rect.top; } RECT FitOnScreen(const RECT& windowRect, const RECT& originMonitorRect, const RECT& destMonitorRect) { // New window position on active monitor. If window fits the screen, this will be final position. int left = destMonitorRect.left + (windowRect.left - originMonitorRect.left); int top = destMonitorRect.top + (windowRect.top - originMonitorRect.top); int W = RectWidth(windowRect); int H = RectHeight(windowRect); if ((left < destMonitorRect.left) || (left + W > destMonitorRect.right)) { // Set left window border to left border of screen (add padding). Resize window width if needed. left = destMonitorRect.left + CUSTOM_POSITIONING_LEFT_TOP_PADDING; W = min(W, RectWidth(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } if ((top < destMonitorRect.top) || (top + H > destMonitorRect.bottom)) { // Set top window border to top border of screen (add padding). Resize window height if needed. top = destMonitorRect.top + CUSTOM_POSITIONING_LEFT_TOP_PADDING; H = min(H, RectHeight(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING); } return { .left = left, .top = top, .right = left + W, .bottom = top + H }; } } void OpenWindowOnActiveMonitor(HWND window, HMONITOR monitor) noexcept { // By default Windows opens new window on primary monitor. // Try to preserve window width and height, adjust top-left corner if needed. HMONITOR origin = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); if (origin == monitor) { // Certain applications by design open in last known position, regardless of FancyZones. // If that position is on currently active monitor, skip custom positioning. return; } WINDOWPLACEMENT placement{}; if (GetWindowPlacement(window, &placement)) { MONITORINFOEX originMi; originMi.cbSize = sizeof(originMi); if (GetMonitorInfo(origin, &originMi)) { MONITORINFOEX destMi; destMi.cbSize = sizeof(destMi); if (GetMonitorInfo(monitor, &destMi)) { RECT newPosition = FitOnScreen(placement.rcNormalPosition, originMi.rcWork, destMi.rcWork); FancyZonesWindowUtils::SizeWindowToRect(window, newPosition, false); } } } } std::vector<FancyZonesDataTypes::MonitorId> IdentifyMonitors() noexcept { Logger::info(L"Identifying monitors"); auto displaysResult = Display::GetDisplays(); auto monitors = WMI::GetHardwareMonitorIds(); // retry int retryCounter = 0; while (!displaysResult.first && retryCounter < 100) { Logger::info("Retry display identification"); std::this_thread::sleep_for(std::chrono::milliseconds(30)); displaysResult = Display::GetDisplays(); retryCounter++; } for (const auto& monitor : monitors) { for (auto& display : displaysResult.second) { if (monitor.deviceId.id == display.deviceId.id) { display.serialNumber = monitor.serialNumber; } } } return displaysResult.second; } FancyZonesUtils::Rect GetWorkAreaRect(HMONITOR monitor) { if (monitor) { MONITORINFO mi{}; mi.cbSize = sizeof(mi); if (GetMonitorInfoW(monitor, &mi)) { return FancyZonesUtils::Rect(mi.rcWork); } } return FancyZonesUtils::Rect{}; } }
quyenvsp
4c3e5348f08b7ae7b8b8ba3af2dc9b61b9f27e78
3299ecfece9128cfd6791bacee1351b1c9a32c73
yes you are right, I have updated. This logic is for smooth UI animation, avoid flash window when quick change size to maximized, but it better to keep `rcNormalPosition`.
quyenvsp
457
microsoft/PowerToys
28,657
[QuickAccent]Cache computed all language characters
<!-- 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 After https://github.com/microsoft/PowerToys/pull/28164, were adding computation effort for each character when "All languages" is selected, since we now combine all languages at runtime. This PR adds a runtime cache so that this computation happens only once per key. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Related:** #28164 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified Quick Accent still works correctly when "All Languages" is selected.
null
2023-09-20 17:26:24+00:00
2023-09-21 12:52:08+00:00
src/modules/poweraccent/PowerAccent.Core/Languages.cs
// 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 PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { // would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that! return GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
// 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.Collections.Concurrent; using PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // Store the computed letters for each key, so that subsequent calls don't take as long. private static ConcurrentDictionary<LetterKey, string[]> _allLanguagesCache = new ConcurrentDictionary<LetterKey, string[]>(); // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { if (!_allLanguagesCache.ContainsKey(letter)) { _allLanguagesCache[letter] = GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } return _allLanguagesCache[letter]; } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
jaimecbernardo
890b7f4286a95ced04d7da140b474f90fd4351ed
422813044d5b5caf62deed3e545111ed947ba6a7
Does it have to be concurrent? 🤔
stefansjfw
458
microsoft/PowerToys
28,657
[QuickAccent]Cache computed all language characters
<!-- 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 After https://github.com/microsoft/PowerToys/pull/28164, were adding computation effort for each character when "All languages" is selected, since we now combine all languages at runtime. This PR adds a runtime cache so that this computation happens only once per key. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Related:** #28164 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified Quick Accent still works correctly when "All Languages" is selected.
null
2023-09-20 17:26:24+00:00
2023-09-21 12:52:08+00:00
src/modules/poweraccent/PowerAccent.Core/Languages.cs
// 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 PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { // would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that! return GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
// 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.Collections.Concurrent; using PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // Store the computed letters for each key, so that subsequent calls don't take as long. private static ConcurrentDictionary<LetterKey, string[]> _allLanguagesCache = new ConcurrentDictionary<LetterKey, string[]>(); // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { if (!_allLanguagesCache.ContainsKey(letter)) { _allLanguagesCache[letter] = GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } return _allLanguagesCache[letter]; } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
jaimecbernardo
890b7f4286a95ced04d7da140b474f90fd4351ed
422813044d5b5caf62deed3e545111ed947ba6a7
not part of this PR. should we add .OrderBy() here, to have letters sorted? That way similar letters would end up next to each other and not ordered by lang
stefansjfw
459
microsoft/PowerToys
28,657
[QuickAccent]Cache computed all language characters
<!-- 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 After https://github.com/microsoft/PowerToys/pull/28164, were adding computation effort for each character when "All languages" is selected, since we now combine all languages at runtime. This PR adds a runtime cache so that this computation happens only once per key. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Related:** #28164 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified Quick Accent still works correctly when "All Languages" is selected.
null
2023-09-20 17:26:24+00:00
2023-09-21 12:52:08+00:00
src/modules/poweraccent/PowerAccent.Core/Languages.cs
// 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 PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { // would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that! return GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
// 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.Collections.Concurrent; using PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // Store the computed letters for each key, so that subsequent calls don't take as long. private static ConcurrentDictionary<LetterKey, string[]> _allLanguagesCache = new ConcurrentDictionary<LetterKey, string[]>(); // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { if (!_allLanguagesCache.ContainsKey(letter)) { _allLanguagesCache[letter] = GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } return _allLanguagesCache[letter]; } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
jaimecbernardo
890b7f4286a95ced04d7da140b474f90fd4351ed
422813044d5b5caf62deed3e545111ed947ba6a7
I'm looking at it and this seems to be used in two different places. One to verify if this is a key that might have an accent, and another to show in the menu. Just sounds safer this way. Do you think it's overkill?
jaimecbernardo
460
microsoft/PowerToys
28,657
[QuickAccent]Cache computed all language characters
<!-- 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 After https://github.com/microsoft/PowerToys/pull/28164, were adding computation effort for each character when "All languages" is selected, since we now combine all languages at runtime. This PR adds a runtime cache so that this computation happens only once per key. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Related:** #28164 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified Quick Accent still works correctly when "All Languages" is selected.
null
2023-09-20 17:26:24+00:00
2023-09-21 12:52:08+00:00
src/modules/poweraccent/PowerAccent.Core/Languages.cs
// 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 PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { // would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that! return GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
// 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.Collections.Concurrent; using PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // Store the computed letters for each key, so that subsequent calls don't take as long. private static ConcurrentDictionary<LetterKey, string[]> _allLanguagesCache = new ConcurrentDictionary<LetterKey, string[]>(); // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { if (!_allLanguagesCache.ContainsKey(letter)) { _allLanguagesCache[letter] = GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } return _allLanguagesCache[letter]; } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
jaimecbernardo
890b7f4286a95ced04d7da140b474f90fd4351ed
422813044d5b5caf62deed3e545111ed947ba6a7
Users have a order by use frequency option so they get the ones they use the most first :)
jaimecbernardo
461
microsoft/PowerToys
28,657
[QuickAccent]Cache computed all language characters
<!-- 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 After https://github.com/microsoft/PowerToys/pull/28164, were adding computation effort for each character when "All languages" is selected, since we now combine all languages at runtime. This PR adds a runtime cache so that this computation happens only once per key. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Related:** #28164 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified Quick Accent still works correctly when "All Languages" is selected.
null
2023-09-20 17:26:24+00:00
2023-09-21 12:52:08+00:00
src/modules/poweraccent/PowerAccent.Core/Languages.cs
// 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 PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { // would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that! return GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
// 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.Collections.Concurrent; using PowerToys.PowerAccentKeyboardService; namespace PowerAccent.Core { public enum Language { ALL, CA, CUR, CY, CZ, GA, GD, DE, EST, FR, HR, HE, HU, IS, IT, KU, LT, MK, MI, NL, NO, PI, PL, PT, RO, SK, SP, SR, SV, TK, } internal sealed class Languages { public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { return lang switch { Language.ALL => GetDefaultLetterKeyALL(letter), // ALL Language.CA => GetDefaultLetterKeyCA(letter), // Catalan Language.CUR => GetDefaultLetterKeyCUR(letter), // Currency Language.CY => GetDefaultLetterKeyCY(letter), // Welsh Language.CZ => GetDefaultLetterKeyCZ(letter), // Czech Language.GA => GetDefaultLetterKeyGA(letter), // Gaeilge (Irish) Language.GD => GetDefaultLetterKeyGD(letter), // Gàidhlig (Scottish Gaelic) Language.DE => GetDefaultLetterKeyDE(letter), // German Language.EST => GetDefaultLetterKeyEST(letter), // Estonian Language.FR => GetDefaultLetterKeyFR(letter), // French Language.HR => GetDefaultLetterKeyHR(letter), // Croatian Language.HE => GetDefaultLetterKeyHE(letter), // Hebrew Language.HU => GetDefaultLetterKeyHU(letter), // Hungarian Language.IS => GetDefaultLetterKeyIS(letter), // Iceland Language.IT => GetDefaultLetterKeyIT(letter), // Italian Language.KU => GetDefaultLetterKeyKU(letter), // Kurdish Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian Language.MI => GetDefaultLetterKeyMI(letter), // Maori Language.NL => GetDefaultLetterKeyNL(letter), // Dutch Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin Language.PL => GetDefaultLetterKeyPL(letter), // Polish Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese Language.RO => GetDefaultLetterKeyRO(letter), // Romanian Language.SK => GetDefaultLetterKeySK(letter), // Slovak Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()), }; } // Store the computed letters for each key, so that subsequent calls don't take as long. private static ConcurrentDictionary<LetterKey, string[]> _allLanguagesCache = new ConcurrentDictionary<LetterKey, string[]>(); // All private static string[] GetDefaultLetterKeyALL(LetterKey letter) { if (!_allLanguagesCache.ContainsKey(letter)) { _allLanguagesCache[letter] = GetDefaultLetterKeyCA(letter) .Union(GetDefaultLetterKeyCUR(letter)) .Union(GetDefaultLetterKeyCY(letter)) .Union(GetDefaultLetterKeyCZ(letter)) .Union(GetDefaultLetterKeyGA(letter)) .Union(GetDefaultLetterKeyGD(letter)) .Union(GetDefaultLetterKeyDE(letter)) .Union(GetDefaultLetterKeyEST(letter)) .Union(GetDefaultLetterKeyFR(letter)) .Union(GetDefaultLetterKeyHR(letter)) .Union(GetDefaultLetterKeyHE(letter)) .Union(GetDefaultLetterKeyHU(letter)) .Union(GetDefaultLetterKeyIS(letter)) .Union(GetDefaultLetterKeyIT(letter)) .Union(GetDefaultLetterKeyKU(letter)) .Union(GetDefaultLetterKeyLT(letter)) .Union(GetDefaultLetterKeyMK(letter)) .Union(GetDefaultLetterKeyMI(letter)) .Union(GetDefaultLetterKeyNL(letter)) .Union(GetDefaultLetterKeyNO(letter)) .Union(GetDefaultLetterKeyPI(letter)) .Union(GetDefaultLetterKeyPL(letter)) .Union(GetDefaultLetterKeyPT(letter)) .Union(GetDefaultLetterKeyRO(letter)) .Union(GetDefaultLetterKeySK(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .ToArray(); } return _allLanguagesCache[letter]; } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { return letter switch { LetterKey.VK_B => new[] { "฿", "в" }, LetterKey.VK_C => new[] { "¢", "₡", "č" }, LetterKey.VK_D => new[] { "₫" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_F => new[] { "ƒ" }, LetterKey.VK_H => new[] { "₴" }, LetterKey.VK_K => new[] { "₭" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "л" }, LetterKey.VK_M => new[] { "₼" }, LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "z" }, _ => Array.Empty<string>(), }; } // Croatian private static string[] GetDefaultLetterKeyHR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Estonian private static string[] GetDefaultLetterKeyEST(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö", "õ" }, LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, _ => Array.Empty<string>(), }; } // French private static string[] GetDefaultLetterKeyFR(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "â", "á", "ä", "ã", "æ" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "€" }, LetterKey.VK_I => new[] { "î", "ï", "í", "ì" }, LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, _ => Array.Empty<string>(), }; } // Iceland private static string[] GetDefaultLetterKeyIS(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "æ" }, LetterKey.VK_D => new[] { "ð" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ó", "ö" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, _ => Array.Empty<string>(), }; } // Spain private static string[] GetDefaultLetterKeySP(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Catalan private static string[] GetDefaultLetterKeyCA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à", "á" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í", "ï" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, _ => Array.Empty<string>(), }; } // Maori private static string[] GetDefaultLetterKeyMI(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ā" }, LetterKey.VK_E => new[] { "ē" }, LetterKey.VK_I => new[] { "ī" }, LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, _ => Array.Empty<string>(), }; } // Dutch private static string[] GetDefaultLetterKeyNL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "à", "ä" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "è", "ë", "ê", "€" }, LetterKey.VK_I => new[] { "í", "ï", "î" }, LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, _ => Array.Empty<string>(), }; } // Pinyin private static string[] GetDefaultLetterKeyPI(LetterKey letter) { return letter switch { LetterKey.VK_1 => new[] { "\u0304", "ˉ" }, LetterKey.VK_2 => new[] { "\u0301", "ˊ" }, LetterKey.VK_3 => new[] { "\u030c", "ˇ" }, LetterKey.VK_4 => new[] { "\u0300", "ˋ" }, LetterKey.VK_5 => new[] { "·" }, LetterKey.VK_A => new[] { "ā", "á", "ǎ", "à", "ɑ", "ɑ\u0304", "ɑ\u0301", "ɑ\u030c", "ɑ\u0300" }, LetterKey.VK_C => new[] { "ĉ" }, LetterKey.VK_E => new[] { "ē", "é", "ě", "è", "ê", "ê\u0304", "ế", "ê\u030c", "ề" }, LetterKey.VK_I => new[] { "ī", "í", "ǐ", "ì" }, LetterKey.VK_M => new[] { "m\u0304", "ḿ", "m\u030c", "m\u0300" }, LetterKey.VK_N => new[] { "n\u0304", "ń", "ň", "ǹ", "ŋ", "ŋ\u0304", "ŋ\u0301", "ŋ\u030c", "ŋ\u0300" }, LetterKey.VK_O => new[] { "ō", "ó", "ǒ", "ò" }, LetterKey.VK_S => new[] { "ŝ" }, LetterKey.VK_U => new[] { "ū", "ú", "ǔ", "ù", "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, _ => Array.Empty<string>(), }; } // Turkish private static string[] GetDefaultLetterKeyTK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ë", "€" }, LetterKey.VK_G => new[] { "ğ" }, LetterKey.VK_I => new[] { "ı", "İ", "î", }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, _ => Array.Empty<string>(), }; } // Polish private static string[] GetDefaultLetterKeyPL(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "ć" }, LetterKey.VK_E => new[] { "ę", "€" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ń" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, _ => Array.Empty<string>(), }; } // Portuguese private static string[] GetDefaultLetterKeyPT(LetterKey letter) { return letter switch { LetterKey.VK_0 => new[] { "₀", "⁰" }, LetterKey.VK_1 => new[] { "₁", "¹" }, LetterKey.VK_2 => new[] { "₂", "²" }, LetterKey.VK_3 => new[] { "₃", "³" }, LetterKey.VK_4 => new[] { "₄", "⁴" }, LetterKey.VK_5 => new[] { "₅", "⁵" }, LetterKey.VK_6 => new[] { "₆", "⁶" }, LetterKey.VK_7 => new[] { "₇", "⁷" }, LetterKey.VK_8 => new[] { "₈", "⁸" }, LetterKey.VK_9 => new[] { "₉", "⁹" }, LetterKey.VK_A => new[] { "á", "à", "â", "ã" }, LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "é", "ê", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ô", "ó", "õ" }, LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, _ => Array.Empty<string>(), }; } // Slovak private static string[] GetDefaultLetterKeySK(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á", "ä" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "é", "€" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_L => new[] { "ľ", "ĺ" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó", "ô" }, LetterKey.VK_R => new[] { "ŕ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Gaeilge (Irish language) private static string[] GetDefaultLetterKeyGA(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, _ => Array.Empty<string>(), }; } // Gàidhlig (Scottish Gaelic) private static string[] GetDefaultLetterKeyGD(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è" }, LetterKey.VK_I => new[] { "ì" }, LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_U => new[] { "ù" }, _ => Array.Empty<string>(), }; } // Czech private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_D => new[] { "ď" }, LetterKey.VK_E => new[] { "ě", "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_T => new[] { "ť" }, LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // German private static string[] GetDefaultLetterKeyDE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ä" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, _ => Array.Empty<string>(), }; } // Hebrew private static string[] GetDefaultLetterKeyHE(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "שׂ", "שׁ", "\u05b0" }, LetterKey.VK_B => new[] { "׆" }, LetterKey.VK_E => new[] { "\u05b8", "\u05b3", "\u05bb" }, LetterKey.VK_G => new[] { "ױ" }, LetterKey.VK_H => new[] { "ײ", "ײַ", "ׯ", "\u05b4" }, LetterKey.VK_M => new[] { "\u05b5" }, LetterKey.VK_P => new[] { "\u05b7", "\u05b2" }, LetterKey.VK_S => new[] { "\u05bc" }, LetterKey.VK_T => new[] { "ﭏ" }, LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty<string>(), }; } // Hungarian private static string[] GetDefaultLetterKeyHU(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "á" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, _ => Array.Empty<string>(), }; } // Romanian private static string[] GetDefaultLetterKeyRO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ă", "â" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, _ => Array.Empty<string>(), }; } // Italian private static string[] GetDefaultLetterKeyIT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "à" }, LetterKey.VK_E => new[] { "è", "é", "€" }, LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, _ => Array.Empty<string>(), }; } // Kurdish private static string[] GetDefaultLetterKeyKU(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ç" }, LetterKey.VK_E => new[] { "ê", "€" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ö", "ô" }, LetterKey.VK_L => new[] { "ł" }, LetterKey.VK_N => new[] { "ň" }, LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, _ => Array.Empty<string>(), }; } // Welsh private static string[] GetDefaultLetterKeyCY(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "â" }, LetterKey.VK_E => new[] { "ê" }, LetterKey.VK_I => new[] { "î" }, LetterKey.VK_O => new[] { "ô" }, LetterKey.VK_U => new[] { "û" }, LetterKey.VK_Y => new[] { "ŷ" }, LetterKey.VK_W => new[] { "ŵ" }, _ => Array.Empty<string>(), }; } // Swedish private static string[] GetDefaultLetterKeySV(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, _ => Array.Empty<string>(), }; } // Serbian private static string[] GetDefaultLetterKeySR(LetterKey letter) { return letter switch { LetterKey.VK_C => new[] { "ć", "č" }, LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { return letter switch { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, _ => Array.Empty<string>(), }; } // Norwegian private static string[] GetDefaultLetterKeyNO(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, _ => Array.Empty<string>(), }; } // Lithuanian private static string[] GetDefaultLetterKeyLT(LetterKey letter) { return letter switch { LetterKey.VK_A => new[] { "ą" }, LetterKey.VK_C => new[] { "č" }, LetterKey.VK_E => new[] { "ę", "ė", "€" }, LetterKey.VK_I => new[] { "į" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, _ => Array.Empty<string>(), }; } } }
jaimecbernardo
890b7f4286a95ced04d7da140b474f90fd4351ed
422813044d5b5caf62deed3e545111ed947ba6a7
Not sure. I'd have to take a better look into the code. anyway, better be safe than sorry I guess :) so fine by me
stefansjfw
462
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/ci/templates/build-powertoys-steps.yml
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' includePreviewVersions: true - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
Why are we using .NET 6 and then .NET 8 after?
jaimecbernardo
463
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/ci/templates/build-powertoys-steps.yml
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' includePreviewVersions: true - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
The dotnet tool for the XamlStyler requires .NET 6 to run. Otherwise it all blows up :)
snickler
464
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/ci/templates/build-powertoys-steps.yml
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' includePreviewVersions: true - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
Verify and set? :)
stefansjfw
465
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/ci/templates/build-powertoys-steps.yml
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
parameters: additionalBuildArguments: '' steps: - checkout: self fetchDepth: 1 submodules: true clean: true - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: PowerShell@2 displayName: Verify XAML formatting inputs: filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1' arguments: -Passive pwsh: true - task: PowerShell@2 displayName: Verify Nuget package versions for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToys.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for BugReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for WebcamReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for StylesReportTool.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' pwsh: true - task: PowerShell@2 displayName: Verify Arm64 configuration for PowerToysSetup.sln inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1' arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' includePreviewVersions: true - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform - task: VSBuild@1 displayName: 'Build PowerToys.sln' inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build BugReportTool.sln' inputs: solution: '**\BugReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build WebcamReportTool.sln' inputs: solution: '**\WebcamReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build StylesReportTool.sln' inputs: solution: '**\StylesReportTool.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: VSBuild@1 displayName: 'Build PowerToys per-machine MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-machine Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} clean: false maximumCpuCount: true - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - task: VSBuild@1 displayName: 'Build PowerToys per-user MSI' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true maximumCpuCount: true - task: VSBuild@1 displayName: 'Build PowerToys per-user Bootstrapper' inputs: solution: '**\installer\PowerToysSetup.sln' vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true clean: false maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true # directly not doing WinAppDriver testing - task: VSTest@2 displayName: 'MS Tests' condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests. inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\UnitTests-GcodeThumbnailProvider.dll **\UnitTests-StlThumbnailProvider.dll **\UnitTests-PdfThumbnailProvider.dll **\UnitTests-QoiThumbnailProvider.dll **\Settings.UI.UnitTests.dll **\UnitTests-GcodePreviewHandler.dll **\UnitTests-QoiPreviewHandler.dll **\UnitTests-FancyZonesEditor.dll **\UnitTests-PdfPreviewHandler.dll **\UnitTests-PreviewHandlerCommon.dll **\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll **\UnitTest-ColorPickerUI.dll **\Microsoft.Interop.Tests.dll **\ImageResizer.Test.dll **\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll **\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll **\Microsoft.Plugin.Folder.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.Plugin.Uri.UnitTests.dll **\Wox.Test.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll **\Microsoft.Plugin.WindowsTerminal.UnitTests.dll **\Microsoft.Plugin.WindowWalker.UnitTests.dll **\PreviewPaneUnitTests.dll **\UnitTests-SvgThumbnailProvider.dll **\UnitTests-SvgPreviewHandler.dll **\PowerToys.Hosts.Tests.dll **\MouseJumpUI.UnitTests.dll !**\obj\** !**\ref\** # Native dlls - task: VSTest@2 condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests. displayName: 'Native Tests' inputs: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' testSelector: 'testAssemblies' testAssemblyVer2: | **\KeyboardManagerEngineTest.dll **\KeyboardManagerEditorTest.dll **\UnitTests-CommonLib.dll **\PowerRenameUnitTests.dll **\powerpreviewTest.dll **\UnitTests-FancyZones.dll !**\obj\** - task: PowerShell@2 displayName: Trigger dotnet welcome message so that it does not cause errors on other scripts inputs: targetType: 'inline' script: | dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package - task: PowerShell@2 displayName: Verify Notice.md and Nuget packages match inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1' arguments: -path '$(build.sourcesdirectory)\' pwsh: true
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
I've added a commit to address the feedback. Thank you!
jaimecbernardo
466
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/release.yml
# This build should never run as CI or against a pull request. name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) trigger: none pr: none resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release parameters: - name: buildConfigurations type: object default: - Release - name: buildPlatforms type: object default: - x64 - arm64 - name: versionNumber type: string default: '0.0.1' extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: customBuildTags: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S image: SHINE-VS17-Latest os: windows stages: - stage: build displayName: Build (Complete) pool: name: SHINE-INT-L image: SHINE-VS17-Latest os: windows jobs: - job: Build strategy: matrix: ${{ each config in parameters.buildConfigurations }}: ${{ each platform in parameters.buildPlatforms }}: ${{ config }}_${{ platform }}: BuildConfiguration: ${{ config }} BuildPlatform: ${{ platform }} templateContext: outputs: - output: pipelineArtifact artifactName: setup-$(BuildPlatform) targetPath: $(Build.ArtifactStagingDirectory) sdl: baseline: baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines displayName: Build timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time cancelTimeoutInMinutes: 1 variables: NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained NODE_OPTIONS: --max_old_space_size=16384 IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway IsExperimentationLive: 1 # The build and installer use this to turn on experimentation steps: - checkout: self clean: true submodules: true persistCredentials: True # Sets versions for all PowerToy created DLLs - task: PowerShell@1 displayName: Set Versions.Prop inputs: scriptName: .pipelines/versionSetting.ps1 arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment '' # ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64) - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: NuGetAuthenticate@1 - task: NuGetToolInstaller@1 displayName: Use NuGet Installer latest # this will restore the following nugets: # - main solution # - Bug report tool # - Webcam report tool # - Installer # - Bootstrapper Installer - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1 displayName: 'Download Localization Files -- PowerToys 37400' inputs: teamId: 37400 authId: '$(TouchdownApplicationID)' authKey: '$(TouchdownApplicationKey)' resourceFilePath: | **\Resources.resx **\Resource.resx **\Resources.resw appendRelativeDir: true localizationTarget: false # pseudoSetting: Included - task: PowerShell@2 displayName: Move Loc files into correct locations inputs: targetType: inline script: >- $VerbosePreference = "Continue" ./tools/build/move-and-rename-resx.ps1 ./tools/build/move-uwp-resw.ps1 pwsh: true - task: CmdLine@2 displayName: Moving telem files inputs: script: | call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 ## ALL BUT INSTALLER BUILDING - task: VSBuild@1 displayName: Build PowerToys main project inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build BugReportTool inputs: solution: '**/tools/BugReportTool/BugReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build WebcamReportTool inputs: solution: '**/tools/WebcamReportTool/WebcamReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build StylesReportTool inputs: solution: '**/tools/StylesReportTool/StylesReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Publish Settings for Packaging inputs: solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj' vsVersion: 17.0 msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Launcher for Packaging inputs: solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Monaco Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Markdown Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Thumbnail Provider for Packaging inputs: solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish File Locksmith UI for Packaging inputs: solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true #### MAIN SIGNING AREA # reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver # https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign Core PT inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign x86 directshow VCM inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' #### END SIGNING ## END MAIN - pwsh: |- Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/" displayName: Stage binlog into artifact directory condition: always() - task: ComponentGovernanceComponentDetection@0 displayName: Component Detection - task: CopyFiles@2 displayName: Copying files for symbols inputs: contents: >- **/*.pdb flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ - task: PowerShell@2 displayName: 'Remove unneeded files from ArtifactStagingDirectory' inputs: targetType: 'inline' script: | cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ Remove-Item vc143.pdb Remove-Item *test* - task: PublishSymbols@2 displayName: Publish symbols path continueOnError: True inputs: SearchPattern: | $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.* IndexSources: false SymbolServerType: TeamServices - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "false" buildSubDir: "MachineSetup" installerPrefix: "PowerToysSetup" - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "true" buildSubDir: "UserSetup" installerPrefix: "PowerToysUserSetup" - task: CopyFiles@2 displayName: Copying setup file over inputs: contents: "**/PowerToys*Setup-*.exe" flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory) - task: PowerShell@2 displayName: 'Calculating SHA256 hash' inputs: targetType: 'inline' script: | $p = "$(System.ArtifactsDirectory)\"; $staging = "$(Build.ArtifactStagingDirectory)\" $userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash); $machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash); $userPlat = "hash_user_$(BuildPlatform).txt"; $machinePlat = "hash_machine_$(BuildPlatform).txt"; $combinedUserPath = $staging + $userPlat; $combinedMachinePath = $staging + $machinePlat; echo $p echo $userPlat echo $userHash echo $combinedUserPath echo $machinePlat echo $machineHash echo $combinedMachinePath $userHash | out-file -filepath $combinedUserPath $machineHash | out-file -filepath $combinedMachinePath pwsh: true # Publishing the GPO files - pwsh: |- New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse displayName: Stage the GPO files ...
# This build should never run as CI or against a pull request. name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) trigger: none pr: none resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release parameters: - name: buildConfigurations type: object default: - Release - name: buildPlatforms type: object default: - x64 - arm64 - name: versionNumber type: string default: '0.0.1' extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: customBuildTags: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S image: SHINE-VS17-Latest os: windows stages: - stage: build displayName: Build (Complete) pool: name: SHINE-INT-L image: SHINE-VS17-Latest os: windows jobs: - job: Build strategy: matrix: ${{ each config in parameters.buildConfigurations }}: ${{ each platform in parameters.buildPlatforms }}: ${{ config }}_${{ platform }}: BuildConfiguration: ${{ config }} BuildPlatform: ${{ platform }} templateContext: outputs: - output: pipelineArtifact artifactName: setup-$(BuildPlatform) targetPath: $(Build.ArtifactStagingDirectory) sdl: baseline: baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines displayName: Build timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time cancelTimeoutInMinutes: 1 variables: NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained NODE_OPTIONS: --max_old_space_size=16384 IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway IsExperimentationLive: 1 # The build and installer use this to turn on experimentation steps: - checkout: self clean: true submodules: true persistCredentials: True # Sets versions for all PowerToy created DLLs - task: PowerShell@1 displayName: Set Versions.Prop inputs: scriptName: .pipelines/versionSetting.ps1 arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment '' # ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64) - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: NuGetAuthenticate@1 - task: NuGetToolInstaller@1 displayName: Use NuGet Installer latest # this will restore the following nugets: # - main solution # - Bug report tool # - Webcam report tool # - Installer # - Bootstrapper Installer - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1 displayName: 'Download Localization Files -- PowerToys 37400' inputs: teamId: 37400 authId: '$(TouchdownApplicationID)' authKey: '$(TouchdownApplicationKey)' resourceFilePath: | **\Resources.resx **\Resource.resx **\Resources.resw appendRelativeDir: true localizationTarget: false # pseudoSetting: Included - task: PowerShell@2 displayName: Move Loc files into correct locations inputs: targetType: inline script: >- $VerbosePreference = "Continue" ./tools/build/move-and-rename-resx.ps1 ./tools/build/move-uwp-resw.ps1 pwsh: true - task: CmdLine@2 displayName: Moving telem files inputs: script: | call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 ## ALL BUT INSTALLER BUILDING - task: VSBuild@1 displayName: Build PowerToys main project inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build BugReportTool inputs: solution: '**/tools/BugReportTool/BugReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build WebcamReportTool inputs: solution: '**/tools/WebcamReportTool/WebcamReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build StylesReportTool inputs: solution: '**/tools/StylesReportTool/StylesReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Publish Settings for Packaging inputs: solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj' vsVersion: 17.0 msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Launcher for Packaging inputs: solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Monaco Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Markdown Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Thumbnail Provider for Packaging inputs: solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish File Locksmith UI for Packaging inputs: solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true #### MAIN SIGNING AREA # reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver # https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign Core PT inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign x86 directshow VCM inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' #### END SIGNING ## END MAIN - pwsh: |- Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/" displayName: Stage binlog into artifact directory condition: always() - task: ComponentGovernanceComponentDetection@0 displayName: Component Detection - task: CopyFiles@2 displayName: Copying files for symbols inputs: contents: >- **/*.pdb flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ - task: PowerShell@2 displayName: 'Remove unneeded files from ArtifactStagingDirectory' inputs: targetType: 'inline' script: | cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ Remove-Item vc143.pdb Remove-Item *test* - task: PublishSymbols@2 displayName: Publish symbols path continueOnError: True inputs: SearchPattern: | $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.* IndexSources: false SymbolServerType: TeamServices - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "false" buildSubDir: "MachineSetup" installerPrefix: "PowerToysSetup" - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "true" buildSubDir: "UserSetup" installerPrefix: "PowerToysUserSetup" - task: CopyFiles@2 displayName: Copying setup file over inputs: contents: "**/PowerToys*Setup-*.exe" flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory) - task: PowerShell@2 displayName: 'Calculating SHA256 hash' inputs: targetType: 'inline' script: | $p = "$(System.ArtifactsDirectory)\"; $staging = "$(Build.ArtifactStagingDirectory)\" $userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash); $machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash); $userPlat = "hash_user_$(BuildPlatform).txt"; $machinePlat = "hash_machine_$(BuildPlatform).txt"; $combinedUserPath = $staging + $userPlat; $combinedMachinePath = $staging + $machinePlat; echo $p echo $userPlat echo $userHash echo $combinedUserPath echo $machinePlat echo $machineHash echo $combinedMachinePath $userHash | out-file -filepath $combinedUserPath $machineHash | out-file -filepath $combinedMachinePath pwsh: true # Publishing the GPO files - pwsh: |- New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse displayName: Stage the GPO files ...
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
same here. Also script name
stefansjfw
467
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
.pipelines/release.yml
# This build should never run as CI or against a pull request. name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) trigger: none pr: none resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release parameters: - name: buildConfigurations type: object default: - Release - name: buildPlatforms type: object default: - x64 - arm64 - name: versionNumber type: string default: '0.0.1' extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: customBuildTags: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S image: SHINE-VS17-Latest os: windows stages: - stage: build displayName: Build (Complete) pool: name: SHINE-INT-L image: SHINE-VS17-Latest os: windows jobs: - job: Build strategy: matrix: ${{ each config in parameters.buildConfigurations }}: ${{ each platform in parameters.buildPlatforms }}: ${{ config }}_${{ platform }}: BuildConfiguration: ${{ config }} BuildPlatform: ${{ platform }} templateContext: outputs: - output: pipelineArtifact artifactName: setup-$(BuildPlatform) targetPath: $(Build.ArtifactStagingDirectory) sdl: baseline: baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines displayName: Build timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time cancelTimeoutInMinutes: 1 variables: NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained NODE_OPTIONS: --max_old_space_size=16384 IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway IsExperimentationLive: 1 # The build and installer use this to turn on experimentation steps: - checkout: self clean: true submodules: true persistCredentials: True # Sets versions for all PowerToy created DLLs - task: PowerShell@1 displayName: Set Versions.Prop inputs: scriptName: .pipelines/versionSetting.ps1 arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment '' # ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64) - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: UseDotNet@2 displayName: 'Use .NET 7 SDK' inputs: packageType: sdk version: '7.x' - task: NuGetAuthenticate@1 - task: NuGetToolInstaller@1 displayName: Use NuGet Installer latest # this will restore the following nugets: # - main solution # - Bug report tool # - Webcam report tool # - Installer # - Bootstrapper Installer - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1 displayName: 'Download Localization Files -- PowerToys 37400' inputs: teamId: 37400 authId: '$(TouchdownApplicationID)' authKey: '$(TouchdownApplicationKey)' resourceFilePath: | **\Resources.resx **\Resource.resx **\Resources.resw appendRelativeDir: true localizationTarget: false # pseudoSetting: Included - task: PowerShell@2 displayName: Move Loc files into correct locations inputs: targetType: inline script: >- $VerbosePreference = "Continue" ./tools/build/move-and-rename-resx.ps1 ./tools/build/move-uwp-resw.ps1 pwsh: true - task: CmdLine@2 displayName: Moving telem files inputs: script: | call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 ## ALL BUT INSTALLER BUILDING - task: VSBuild@1 displayName: Build PowerToys main project inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build BugReportTool inputs: solution: '**/tools/BugReportTool/BugReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build WebcamReportTool inputs: solution: '**/tools/WebcamReportTool/WebcamReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build StylesReportTool inputs: solution: '**/tools/StylesReportTool/StylesReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Publish Settings for Packaging inputs: solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj' vsVersion: 17.0 msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Launcher for Packaging inputs: solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Monaco Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Markdown Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Thumbnail Provider for Packaging inputs: solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish File Locksmith UI for Packaging inputs: solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true #### MAIN SIGNING AREA # reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver # https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign Core PT inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign x86 directshow VCM inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' #### END SIGNING ## END MAIN - pwsh: |- Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/" displayName: Stage binlog into artifact directory condition: always() - task: ComponentGovernanceComponentDetection@0 displayName: Component Detection - task: CopyFiles@2 displayName: Copying files for symbols inputs: contents: >- **/*.pdb flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ - task: PowerShell@2 displayName: 'Remove unneeded files from ArtifactStagingDirectory' inputs: targetType: 'inline' script: | cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ Remove-Item vc143.pdb Remove-Item *test* - task: PublishSymbols@2 displayName: Publish symbols path continueOnError: True inputs: SearchPattern: | $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.* IndexSources: false SymbolServerType: TeamServices - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "false" buildSubDir: "MachineSetup" installerPrefix: "PowerToysSetup" - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "true" buildSubDir: "UserSetup" installerPrefix: "PowerToysUserSetup" - task: CopyFiles@2 displayName: Copying setup file over inputs: contents: "**/PowerToys*Setup-*.exe" flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory) - task: PowerShell@2 displayName: 'Calculating SHA256 hash' inputs: targetType: 'inline' script: | $p = "$(System.ArtifactsDirectory)\"; $staging = "$(Build.ArtifactStagingDirectory)\" $userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash); $machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash); $userPlat = "hash_user_$(BuildPlatform).txt"; $machinePlat = "hash_machine_$(BuildPlatform).txt"; $combinedUserPath = $staging + $userPlat; $combinedMachinePath = $staging + $machinePlat; echo $p echo $userPlat echo $userHash echo $combinedUserPath echo $machinePlat echo $machineHash echo $combinedMachinePath $userHash | out-file -filepath $combinedUserPath $machineHash | out-file -filepath $combinedMachinePath pwsh: true # Publishing the GPO files - pwsh: |- New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse displayName: Stage the GPO files ...
# This build should never run as CI or against a pull request. name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) trigger: none pr: none resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release parameters: - name: buildConfigurations type: object default: - Release - name: buildPlatforms type: object default: - x64 - arm64 - name: versionNumber type: string default: '0.0.1' extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: customBuildTags: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S image: SHINE-VS17-Latest os: windows stages: - stage: build displayName: Build (Complete) pool: name: SHINE-INT-L image: SHINE-VS17-Latest os: windows jobs: - job: Build strategy: matrix: ${{ each config in parameters.buildConfigurations }}: ${{ each platform in parameters.buildPlatforms }}: ${{ config }}_${{ platform }}: BuildConfiguration: ${{ config }} BuildPlatform: ${{ platform }} templateContext: outputs: - output: pipelineArtifact artifactName: setup-$(BuildPlatform) targetPath: $(Build.ArtifactStagingDirectory) sdl: baseline: baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines displayName: Build timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time cancelTimeoutInMinutes: 1 variables: NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained NODE_OPTIONS: --max_old_space_size=16384 IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway IsExperimentationLive: 1 # The build and installer use this to turn on experimentation steps: - checkout: self clean: true submodules: true persistCredentials: True # Sets versions for all PowerToy created DLLs - task: PowerShell@1 displayName: Set Versions.Prop inputs: scriptName: .pipelines/versionSetting.ps1 arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment '' # ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64) - task: UseDotNet@2 displayName: 'Use .NET 6 SDK' inputs: packageType: sdk version: '6.x' - task: UseDotNet@2 displayName: 'Use .NET 8 SDK' inputs: packageType: sdk version: '8.x' - task: PowerShell@2 displayName: Verify and set latest VCToolsVersion usage inputs: filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' pwsh: true - task: NuGetAuthenticate@1 - task: NuGetToolInstaller@1 displayName: Use NuGet Installer latest # this will restore the following nugets: # - main solution # - Bug report tool # - Webcam report tool # - Installer # - Bootstrapper Installer - task: PowerShell@2 displayName: Download and install WiX 3.14 development build inputs: targetType: filePath filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1' - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1 displayName: 'Download Localization Files -- PowerToys 37400' inputs: teamId: 37400 authId: '$(TouchdownApplicationID)' authKey: '$(TouchdownApplicationKey)' resourceFilePath: | **\Resources.resx **\Resource.resx **\Resources.resw appendRelativeDir: true localizationTarget: false # pseudoSetting: Included - task: PowerShell@2 displayName: Move Loc files into correct locations inputs: targetType: inline script: >- $VerbosePreference = "Continue" ./tools/build/move-and-rename-resx.ps1 ./tools/build/move-uwp-resw.ps1 pwsh: true - task: CmdLine@2 displayName: Moving telem files inputs: script: | call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 ## ALL BUT INSTALLER BUILDING - task: VSBuild@1 displayName: Build PowerToys main project inputs: solution: '**\PowerToys.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build BugReportTool inputs: solution: '**/tools/BugReportTool/BugReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build WebcamReportTool inputs: solution: '**/tools/WebcamReportTool/WebcamReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Build StylesReportTool inputs: solution: '**/tools/StylesReportTool/StylesReportTool.sln' vsVersion: 17.0 msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: true maximumCpuCount: true - task: VSBuild@1 displayName: Publish Settings for Packaging inputs: solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj' vsVersion: 17.0 msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Launcher for Packaging inputs: solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Monaco Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Markdown Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Preview Handler for Packaging inputs: solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish Svg Thumbnail Provider for Packaging inputs: solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true - task: VSBuild@1 displayName: Publish File Locksmith UI for Packaging inputs: solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj' vsVersion: 17.0 # The arguments should be the same as the ones for Settings; make sure they are. msbuildArgs: >- /target:Publish /p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never /p:VCRTForwarders-IncludeDebugCRT=false /p:PowerToysRoot=$(Build.SourcesDirectory) /p:PublishProfile=InstallationPublishProfile.pubxml platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true # Check if deps.json files don't reference different dll versions. - task: PowerShell@2 displayName: Audit deps.json files for all applications inputs: filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true # Check if asset files on the main application paths are playing nice and avoiding basic conflicts. - task: PowerShell@2 displayName: Audit base applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' pwsh: true - task: PowerShell@2 displayName: Audit WinAppSDK applications path asset conflicts inputs: filePath: '.pipelines/verifyPossibleAssetConflicts.ps1' arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps' pwsh: true #### MAIN SIGNING AREA # reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver # https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign Core PT inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3 displayName: Sign x86 directshow VCM inputs: ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection' FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64. signType: batchSigning batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json' ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml' #### END SIGNING ## END MAIN - pwsh: |- Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/" displayName: Stage binlog into artifact directory condition: always() - task: ComponentGovernanceComponentDetection@0 displayName: Component Detection - task: CopyFiles@2 displayName: Copying files for symbols inputs: contents: >- **/*.pdb flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ - task: PowerShell@2 displayName: 'Remove unneeded files from ArtifactStagingDirectory' inputs: targetType: 'inline' script: | cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/ Remove-Item vc143.pdb Remove-Item *test* - task: PublishSymbols@2 displayName: Publish symbols path continueOnError: True inputs: SearchPattern: | $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.* IndexSources: false SymbolServerType: TeamServices - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "false" buildSubDir: "MachineSetup" installerPrefix: "PowerToysSetup" - task: PowerShell@2 displayName: Clean installer dir before building per-user installer inputs: targetType: inline script: git clean -xfd -e *exe -- .\installer\ pwsh: true - template: .pipelines/installer-steps.yml@self parameters: versionNumber: ${{ parameters.versionNumber }} perUserArg: "true" buildSubDir: "UserSetup" installerPrefix: "PowerToysUserSetup" - task: CopyFiles@2 displayName: Copying setup file over inputs: contents: "**/PowerToys*Setup-*.exe" flattenFolders: True targetFolder: $(Build.ArtifactStagingDirectory) - task: PowerShell@2 displayName: 'Calculating SHA256 hash' inputs: targetType: 'inline' script: | $p = "$(System.ArtifactsDirectory)\"; $staging = "$(Build.ArtifactStagingDirectory)\" $userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash); $machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash); $userPlat = "hash_user_$(BuildPlatform).txt"; $machinePlat = "hash_machine_$(BuildPlatform).txt"; $combinedUserPath = $staging + $userPlat; $combinedMachinePath = $staging + $machinePlat; echo $p echo $userPlat echo $userHash echo $combinedUserPath echo $machinePlat echo $machineHash echo $combinedMachinePath $userHash | out-file -filepath $combinedUserPath $machineHash | out-file -filepath $combinedMachinePath pwsh: true # Publishing the GPO files - pwsh: |- New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse displayName: Stage the GPO files ...
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
I've added a commit to address the feedback. Thank you!
jaimecbernardo
468
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
Directory.Packages.props
<Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> <ItemGroup> <PackageVersion Include="Appium.WebDriver" Version="4.2.1" /> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" /> <PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Collections " Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" /> <PackageVersion Include="ControlzEx" Version="6.0.0" /> <PackageVersion Include="coverlet.collector" Version="1.3.0" /> <PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" /> <PackageVersion Include="HelixToolkit" Version="2.20.2" /> <PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.20.2" /> <PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" /> <PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" /> <PackageVersion Include="LazyCache" Version="2.4.0" /> <PackageVersion Include="Mages" Version="2.0.1" /> <PackageVersion Include="Markdig.Signed" Version="0.27.0" /> <PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3" /> <PackageVersion Include="Microsoft.Data.Sqlite" Version="7.0.0" /> <PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.336902" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" /> <PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2088.41" /> <PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.3" /> <PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" /> <!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. --> <PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.4" /> <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" /> <PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" /> <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" /> <PackageVersion Include="ModernWpfUI" Version="0.9.4" /> <PackageVersion Include="Moq" Version="4.18.4" /> <PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageVersion Include="MSTest.TestFramework" Version="3.1.1" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" /> <PackageVersion Include="NLog" Version="5.0.4" /> <PackageVersion Include="NLog.Extensions.Logging" Version="5.0.4" /> <PackageVersion Include="NLog.Schema" Version="5.0.4" /> <PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" /> <PackageVersion Include="SharpCompress" Version="0.33.0" /> <PackageVersion Include="StreamJsonRpc" Version="2.14.24" /> <PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" /> <PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageVersion Include="System.ComponentModel.Composition" Version="7.0.0" /> <PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> <PackageVersion Include="System.Data.OleDb" Version="7.0.0" /> <PackageVersion Include="System.Drawing.Common" Version="7.0.0" /> <PackageVersion Include="System.IO.Abstractions" Version="17.2.3" /> <PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" /> <PackageVersion Include="System.Management" Version="7.0.2" /> <PackageVersion Include="System.Reactive" Version="6.0.0-preview.9" /> <PackageVersion Include="System.Runtime.Caching" Version="7.0.0" /> <PackageVersion Include="System.ServiceProcess.ServiceController" Version="7.0.1" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="7.0.0" /> <PackageVersion Include="UnicodeInformation" Version="2.6.0" /> <PackageVersion Include="UnitsNet" Version="4.145.0" /> <PackageVersion Include="UTF.Unknown" Version="2.5.1" /> <PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" /> <PackageVersion Include="WinUIEx" Version="2.2.0" /> <PackageVersion Include="WPF-UI" Version="3.0.0-preview.9" /> </ItemGroup> <ItemGroup Condition="'$(IsExperimentationLive)'!=''"> <!-- Additional dependencies used by experimentation --> <PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" /> <PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" /> </ItemGroup> </Project>
<Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> <ItemGroup> <PackageVersion Include="Appium.WebDriver" Version="4.2.1" /> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" /> <PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Collections " Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" /> <PackageVersion Include="ControlzEx" Version="6.0.0" /> <PackageVersion Include="coverlet.collector" Version="1.3.0" /> <PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" /> <PackageVersion Include="HelixToolkit" Version="2.20.2" /> <PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.20.2" /> <PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" /> <PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" /> <PackageVersion Include="LazyCache" Version="2.4.0" /> <PackageVersion Include="Mages" Version="2.0.1" /> <PackageVersion Include="Markdig.Signed" Version="0.27.0" /> <PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" /> <PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.0" /> <PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.336902" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" /> <PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2088.41" /> <PackageVersion Include="Microsoft.Windows.Compatibility" Version="8.0.0" /> <PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" /> <!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. --> <PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.4" /> <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" /> <PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" /> <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" /> <PackageVersion Include="ModernWpfUI" Version="0.9.4" /> <PackageVersion Include="Moq" Version="4.18.4" /> <PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageVersion Include="MSTest.TestFramework" Version="3.1.1" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" /> <PackageVersion Include="NLog" Version="5.0.4" /> <PackageVersion Include="NLog.Extensions.Logging" Version="5.0.4" /> <PackageVersion Include="NLog.Schema" Version="5.0.4" /> <PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" /> <PackageVersion Include="SharpCompress" Version="0.33.0" /> <PackageVersion Include="StreamJsonRpc" Version="2.14.24" /> <PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" /> <PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageVersion Include="System.ComponentModel.Composition" Version="8.0.0" /> <PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" /> <PackageVersion Include="System.Data.OleDb" Version="8.0.0" /> <PackageVersion Include="System.Drawing.Common" Version="8.0.0" /> <PackageVersion Include="System.IO.Abstractions" Version="17.2.3" /> <PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" /> <PackageVersion Include="System.Management" Version="8.0.0" /> <PackageVersion Include="System.Reactive" Version="6.0.0-preview.9" /> <PackageVersion Include="System.Runtime.Caching" Version="8.0.0" /> <PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.0" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" /> <PackageVersion Include="UnicodeInformation" Version="2.6.0" /> <PackageVersion Include="UnitsNet" Version="4.145.0" /> <PackageVersion Include="UTF.Unknown" Version="2.5.1" /> <PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" /> <PackageVersion Include="WinUIEx" Version="2.2.0" /> <PackageVersion Include="WPF-UI" Version="3.0.0-preview.9" /> </ItemGroup> <ItemGroup Condition="'$(IsExperimentationLive)'!=''"> <!-- Additional dependencies used by experimentation --> <PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" /> <PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" /> </ItemGroup> </Project>
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
Using preview analyzers? I'm guessing we can use a released version now?
jaimecbernardo
469
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
Directory.Packages.props
<Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> <ItemGroup> <PackageVersion Include="Appium.WebDriver" Version="4.2.1" /> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" /> <PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Collections " Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" /> <PackageVersion Include="ControlzEx" Version="6.0.0" /> <PackageVersion Include="coverlet.collector" Version="1.3.0" /> <PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" /> <PackageVersion Include="HelixToolkit" Version="2.20.2" /> <PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.20.2" /> <PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" /> <PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" /> <PackageVersion Include="LazyCache" Version="2.4.0" /> <PackageVersion Include="Mages" Version="2.0.1" /> <PackageVersion Include="Markdig.Signed" Version="0.27.0" /> <PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3" /> <PackageVersion Include="Microsoft.Data.Sqlite" Version="7.0.0" /> <PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.336902" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" /> <PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2088.41" /> <PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.3" /> <PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" /> <!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. --> <PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.4" /> <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" /> <PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" /> <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" /> <PackageVersion Include="ModernWpfUI" Version="0.9.4" /> <PackageVersion Include="Moq" Version="4.18.4" /> <PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageVersion Include="MSTest.TestFramework" Version="3.1.1" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" /> <PackageVersion Include="NLog" Version="5.0.4" /> <PackageVersion Include="NLog.Extensions.Logging" Version="5.0.4" /> <PackageVersion Include="NLog.Schema" Version="5.0.4" /> <PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" /> <PackageVersion Include="SharpCompress" Version="0.33.0" /> <PackageVersion Include="StreamJsonRpc" Version="2.14.24" /> <PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" /> <PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageVersion Include="System.ComponentModel.Composition" Version="7.0.0" /> <PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> <PackageVersion Include="System.Data.OleDb" Version="7.0.0" /> <PackageVersion Include="System.Drawing.Common" Version="7.0.0" /> <PackageVersion Include="System.IO.Abstractions" Version="17.2.3" /> <PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" /> <PackageVersion Include="System.Management" Version="7.0.2" /> <PackageVersion Include="System.Reactive" Version="6.0.0-preview.9" /> <PackageVersion Include="System.Runtime.Caching" Version="7.0.0" /> <PackageVersion Include="System.ServiceProcess.ServiceController" Version="7.0.1" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="7.0.0" /> <PackageVersion Include="UnicodeInformation" Version="2.6.0" /> <PackageVersion Include="UnitsNet" Version="4.145.0" /> <PackageVersion Include="UTF.Unknown" Version="2.5.1" /> <PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" /> <PackageVersion Include="WinUIEx" Version="2.2.0" /> <PackageVersion Include="WPF-UI" Version="3.0.0-preview.9" /> </ItemGroup> <ItemGroup Condition="'$(IsExperimentationLive)'!=''"> <!-- Additional dependencies used by experimentation --> <PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" /> <PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" /> </ItemGroup> </Project>
<Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> <ItemGroup> <PackageVersion Include="Appium.WebDriver" Version="4.2.1" /> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" /> <PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Collections " Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.0.230907" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" /> <PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" /> <PackageVersion Include="ControlzEx" Version="6.0.0" /> <PackageVersion Include="coverlet.collector" Version="1.3.0" /> <PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" /> <PackageVersion Include="HelixToolkit" Version="2.20.2" /> <PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.20.2" /> <PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" /> <PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" /> <PackageVersion Include="LazyCache" Version="2.4.0" /> <PackageVersion Include="Mages" Version="2.0.1" /> <PackageVersion Include="Markdig.Signed" Version="0.27.0" /> <PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" /> <PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.0" /> <PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.336902" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" /> <PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2088.41" /> <PackageVersion Include="Microsoft.Windows.Compatibility" Version="8.0.0" /> <PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" /> <!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. --> <PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.4" /> <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" /> <PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" /> <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" /> <PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" /> <PackageVersion Include="ModernWpfUI" Version="0.9.4" /> <PackageVersion Include="Moq" Version="4.18.4" /> <PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageVersion Include="MSTest.TestFramework" Version="3.1.1" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" /> <PackageVersion Include="NLog" Version="5.0.4" /> <PackageVersion Include="NLog.Extensions.Logging" Version="5.0.4" /> <PackageVersion Include="NLog.Schema" Version="5.0.4" /> <PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" /> <PackageVersion Include="SharpCompress" Version="0.33.0" /> <PackageVersion Include="StreamJsonRpc" Version="2.14.24" /> <PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" /> <PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageVersion Include="System.ComponentModel.Composition" Version="8.0.0" /> <PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" /> <PackageVersion Include="System.Data.OleDb" Version="8.0.0" /> <PackageVersion Include="System.Drawing.Common" Version="8.0.0" /> <PackageVersion Include="System.IO.Abstractions" Version="17.2.3" /> <PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" /> <PackageVersion Include="System.Management" Version="8.0.0" /> <PackageVersion Include="System.Reactive" Version="6.0.0-preview.9" /> <PackageVersion Include="System.Runtime.Caching" Version="8.0.0" /> <PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.0" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" /> <PackageVersion Include="UnicodeInformation" Version="2.6.0" /> <PackageVersion Include="UnitsNet" Version="4.145.0" /> <PackageVersion Include="UTF.Unknown" Version="2.5.1" /> <PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" /> <PackageVersion Include="WinUIEx" Version="2.2.0" /> <PackageVersion Include="WPF-UI" Version="3.0.0-preview.9" /> </ItemGroup> <ItemGroup Condition="'$(IsExperimentationLive)'!=''"> <!-- Additional dependencies used by experimentation --> <PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" /> <PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" /> </ItemGroup> </Project>
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
Oh I see they updated it to release version now! I can fix that
snickler
470
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
src/.editorconfig
[*.cs] file_header_template = Copyright (c) Microsoft Corporation\r\nThe Microsoft Corporation licenses this file to you under the MIT license.\r\nSee the LICENSE file in the project root for more information. # SA1201: Elements should appear in the correct order dotnet_diagnostic.SA1201.severity = none # CA1303: Do not pass literals as localized parameters dotnet_diagnostic.CA1303.severity = suggestion # CA1051: Do not declare visible instance fields dotnet_code_quality.ca1051.exclude_structs = true csharp_prefer_simple_using_statement = true:suggestion csharp_prefer_braces = true:silent csharp_style_namespace_declarations = block_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_expression_bodied_methods = false:silent csharp_style_expression_bodied_constructors = false:silent csharp_style_expression_bodied_operators = false:silent csharp_style_expression_bodied_properties = when_on_single_line:suggestion csharp_style_expression_bodied_indexers = true:silent csharp_style_expression_bodied_accessors = true:silent csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent csharp_style_throw_expression = true:suggestion csharp_indent_labels = one_less_than_current csharp_style_prefer_null_check_over_type_check = true:suggestion [*.{cs,vb}] #### Naming styles #### # Naming rules dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion dotnet_naming_rule.types_should_be_pascal_case.symbols = types dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case # Symbol specifications dotnet_naming_symbols.interface.applicable_kinds = interface dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.interface.required_modifiers = dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.types.required_modifiers = dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.non_field_members.required_modifiers = # Naming styles dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.capitalization = pascal_case dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion dotnet_style_prefer_auto_properties = true:silent dotnet_style_object_initializer = false:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_prefer_simplified_boolean_expressions = true:suggestion dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion dotnet_style_prefer_conditional_expression_over_return = true:suggestion dotnet_style_explicit_tuple_names = true:suggestion dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_compound_assignment = true:suggestion dotnet_style_prefer_simplified_interpolation = true:suggestion dotnet_style_namespace_match_folder = true:suggestion dotnet_style_operator_placement_when_wrapping = beginning_of_line tab_width = 4 indent_size = 4 end_of_line = crlf # IDE0065: using directive placement dotnet_diagnostic.IDE0065.severity = none # IDE0009: Add this or Me qualification dotnet_diagnostic.IDE0009.severity = none
[*.cs] file_header_template = Copyright (c) Microsoft Corporation\r\nThe Microsoft Corporation licenses this file to you under the MIT license.\r\nSee the LICENSE file in the project root for more information. # SA1201: Elements should appear in the correct order dotnet_diagnostic.SA1201.severity = none # CA1303: Do not pass literals as localized parameters dotnet_diagnostic.CA1303.severity = suggestion # CA1051: Do not declare visible instance fields dotnet_code_quality.ca1051.exclude_structs = true csharp_prefer_simple_using_statement = true:suggestion csharp_prefer_braces = true:silent csharp_style_namespace_declarations = block_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_expression_bodied_methods = false:silent csharp_style_expression_bodied_constructors = false:silent csharp_style_expression_bodied_operators = false:silent csharp_style_expression_bodied_properties = when_on_single_line:suggestion csharp_style_expression_bodied_indexers = true:silent csharp_style_expression_bodied_accessors = true:silent csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent csharp_style_throw_expression = true:suggestion csharp_indent_labels = one_less_than_current csharp_style_prefer_null_check_over_type_check = true:suggestion [*.{cs,vb}] #### Naming styles #### # Naming rules dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion dotnet_naming_rule.types_should_be_pascal_case.symbols = types dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case # Symbol specifications dotnet_naming_symbols.interface.applicable_kinds = interface dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.interface.required_modifiers = dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.types.required_modifiers = dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.non_field_members.required_modifiers = # Naming styles dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.capitalization = pascal_case dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion dotnet_style_prefer_auto_properties = true:silent dotnet_style_object_initializer = false:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_prefer_simplified_boolean_expressions = true:suggestion dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion dotnet_style_prefer_conditional_expression_over_return = true:suggestion dotnet_style_explicit_tuple_names = true:suggestion dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_compound_assignment = true:suggestion dotnet_style_prefer_simplified_interpolation = true:suggestion dotnet_style_namespace_match_folder = true:suggestion dotnet_style_operator_placement_when_wrapping = beginning_of_line tab_width = 4 indent_size = 4 end_of_line = crlf # IDE0065: using directive placement dotnet_diagnostic.IDE0065.severity = none # IDE0009: Add this or Me qualification dotnet_diagnostic.IDE0009.severity = none # CA1859: Change type for improved performance dotnet_diagnostic.CA1859.severity = none # CA1716: Identifiers should not match keywords dotnet_diagnostic.CA1716.severity = none # SYSLIB1096: Convert to 'GeneratedComInterface' dotnet_diagnostic.SYSLIB1096.severity = silent # CA1309: Use ordinal StringComparison dotnet_diagnostic.CA1309.severity = suggestion # CS1615: Argument may not be passed with the ref keyword dotnet_diagnostic.CS1615.severity = none # CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup dotnet_diagnostic.CA1854.severity = suggestion # CA1860: Avoid using 'Enumerable.Any()' extension method dotnet_diagnostic.CA1860.severity = suggestion # CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array dotnet_diagnostic.CA1861.severity = suggestion # CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons dotnet_diagnostic.CA1862.severity = suggestion # CA1863: Cache a CompositeFormat for repeated use in this formatting operation dotnet_diagnostic.CA1863.severity = none # CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method dotnet_diagnostic.CA1864.severity = suggestion # CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char dotnet_diagnostic.CA1865.severity = suggestion # CA1869: Cache and reuse 'JsonSerializerOptions' instances dotnet_diagnostic.CA1869.severity = none # CA2208: Instantiate argument exceptions correctly dotnet_diagnostic.CA2208.severity = none # CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. dotnet_diagnostic.CS9191.severity = none
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
The changes on this file sound like things we want to tackle. Let's not block the PR on it, but let's create an issue to review these afterwards.
jaimecbernardo
471
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h
#pragma once #include "KeyboardListener.g.h" #include <spdlog/stopwatch.h> #include <mutex> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
#pragma once #include "KeyboardListener.g.h" #include <mutex> #include <spdlog/stopwatch.h> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
duplicate include. there is one 2 lines below :)
stefansjfw
472
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h
#pragma once #include "KeyboardListener.g.h" #include <spdlog/stopwatch.h> #include <mutex> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
#pragma once #include "KeyboardListener.g.h" #include <mutex> #include <spdlog/stopwatch.h> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
I think this was fixed in the pr and in main in parallel 😆
jaimecbernardo
473
microsoft/PowerToys
28,655
🚧 [Dev][Build] .NET 8 Upgrade
<!-- 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 Initial .NET 8 Upgrade. As of now this is targeting .NET 8 RC1 and requires Visual Studio 17.8 to build. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #28016 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 The following changes have been made: - [X] Update TFMs to net8.0 - [X] Update .NET Runtime-related NuGet packages to 8.x - [X] New Breaking Analyzers silenced: - [X] SYSLIB1096: Convert to 'GeneratedComInterface' - [X] CA1309: Use ordinal StringComparison - [X] CS1615: Argument may not be passed with the ref keyword - [X] CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup - [X] CA1860: Avoid using 'Enumerable.Any()' extension method - [X] CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array - [X] CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons - [X] CA1863: Cache a CompositeFormat for repeated use in this formatting operation - [X] CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - [X] CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char - [X] CA1869: Cache and reuse 'JsonSerializerOptions' instances - [X] CA2208: Instantiate argument exceptions correctly - [X] CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. - [X] Update RIDs to use `win-` instead of `win10-` per changes with .NET 8 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Built local debug and release. Built test installation packages and verified works between x64 and arm64. - Unit tests succeed.
null
2023-09-20 15:57:30+00:00
2023-11-22 17:47:00+00:00
src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h
#pragma once #include "KeyboardListener.g.h" #include <spdlog/stopwatch.h> #include <mutex> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
#pragma once #include "KeyboardListener.g.h" #include <mutex> #include <spdlog/stopwatch.h> namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { enum PowerAccentActivationKey { LeftRightArrow, Space, Both, }; struct PowerAccentSettings { PowerAccentActivationKey activationKey{ PowerAccentActivationKey::Both }; std::chrono::milliseconds inputTime{ 300 }; // Should match with UI.Library.PowerAccentSettings.DefaultInputTimeMs std::vector<std::wstring> excludedApps; }; struct KeyboardListener : KeyboardListenerT<KeyboardListener> { using LetterKey = winrt::PowerToys::PowerAccentKeyboardService::LetterKey; using TriggerKey = winrt::PowerToys::PowerAccentKeyboardService::TriggerKey; using InputType = winrt::PowerToys::PowerAccentKeyboardService::InputType; KeyboardListener(); void KeyboardListener::InitHook(); void KeyboardListener::UnInitHook(); void SetShowToolbarEvent(ShowToolbar showToolbarEvent); void SetHideToolbarEvent(HideToolbar hideToolbarEvent); void SetNextCharEvent(NextChar NextCharEvent); void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate); void UpdateActivationKey(int32_t activationKey); void UpdateInputTime(int32_t inputTime); void UpdateExcludedApps(std::wstring_view excludedApps); static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); private: bool OnKeyDown(KBDLLHOOKSTRUCT info) noexcept; bool OnKeyUp(KBDLLHOOKSTRUCT info) noexcept; bool IsForegroundAppExcluded(); static inline KeyboardListener* s_instance; HHOOK s_llKeyboardHook = nullptr; bool m_toolbarVisible; PowerAccentSettings m_settings; std::function<void(LetterKey)> m_showToolbarCb; std::function<void(InputType)> m_hideToolbarCb; std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<bool(LetterKey)> m_isLanguageLetterCb; bool m_triggeredWithSpace; bool m_triggeredWithLeftArrow; bool m_triggeredWithRightArrow; spdlog::stopwatch m_stopwatch; bool m_leftShiftPressed; bool m_rightShiftPressed; std::mutex m_mutex_excluded_apps; std::pair<HWND, bool> m_prevForegroundAppExcl{ NULL, false }; static inline const std::vector<LetterKey> letters = { LetterKey::VK_0, LetterKey::VK_1, LetterKey::VK_2, LetterKey::VK_3, LetterKey::VK_4, LetterKey::VK_5, LetterKey::VK_6, LetterKey::VK_7, LetterKey::VK_8, LetterKey::VK_9, LetterKey::VK_A, LetterKey::VK_B, LetterKey::VK_C, LetterKey::VK_D, LetterKey::VK_E, LetterKey::VK_F, LetterKey::VK_G, LetterKey::VK_H, LetterKey::VK_I, LetterKey::VK_J, LetterKey::VK_K, LetterKey::VK_L, LetterKey::VK_M, LetterKey::VK_N, LetterKey::VK_O, LetterKey::VK_P, LetterKey::VK_Q, LetterKey::VK_R, LetterKey::VK_S, LetterKey::VK_T, LetterKey::VK_U, LetterKey::VK_V, LetterKey::VK_W, LetterKey::VK_X, LetterKey::VK_Y, LetterKey::VK_Z, LetterKey::VK_COMMA, LetterKey::VK_PERIOD, LetterKey::VK_MINUS, LetterKey::VK_SLASH_, LetterKey::VK_DIVIDE_, LetterKey::VK_MULTIPLY_, }; LetterKey letterPressed{}; static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space }; }; } namespace winrt::PowerToys::PowerAccentKeyboardService::factory_implementation { struct KeyboardListener : KeyboardListenerT<KeyboardListener, implementation::KeyboardListener> { }; }
snickler
b41129d4890ea694325e56e55d776a06fb190d8f
b2b2856e5292767214239c2fb0517a9083129ac2
I've added a commit to address the feedback. Thank you!
jaimecbernardo
474
microsoft/PowerToys
28,601
[PT Run > PluginAdditionalOptions] Refactoring and more settings types
<!-- 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 PR ... - refactors the class to make things more simple. - fixes the layout of combo box settings in UI. - adds the types TextBox and NumberBoxe. - adds the possibility to combine a Checkbox setting with the other settings types. - reduces the file size of settings.json with ignoring null value properties. (5 KB smaller) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #14267, #28597 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 **ComboBox layout before** ![image](https://github.com/microsoft/PowerToys/assets/61519853/3d1c78d0-5806-4e00-9224-5183a086fead) **ComboBox layout after** ![image](https://github.com/microsoft/PowerToys/assets/61519853/59661fa2-c981-4052-ad20-2c508648648a) **Number and text setting** ![image](https://github.com/microsoft/PowerToys/assets/61519853/c3ed07b7-a5b4-458c-ae8e-17b5f03c7213) **Combined setting: Checkbox checked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/b75921fc-e426-4182-b90e-dc875e136b40) **Combined setting: Checkbox unchecked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/57fc35e4-dfe2-4ca9-a38d-1d0d9eb1f83b) <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Manually tested and everything works fine.
null
2023-09-17 17:29:01+00:00
2023-09-20 17:31:41+00:00
src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <StackPanel Orientation="Vertical"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}" /> <ComboBox Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=Option, Mode=TwoWay}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}" /> </StackPanel> </controls:SettingsCard> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <!-- Checkbox setting --> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <!-- ComboBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- TextBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowTextBox, Converter={StaticResource BoolToVisibilityConverter}}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- NumberBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowNumberBox, Converter={StaticResource BoolToVisibilityConverter}}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- Checkbox And ComboBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndCombobox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And TextBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndTextbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And NumberBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndNumberbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Separator line --> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
htcfreek
5ddd8d72ddd2fb488ae517f190a967b36f681504
59f0ccebc7b360735b72651a733f9fffc7b85135
Note to me: For combined version in seperate settings card group update left padding to match with checkbox text and top padding to zero. (Same on TextBox and NumberBox.)
htcfreek
475
microsoft/PowerToys
28,601
[PT Run > PluginAdditionalOptions] Refactoring and more settings types
<!-- 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 PR ... - refactors the class to make things more simple. - fixes the layout of combo box settings in UI. - adds the types TextBox and NumberBoxe. - adds the possibility to combine a Checkbox setting with the other settings types. - reduces the file size of settings.json with ignoring null value properties. (5 KB smaller) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #14267, #28597 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 **ComboBox layout before** ![image](https://github.com/microsoft/PowerToys/assets/61519853/3d1c78d0-5806-4e00-9224-5183a086fead) **ComboBox layout after** ![image](https://github.com/microsoft/PowerToys/assets/61519853/59661fa2-c981-4052-ad20-2c508648648a) **Number and text setting** ![image](https://github.com/microsoft/PowerToys/assets/61519853/c3ed07b7-a5b4-458c-ae8e-17b5f03c7213) **Combined setting: Checkbox checked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/b75921fc-e426-4182-b90e-dc875e136b40) **Combined setting: Checkbox unchecked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/57fc35e4-dfe2-4ca9-a38d-1d0d9eb1f83b) <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Manually tested and everything works fine.
null
2023-09-17 17:29:01+00:00
2023-09-20 17:31:41+00:00
src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <StackPanel Orientation="Vertical"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}" /> <ComboBox Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=Option, Mode=TwoWay}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}" /> </StackPanel> </controls:SettingsCard> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <!-- Checkbox setting --> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <!-- ComboBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- TextBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowTextBox, Converter={StaticResource BoolToVisibilityConverter}}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- NumberBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowNumberBox, Converter={StaticResource BoolToVisibilityConverter}}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- Checkbox And ComboBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndCombobox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And TextBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndTextbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And NumberBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndNumberbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Separator line --> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
htcfreek
5ddd8d72ddd2fb488ae517f190a967b36f681504
59f0ccebc7b360735b72651a733f9fffc7b85135
Note to me: Comment which settings type follows. (Same for the other ones.)
htcfreek
476
microsoft/PowerToys
28,601
[PT Run > PluginAdditionalOptions] Refactoring and more settings types
<!-- 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 PR ... - refactors the class to make things more simple. - fixes the layout of combo box settings in UI. - adds the types TextBox and NumberBoxe. - adds the possibility to combine a Checkbox setting with the other settings types. - reduces the file size of settings.json with ignoring null value properties. (5 KB smaller) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #14267, #28597 - [x] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 **ComboBox layout before** ![image](https://github.com/microsoft/PowerToys/assets/61519853/3d1c78d0-5806-4e00-9224-5183a086fead) **ComboBox layout after** ![image](https://github.com/microsoft/PowerToys/assets/61519853/59661fa2-c981-4052-ad20-2c508648648a) **Number and text setting** ![image](https://github.com/microsoft/PowerToys/assets/61519853/c3ed07b7-a5b4-458c-ae8e-17b5f03c7213) **Combined setting: Checkbox checked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/b75921fc-e426-4182-b90e-dc875e136b40) **Combined setting: Checkbox unchecked** (Example) ![image](https://github.com/microsoft/PowerToys/assets/61519853/57fc35e4-dfe2-4ca9-a38d-1d0d9eb1f83b) <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Manually tested and everything works fine.
null
2023-09-17 17:29:01+00:00
2023-09-20 17:31:41+00:00
src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <StackPanel Orientation="Vertical"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}" /> <ComboBox Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=Option, Mode=TwoWay}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}" /> </StackPanel> </controls:SettingsCard> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:custom="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> <custom:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PowerLauncher.png"> <custom:SettingsPageControl.ModuleContent> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <controls:SettingsCard x:Uid="PowerLauncher_EnablePowerLauncher" HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/FluentIcons/FluentIconsPowerToysRun.png}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnablePowerLauncher, Mode=TwoWay}" /> </controls:SettingsCard> <InfoBar x:Uid="GPO_IsSettingForced" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" Severity="Informational" /> <custom:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}" IsExpanded="True"> <custom:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCentralizedKeyboardHook}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </custom:SettingsGroup> <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" /> <Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole" HorizontalAlignment="Left" Margin="{StaticResource SmallTopMargin}" HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" Margin="{StaticResource SmallTopMargin}" IsChecked="False" IsEnabled="False" />--> <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" Margin="{StaticResource SmallTopMargin}" IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryResultsWithDelay" HeaderIcon="{ui:FontIcon Glyph=&#xec48;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="500" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelayFast}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_MaximumNumberOfResults" HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}" IsExpanded="True"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" Minimum="1" SpinButtonPlacementMode="Compact" Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}" /> <controls:SettingsExpander.Items> <controls:SettingsCard ContentAlignment="Left"> <CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsExpander x:Uid="PowerLauncher_SearchQueryTuningEnabled" HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}" IsExpanded="True"> <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}" /> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="0" SmallChange="5" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"> <custom:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}" /> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> <controls:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE98A;}"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"> <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" /> </controls:SettingsCard> </custom:SettingsGroup> <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchResultPreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" /> <ComboBox x:Uid="PowerLauncher_SearchTypePreference" MinWidth="320" Margin="{StaticResource SmallTopMargin}" ItemsSource="{Binding searchTypePreferencesOptions}" SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}" SelectedValuePath="Item2" DisplayMemberPath="Item1" IsEnabled="False" />--> <custom:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.MonitorPositionIndex}"> <ComboBoxItem x:Uid="Run_Radio_Position_Cursor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" /> <ComboBoxItem x:Uid="Run_Radio_Position_Focus" /> </ComboBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}"> <controls:SettingsCard.Description> <HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" /> </controls:SettingsCard.Description> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"> <ComboBoxItem x:Uid="Radio_Theme_Dark" /> <ComboBoxItem x:Uid="Radio_Theme_Light" /> <ComboBoxItem x:Uid="Radio_Theme_Default" /> </ComboBox> </controls:SettingsCard> </custom:SettingsGroup> <custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"> <InfoBar x:Uid="Run_ConflictingKeywordInfo" IsClosable="False" IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" Severity="Informational"> <InfoBar.ActionButton> <HyperlinkButton x:Uid="Run_ConflictingKeywordInfo_Link" NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands" /> </InfoBar.ActionButton> </InfoBar> <controls:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}"> <controls:SettingsCard.Description> <StackPanel> <TextBlock x:Uid="Run_PluginUseDescription" /> <HyperlinkButton x:Uid="Run_PluginUseFindMorePlugins" NavigateUri="https://aka.ms/powerToysRunPlugins" /> </StackPanel> </controls:SettingsCard.Description> <AutoSuggestBox x:Uid="PowerLauncher_SearchList" MinWidth="{StaticResource SettingActionControlMinWidth}" QueryIcon="Find" Text="{x:Bind ViewModel.SearchText, Mode=TwoWay}"> <i:Interaction.Behaviors> <ic:EventTriggerBehavior EventName="TextChanged"> <ic:InvokeCommandAction Command="{x:Bind ViewModel.SearchPluginsCommand}" /> </ic:EventTriggerBehavior> </i:Interaction.Behaviors> </AutoSuggestBox> </controls:SettingsCard> <InfoBar x:Uid="Run_AllPluginsDisabled" IsClosable="False" IsOpen="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowAllPluginsDisabledWarning, Mode=OneWay}" Severity="Error" /> <StackPanel Orientation="Horizontal" Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> <ProgressRing Width="20" Height="20" Margin="18,18" IsActive="True" /> <TextBlock x:Uid="Run_PluginsLoading" VerticalAlignment="Center" Style="{ThemeResource SecondaryTextStyle}" /> </StackPanel> <ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Spacing="2" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <Grid> <controls:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}"> <controls:SettingsExpander.HeaderIcon> <BitmapIcon UriSource="{x:Bind IconPath}" /> </controls:SettingsExpander.HeaderIcon> <StackPanel Orientation="Horizontal" Spacing="16"> <!-- todo(Stefan): InfoBadge not available <InfoBadge AutomationProperties.AccessibilityView="Raw" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" Style="{StaticResource CriticalIconInfoBadgeStyle}" /> --> <!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.) --> <Grid> <!-- Error badge --> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}" /> </Grid> <ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}" /> </StackPanel> <controls:SettingsExpander.Items> <controls:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind Path=ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> </controls:SettingsCard> <controls:SettingsCard Padding="0,-4,0,0" HorizontalContentAlignment="Left" Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}" ContentAlignment="Vertical" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"> <InfoBar x:Uid="Run_NotAccessibleWarning" Margin="3,0,0,0" Background="Transparent" BorderBrush="Transparent" IsClosable="False" IsOpen="True" IsTabStop="{x:Bind ShowNotAccessibleWarning}" Severity="Error" /> </controls:SettingsCard> <controls:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> <CheckBox Margin="0,-8,0,0" AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}" IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"> <StackPanel Orientation="Vertical"> <TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" /> <custom:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription" FontSize="{StaticResource SecondaryTextFontSize}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> </StackPanel> </CheckBox> </controls:SettingsCard> <controls:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="50" Maximum="1000" Minimum="-1000" SmallChange="10" SpinButtonPlacementMode="Compact" Value="{x:Bind Mode=TwoWay, Path=WeightBoost}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" HorizontalContentAlignment="Stretch" ContentAlignment="Vertical"> <controls:SettingsCard.Resources> <Thickness x:Key="SettingsCardPadding">0</Thickness> <Thickness x:Key="SettingsExpanderItemPadding">0,0,0,0</Thickness> </controls:SettingsCard.Resources> <ItemsControl Margin="0,-6,0,0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{x:Bind Enabled, Mode=OneWay}" ItemsSource="{x:Bind Path=AdditionalOptions}"> <ItemsControl.ItemTemplate> <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel"> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"> <!-- Checkbox setting --> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,12" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0" Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <!-- ComboBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- TextBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowTextBox, Converter={StaticResource BoolToVisibilityConverter}}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- NumberBox setting --> <controls:SettingsCard MinHeight="0" Margin="56,8,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" Visibility="{x:Bind Path=ShowNumberBox, Converter={StaticResource BoolToVisibilityConverter}}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> <!-- Checkbox And ComboBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndCombobox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" ItemsSource="{x:Bind Path=ComboBoxOptions}" SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And TextBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndTextbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" MaxWidth="450" MaxLength="{x:Bind Path=TextBoxMaxLength, Mode=OneWay}" Text="{x:Bind Path=TextValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Checkbox And NumberBox setting --> <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Visibility="{x:Bind Path=ShowCheckboxAndNumberbox, Converter={StaticResource BoolToVisibilityConverter}}"> <controls:SettingsCard MinHeight="0" Margin="1" Padding="0,6,0,4" Background="Transparent" BorderThickness="0,0,0,0" ContentAlignment="Left" CornerRadius="0"> <custom:CheckBoxWithDescriptionControl Margin="56,0,0,0" Description="{x:Bind Path=DisplayDescription}" Header="{x:Bind Path=DisplayLabel}" IsChecked="{x:Bind Path=Value, Mode=TwoWay}" /> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" Margin="84,0,45,8" Background="Transparent" BorderThickness="0,0,0,0" CornerRadius="0" Description="{x:Bind Path=SecondDisplayDescription}" Header="{x:Bind Path=SecondDisplayLabel}" IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}"> <NumberBox MinWidth="{StaticResource SettingActionControlMinWidth}" LargeChange="{x:Bind Path=NumberBoxLargeChange, Mode=OneWay}" Maximum="{x:Bind Path=NumberBoxMax, Mode=OneWay}" Minimum="{x:Bind Path=NumberBoxMin, Mode=OneWay}" SmallChange="{x:Bind Path=NumberBoxSmallChange, Mode=OneWay}" SpinButtonPlacementMode="Compact" Value="{x:Bind Path=NumberValue, Mode=TwoWay}" /> </controls:SettingsCard> </StackPanel> <!-- Separator line --> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource CardStrokeColorDefaultBrush}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </controls:SettingsCard> <controls:SettingsCard MinHeight="0" BorderThickness="0" ContentAlignment="Right"> <TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}"> <Run x:Uid="PowerLauncher_AuthoredBy" /> <Run FontWeight="SemiBold" Text="{x:Bind Author}" /> </TextBlock> </controls:SettingsCard> </controls:SettingsExpander.Items> </controls:SettingsExpander> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </custom:SettingsGroup> </StackPanel> </custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.PrimaryLinks> <custom:PageLink x:Uid="LearnMore_Run" Link="https://aka.ms/PowerToysOverview_PowerToysRun" /> <custom:PageLink x:Uid="Run_FindMorePlugins" Link="https://aka.ms/powerToysRunPlugins" /> </custom:SettingsPageControl.PrimaryLinks> <custom:SettingsPageControl.SecondaryLinks> <custom:PageLink Link="https://github.com/Wox-launcher/Wox/" Text="Wox" /> <custom:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" /> </custom:SettingsPageControl.SecondaryLinks> </custom:SettingsPageControl> </Page>
htcfreek
5ddd8d72ddd2fb488ae517f190a967b36f681504
59f0ccebc7b360735b72651a733f9fffc7b85135
@niels9001 Maybe we should do this for all TextBox controls.
htcfreek
477
microsoft/PowerToys
28,538
[Run] Fluent UX
## Summary of the Pull Request This PR moves Run from `ModernWpf` to `WpfUI`, and introduces the following changes: - Brand new UX that is more inline with the Windows 11 Design Language. (#12182) - Acrylic backdrop! - When the searchbox is empty (+ zero state) an overview is shown with all activated plugins and trigger commands. (#11591) - Updating all plugin icons to Segoe Fluent Icons. - The default size is now a bit smaller, while showing more results! - We no longer use a transparent window, which should make it easier to implement things like #12654. Open questions / to-do's: - Can we use `ThemeManager` without `ModernWpf` (and remove that dependency)? - VS Workspaces plugin dark/light icon support - This needs proper testing on Windows 10 vs. 11. ![RunVNext2](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055) Before vs. after: ![Frame 1010108473](https://github.com/microsoft/PowerToys/assets/9866362/42d6b618-e055-4fc6-871e-782e3911804e) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #12182, #10441, #11591, #12099, #15702 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
null
2023-09-13 13:27:08+00:00
2023-11-20 10:23:27+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; bitmap1.SetResolution(144, 144); using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
niels9001
67b18d0e987cf0be9dec6d2bb260c066036e4b2d
c095cdde4ed1c10a8cc753a2a2d32b44d50668b9
@jaimecbernardo This would need to be theme aware.. hardcoded it now as these were colored icons, but not sure why?
niels9001
478
microsoft/PowerToys
28,538
[Run] Fluent UX
## Summary of the Pull Request This PR moves Run from `ModernWpf` to `WpfUI`, and introduces the following changes: - Brand new UX that is more inline with the Windows 11 Design Language. (#12182) - Acrylic backdrop! - When the searchbox is empty (+ zero state) an overview is shown with all activated plugins and trigger commands. (#11591) - Updating all plugin icons to Segoe Fluent Icons. - The default size is now a bit smaller, while showing more results! - We no longer use a transparent window, which should make it easier to implement things like #12654. Open questions / to-do's: - Can we use `ThemeManager` without `ModernWpf` (and remove that dependency)? - VS Workspaces plugin dark/light icon support - This needs proper testing on Windows 10 vs. 11. ![RunVNext2](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055) Before vs. after: ![Frame 1010108473](https://github.com/microsoft/PowerToys/assets/9866362/42d6b618-e055-4fc6-871e-782e3911804e) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #12182, #10441, #11591, #12099, #15702 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
null
2023-09-13 13:27:08+00:00
2023-11-20 10:23:27+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; bitmap1.SetResolution(144, 144); using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
niels9001
67b18d0e987cf0be9dec6d2bb260c066036e4b2d
c095cdde4ed1c10a8cc753a2a2d32b44d50668b9
I see, perhaps we need to do it like on other plugins. Return depending on theme, like in https://github.com/microsoft/PowerToys/commit/4d48677ad71faa4c9ddbffa39ed1314e3f1b08b4
jaimecbernardo
479
microsoft/PowerToys
28,538
[Run] Fluent UX
## Summary of the Pull Request This PR moves Run from `ModernWpf` to `WpfUI`, and introduces the following changes: - Brand new UX that is more inline with the Windows 11 Design Language. (#12182) - Acrylic backdrop! - When the searchbox is empty (+ zero state) an overview is shown with all activated plugins and trigger commands. (#11591) - Updating all plugin icons to Segoe Fluent Icons. - The default size is now a bit smaller, while showing more results! - We no longer use a transparent window, which should make it easier to implement things like #12654. Open questions / to-do's: - Can we use `ThemeManager` without `ModernWpf` (and remove that dependency)? - VS Workspaces plugin dark/light icon support - This needs proper testing on Windows 10 vs. 11. ![RunVNext2](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055) Before vs. after: ![Frame 1010108473](https://github.com/microsoft/PowerToys/assets/9866362/42d6b618-e055-4fc6-871e-782e3911804e) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #12182, #10441, #11591, #12099, #15702 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
null
2023-09-13 13:27:08+00:00
2023-11-20 10:23:27+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; bitmap1.SetResolution(144, 144); using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
niels9001
67b18d0e987cf0be9dec6d2bb260c066036e4b2d
c095cdde4ed1c10a8cc753a2a2d32b44d50668b9
When I compare to the old icon, this looks somewhat worse: ![image](https://github.com/microsoft/PowerToys/assets/26118718/00c645f2-50a4-4c6b-96a5-b54ec5d26f0c) ![image](https://github.com/microsoft/PowerToys/assets/26118718/30cd93bd-6967-45c5-bf91-ecc0e69a6e60) Comparing to the old one: ![image](https://github.com/microsoft/PowerToys/assets/26118718/c11b1c75-9514-4e60-93a8-58dc6c80a255)
jaimecbernardo
480
microsoft/PowerToys
28,538
[Run] Fluent UX
## Summary of the Pull Request This PR moves Run from `ModernWpf` to `WpfUI`, and introduces the following changes: - Brand new UX that is more inline with the Windows 11 Design Language. (#12182) - Acrylic backdrop! - When the searchbox is empty (+ zero state) an overview is shown with all activated plugins and trigger commands. (#11591) - Updating all plugin icons to Segoe Fluent Icons. - The default size is now a bit smaller, while showing more results! - We no longer use a transparent window, which should make it easier to implement things like #12654. Open questions / to-do's: - Can we use `ThemeManager` without `ModernWpf` (and remove that dependency)? - VS Workspaces plugin dark/light icon support - This needs proper testing on Windows 10 vs. 11. ![RunVNext2](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055) Before vs. after: ![Frame 1010108473](https://github.com/microsoft/PowerToys/assets/9866362/42d6b618-e055-4fc6-871e-782e3911804e) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #12182, #10441, #11591, #12099, #15702 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **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 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
null
2023-09-13 13:27:08+00:00
2023-11-20 10:23:27+00:00
src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/VSCodeHelper/VSCodeInstances.cs
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
// 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.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Media.Imaging; namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper { public static class VSCodeInstances { private static readonly string _userAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); public static List<VSCodeInstance> Instances { get; set; } = new List<VSCodeInstance>(); private static BitmapImage Bitmap2BitmapImage(Bitmap bitmap) { using (var memory = new MemoryStream()) { bitmap.Save(memory, ImageFormat.Png); memory.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = memory; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static Bitmap BitmapOverlayToCenter(Bitmap bitmap1, Bitmap overlayBitmap) { int bitmap1Width = bitmap1.Width; int bitmap1Height = bitmap1.Height; bitmap1.SetResolution(144, 144); using Bitmap overlayBitmapResized = new Bitmap(overlayBitmap, new System.Drawing.Size(bitmap1Width / 2, bitmap1Height / 2)); float marginLeft = (float)((bitmap1Width * 0.7) - (overlayBitmapResized.Width * 0.5)); float marginTop = (float)((bitmap1Height * 0.7) - (overlayBitmapResized.Height * 0.5)); Bitmap finalBitmap = new Bitmap(bitmap1Width, bitmap1Height); using (Graphics g = Graphics.FromImage(finalBitmap)) { g.DrawImage(bitmap1, System.Drawing.Point.Empty); g.DrawImage(overlayBitmapResized, marginLeft, marginTop); } return finalBitmap; } // Gets the executablePath and AppData foreach instance of VSCode public static void LoadVSCodeInstances() { var environmentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty; environmentPath += (environmentPath.Length > 0 && environmentPath.EndsWith(';') ? string.Empty : ";") + Environment.GetEnvironmentVariable("PATH") ?? string.Empty; var paths = environmentPath .Split(';') .Distinct() .Where(x => x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var path in paths) { if (!Directory.Exists(path)) { continue; } var files = Directory.GetFiles(path) .Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); // Remove the trailing backslash to always get the correct path var iconPath = Path.GetDirectoryName(path.TrimEnd('\\')); if (files.Length == 0) { continue; } var file = files[0]; var version = string.Empty; var instance = new VSCodeInstance { ExecutablePath = file, }; if (file.EndsWith("code", StringComparison.OrdinalIgnoreCase)) { version = "Code"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("code-insiders", StringComparison.OrdinalIgnoreCase)) { version = "Code - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } else if (file.EndsWith("code-exploration", StringComparison.OrdinalIgnoreCase)) { version = "Code - Exploration"; instance.VSCodeVersion = VSCodeVersion.Exploration; } else if (file.EndsWith("codium", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium"; instance.VSCodeVersion = VSCodeVersion.Stable; } else if (file.EndsWith("codium-insiders", StringComparison.OrdinalIgnoreCase)) { version = "VSCodium - Insiders"; instance.VSCodeVersion = VSCodeVersion.Insiders; } if (string.IsNullOrEmpty(version)) { continue; } var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var vsCodeIconPath = Path.Join(iconPath, $"{version}.exe"); if (!File.Exists(vsCodeIconPath)) { continue; } var vsCodeIcon = Icon.ExtractAssociatedIcon(vsCodeIconPath); if (vsCodeIcon == null) { continue; } using var vsCodeIconBitmap = vsCodeIcon.ToBitmap(); // Workspace using var folderIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//folder.png")); using var bitmapFolderIcon = BitmapOverlayToCenter(folderIcon, vsCodeIconBitmap); instance.WorkspaceIconBitMap = Bitmap2BitmapImage(bitmapFolderIcon); // Remote using var monitorIcon = (Bitmap)Image.FromFile(Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images//monitor.png")); using var bitmapMonitorIcon = BitmapOverlayToCenter(monitorIcon, vsCodeIconBitmap); instance.RemoteIconBitMap = Bitmap2BitmapImage(bitmapMonitorIcon); Instances.Add(instance); } } } }
niels9001
67b18d0e987cf0be9dec6d2bb260c066036e4b2d
c095cdde4ed1c10a8cc753a2a2d32b44d50668b9
@jaimecbernardo Thanks! I have reverted back to colored icons, but I have updated them with assets used by W11 and decreased the dimensions (from 240px to 48px) to be similiar to all the other icon plugins. ![image](https://github.com/microsoft/PowerToys/assets/9866362/ab5604fb-e0f9-4325-bdc3-ebb6e2afc19c)
niels9001
481