From ac0677bdeecc398a6763a2850d1052cfe15fc7b9 Mon Sep 17 00:00:00 2001 From: Ethan Fang <117125208+ethan-fang-MS@users.noreply.github.com> Date: Sun, 27 Aug 2023 10:33:44 -0500 Subject: [PATCH 01/20] Updated Release Notes for KBM Note (#28131) * Added 'Paste as Plain Text' to the GitHub Issue Template selection drop down * Update version placeholder too * Adds Mouse Without Borders as area option in issue templates & updates placeholder PowerToys version * Updated Release Notes for KBM * Update README.md * Update README.md --------- Co-authored-by: Jaime Bernardo Co-authored-by: Clint Rutkas --- README.md | 135 +++++++++--------------------------------------------- 1 file changed, 22 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index ce589d18d7..e279457c05 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline Go to [Microsoft PowerToys GitHub releases page][github-release-link], 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. -[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46 -[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F45 -[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-x64.exe -[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-arm64.exe -[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-x64.exe -[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-arm64.exe +[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.72.0-x64.exe][ptUserX64] | 9925894D797458C78A8C3DF6FE4BD748580638B01BB43680477763662915109A | -| Per user - ARM64 | [PowerToysUserSetup-0.72.0-arm64.exe][ptUserArm64] | 2E68139C22C56648E64514E4E8E0A0D12882F6CF30B48EB20ECC66B4CCDD5909 | -| Machine wide - x64 | [PowerToysSetup-0.72.0-x64.exe][ptMachineX64] | 788EE4D828169F092737A739030B218CEFEC79583E42858BB8F9F036B701BE6F | -| Machine wide - ARM64 | [PowerToysSetup-0.72.0-arm64.exe][ptMachineArm64] | 39C1D430A538B0F3D7869D39DF7F636A64AAFAD8DFB3C82059A97F4EBD3369C4 | +| Per user - x64 | [PowerToysUserSetup-0.73.0-x64.exe][ptUserX64] | XXX | +| Per user - ARM64 | [PowerToysUserSetup-0.73.0-arm64.exe][ptUserArm64] | XXX | +| Machine wide - x64 | [PowerToysSetup-0.73.0-x64.exe][ptMachineX64] | XXX | +| Machine wide - ARM64 | [PowerToysSetup-0.73.0-arm64.exe][ptMachineArm64] | XXX | This is our preferred method. @@ -97,130 +97,39 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/ Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on. -### 0.72 - July 2023 Update +### 0.73 - August 2023 Update -In this release, we focused on stability and improvements. +In this release, we focused on XXX. **Highlights** - - Greatly reduced the PowerToys installed space by having utilities share the same installed path. When compared to 0.71, the 0.72 x64 machine installed version of PowerToys reduces the size reported in the Installed Apps screen from 1.15GB to 785 MB and the size in File Explorer properties for the installation folder from 3.10GB to 554 MB. - - Value Generator - A new PowerToys Run plugin that generates hashes and GUID values. Thanks [@IHorvalds](https://github.com/IHorvalds)! - - Mouse Highlighter has a new feature to have a highlight always follow the mouse pointer. Thanks [@hayatogh](https://github.com/hayatogh)! - - PowerRename was reworked to support a bigger number of files without crashing. + - Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. ### Known issues +# validate are these still issues + - Due to changing paths in the installation folder, the Mouse Without Borders service might be pointing to the wrong place. Users not running as admin will have to enable service mode again after install. A toast notification will appear if Mouse Without Borders is unable to start the service correctly. - File Explorer extensions changed paths might not be loaded correctly until File Explorer and Preview Host processes are restarted, so we advise restarting the computer when possible after updating PowerToys. ### General - - Shared dependencies between applications in order to greatly reduce the installed size. - - Added missing icons and icon sizes. Thanks [@niels9001](https://github.com/niels9001)! + - XXX -### FancyZones +### Keyboard Manager - - Fixed an issue where FancyZones wouldn't register a change to the "Switch between windows in the current zone" setting. - - Added a Setting to enable the behavior of clicking the middle mouse button to toggle multiple zone spanning. + - Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. -### File Locksmith - - - Fixed a File Explorer crash when deleting a file, updating PowerToys and then trying to right-click the background of a folder in File Explorer. - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - -### File Explorer add-ons - - - Updated the Monaco dependency for Developer Files Preview, supporting new file extensions and fixing issues. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - -### Hosts File Editor - - - Consolidated the way the Hosts application is launched. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - -### Installer - - - Refactored the Monaco dependency inclusion. What to install is now being generated automatically. - - Removed hardlinks and simplified the installer files, now that many utilities use the same paths. - -### Mouse Highlighter - - - Added a feature so that a highlight follows the mouse even if no mouse button is being pressed. Thanks [@hayatogh](https://github.com/hayatogh)! - -### Mouse Pointer Crosshairs - - - Added a setting to hide the crosshairs when the mouse pointer is also hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Added a setting to select a fixed length for the crosshairs, which also spans across screens. Thanks [@Epp-code](https://github.com/Epp-code)! - -### Mouse Without Borders - - - Switched to a UWP mouse input API to fix mouse pointer lag issues that were reported. - - A toast notification will appear when the service can't be started and Mouse Without Borders will try to start in non-service mode instead. - - Fixed a bug where the service path wouldn't update to the new binary path when trying to re-enable service mode. - - Fixed some grammar errors in the Mouse Without Borders user facing strings. Thanks [@KhurramJalil](https://github.com/KhurramJalil)! - - Allow changing the shortcuts in the same way as other utilities and changed them to better defaults to avoid conflicting with Alt Gr+letter combos on international layouts. - -### Peek - - - Also benefits from the Monaco dependency update when peeking into files supported by the Developer Files Preview. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - - Fixed a flash on PowerToys starting due to the Peek window activating and hiding right away. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Updated icon design. Thanks [@niels9001](https://github.com/niels9001)! - - Fixed flipped content issues on systems with RTL languages. - -### PowerRename - - - Reworked the UI and resource consumption to fix crashes and hangs when trying to rename a huge number of files. - - Added the Mica background material and some UI tweaks. Thanks [@niels9001](https://github.com/niels9001)! - -### PowerToys Run - - - New plugin: Value Generator - generates values like hashes and GUIDs. Thanks [@IHorvalds](https://github.com/IHorvalds)! - - The default input smoothing values were changed to the recommended values. Thanks [@SamMercer172](https://github.com/SamMercer172)! - - Fixed tab navigation issues when using Shift+Tab to go backwards. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Fixed a crash caused by images not being found in the image cache due to racing conditions. - - Fixed synchronization issues in the WindowWalker plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Fixed a synchronization crash when getting localized system paths. - - The PowerToys plugin is now activated by default. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - -### Quick Accent - - Added the ("ḍ", U+1E0D) unicode character. Thanks [@SamMercer172](https://github.com/SamMercer172)! - - Fixed an issue causing the left and right keys being discarded even when Quick Accent didn't activate. - -### Registry Preview - - - Fixed a bug causing DWORD values to not be shown correctly. Thanks [@randyrants](https://github.com/randyrants)! - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - -### Runner - - - Show a warning asking the user to restart the computer after updating the PowerToys version. - -### Screen Ruler - - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - -### Settings - - - Fix an unused Expander in the File Locksmith settings page. - - Added an info box to better explain what the extended context menu is. ### Development - - Projects were restructured to allow sharing the same folder and dependencies and to avoid resource name conflicts. - - Added scripts to CI to guard against applications having conflicting resources. - - Added scripts to CI to guard against depending on different versions of the same dependency. - - Test projects now build to a separate path. - - Dependencies updated across the solution to ensure every project is using the same dependencies. + - XXX -#### What is being planned for version 0.73 +#### What is being planned for version 0.74 -For [v0.73][github-next-release-work], we'll work on below: +For [v0.74][github-next-release-work], we'll work on below: - - New utility: Crop and Lock - - Language selection - - PowerRename enumeration keywords - - Modernize and refresh UX of PowerToys based on WPF - - Stability / bug fixes -- Peek: UI improvements + - XXX ## PowerToys Community From 5da6f5b451e141d592b699fdf06685eddfb0d082 Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Sun, 27 Aug 2023 18:47:18 +0200 Subject: [PATCH 02/20] Revert "Updated Release Notes for KBM Note (#28131)" (#28170) This reverts commit ac0677bdeecc398a6763a2850d1052cfe15fc7b9. --- README.md | 135 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 113 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index e279457c05..ce589d18d7 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline Go to [Microsoft PowerToys GitHub releases page][github-release-link], 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. -[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 +[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46 +[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F45 +[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-x64.exe +[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-arm64.exe +[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-x64.exe +[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-arm64.exe | Description | Filename | sha256 hash | |----------------|----------|-------------| -| Per user - x64 | [PowerToysUserSetup-0.73.0-x64.exe][ptUserX64] | XXX | -| Per user - ARM64 | [PowerToysUserSetup-0.73.0-arm64.exe][ptUserArm64] | XXX | -| Machine wide - x64 | [PowerToysSetup-0.73.0-x64.exe][ptMachineX64] | XXX | -| Machine wide - ARM64 | [PowerToysSetup-0.73.0-arm64.exe][ptMachineArm64] | XXX | +| Per user - x64 | [PowerToysUserSetup-0.72.0-x64.exe][ptUserX64] | 9925894D797458C78A8C3DF6FE4BD748580638B01BB43680477763662915109A | +| Per user - ARM64 | [PowerToysUserSetup-0.72.0-arm64.exe][ptUserArm64] | 2E68139C22C56648E64514E4E8E0A0D12882F6CF30B48EB20ECC66B4CCDD5909 | +| Machine wide - x64 | [PowerToysSetup-0.72.0-x64.exe][ptMachineX64] | 788EE4D828169F092737A739030B218CEFEC79583E42858BB8F9F036B701BE6F | +| Machine wide - ARM64 | [PowerToysSetup-0.72.0-arm64.exe][ptMachineArm64] | 39C1D430A538B0F3D7869D39DF7F636A64AAFAD8DFB3C82059A97F4EBD3369C4 | This is our preferred method. @@ -97,39 +97,130 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/ Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on. -### 0.73 - August 2023 Update +### 0.72 - July 2023 Update -In this release, we focused on XXX. +In this release, we focused on stability and improvements. **Highlights** - - Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. + - Greatly reduced the PowerToys installed space by having utilities share the same installed path. When compared to 0.71, the 0.72 x64 machine installed version of PowerToys reduces the size reported in the Installed Apps screen from 1.15GB to 785 MB and the size in File Explorer properties for the installation folder from 3.10GB to 554 MB. + - Value Generator - A new PowerToys Run plugin that generates hashes and GUID values. Thanks [@IHorvalds](https://github.com/IHorvalds)! + - Mouse Highlighter has a new feature to have a highlight always follow the mouse pointer. Thanks [@hayatogh](https://github.com/hayatogh)! + - PowerRename was reworked to support a bigger number of files without crashing. ### Known issues -# validate are these still issues - - Due to changing paths in the installation folder, the Mouse Without Borders service might be pointing to the wrong place. Users not running as admin will have to enable service mode again after install. A toast notification will appear if Mouse Without Borders is unable to start the service correctly. - File Explorer extensions changed paths might not be loaded correctly until File Explorer and Preview Host processes are restarted, so we advise restarting the computer when possible after updating PowerToys. ### General - - XXX + - Shared dependencies between applications in order to greatly reduce the installed size. + - Added missing icons and icon sizes. Thanks [@niels9001](https://github.com/niels9001)! -### Keyboard Manager +### FancyZones - - Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. + - Fixed an issue where FancyZones wouldn't register a change to the "Switch between windows in the current zone" setting. + - Added a Setting to enable the behavior of clicking the middle mouse button to toggle multiple zone spanning. +### File Locksmith + + - Fixed a File Explorer crash when deleting a file, updating PowerToys and then trying to right-click the background of a folder in File Explorer. + - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + +### File Explorer add-ons + + - Updated the Monaco dependency for Developer Files Preview, supporting new file extensions and fixing issues. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! + +### Hosts File Editor + + - Consolidated the way the Hosts application is launched. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + +### Installer + + - Refactored the Monaco dependency inclusion. What to install is now being generated automatically. + - Removed hardlinks and simplified the installer files, now that many utilities use the same paths. + +### Mouse Highlighter + + - Added a feature so that a highlight follows the mouse even if no mouse button is being pressed. Thanks [@hayatogh](https://github.com/hayatogh)! + +### Mouse Pointer Crosshairs + + - Added a setting to hide the crosshairs when the mouse pointer is also hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Added a setting to select a fixed length for the crosshairs, which also spans across screens. Thanks [@Epp-code](https://github.com/Epp-code)! + +### Mouse Without Borders + + - Switched to a UWP mouse input API to fix mouse pointer lag issues that were reported. + - A toast notification will appear when the service can't be started and Mouse Without Borders will try to start in non-service mode instead. + - Fixed a bug where the service path wouldn't update to the new binary path when trying to re-enable service mode. + - Fixed some grammar errors in the Mouse Without Borders user facing strings. Thanks [@KhurramJalil](https://github.com/KhurramJalil)! + - Allow changing the shortcuts in the same way as other utilities and changed them to better defaults to avoid conflicting with Alt Gr+letter combos on international layouts. + +### Peek + + - Also benefits from the Monaco dependency update when peeking into files supported by the Developer Files Preview. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! + - Fixed a flash on PowerToys starting due to the Peek window activating and hiding right away. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Updated icon design. Thanks [@niels9001](https://github.com/niels9001)! + - Fixed flipped content issues on systems with RTL languages. + +### PowerRename + + - Reworked the UI and resource consumption to fix crashes and hangs when trying to rename a huge number of files. + - Added the Mica background material and some UI tweaks. Thanks [@niels9001](https://github.com/niels9001)! + +### PowerToys Run + + - New plugin: Value Generator - generates values like hashes and GUIDs. Thanks [@IHorvalds](https://github.com/IHorvalds)! + - The default input smoothing values were changed to the recommended values. Thanks [@SamMercer172](https://github.com/SamMercer172)! + - Fixed tab navigation issues when using Shift+Tab to go backwards. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Fixed a crash caused by images not being found in the image cache due to racing conditions. + - Fixed synchronization issues in the WindowWalker plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Fixed a synchronization crash when getting localized system paths. + - The PowerToys plugin is now activated by default. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + +### Quick Accent + - Added the ("ḍ", U+1E0D) unicode character. Thanks [@SamMercer172](https://github.com/SamMercer172)! + - Fixed an issue causing the left and right keys being discarded even when Quick Accent didn't activate. + +### Registry Preview + + - Fixed a bug causing DWORD values to not be shown correctly. Thanks [@randyrants](https://github.com/randyrants)! + - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + +### Runner + + - Show a warning asking the user to restart the computer after updating the PowerToys version. + +### Screen Ruler + + - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + +### Settings + + - Fix an unused Expander in the File Locksmith settings page. + - Added an info box to better explain what the extended context menu is. ### Development - - XXX + - Projects were restructured to allow sharing the same folder and dependencies and to avoid resource name conflicts. + - Added scripts to CI to guard against applications having conflicting resources. + - Added scripts to CI to guard against depending on different versions of the same dependency. + - Test projects now build to a separate path. + - Dependencies updated across the solution to ensure every project is using the same dependencies. -#### What is being planned for version 0.74 +#### What is being planned for version 0.73 -For [v0.74][github-next-release-work], we'll work on below: +For [v0.73][github-next-release-work], we'll work on below: - - XXX + - New utility: Crop and Lock + - Language selection + - PowerRename enumeration keywords + - Modernize and refresh UX of PowerToys based on WPF + - Stability / bug fixes +- Peek: UI improvements ## PowerToys Community From ddefc27fd7a951014f539851147db232530ef845 Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Tue, 29 Aug 2023 10:57:45 +0200 Subject: [PATCH 03/20] [PowerRename] Enable enumItems by default properly (#28191) --- .../powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml | 1 - .../PowerRenameUILib/PowerRenameXAML/MainWindow.xaml.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml index 5b2d4d1832..cecbeea866 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml @@ -503,7 +503,6 @@ diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml.cpp b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml.cpp index f3ced290b3..15d542bb52 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml.cpp +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/MainWindow.xaml.cpp @@ -282,6 +282,7 @@ namespace winrt::PowerRenameUI::implementation } button_rename().IsEnabled(false); + toggleButton_enumItems().IsChecked(true); InitAutoComplete(); SearchReplaceChanged(); InvalidateItemListViewState(); From 2e74b5dae8493e1d7fddd6ab03efa338e05b190b Mon Sep 17 00:00:00 2001 From: Laszlo Nemeth <57342539+donlaci@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:21:52 +0200 Subject: [PATCH 04/20] Fixing json property name to match with the settings file (#28189) --- .../Settings.UI.Library/FileLocksmithLocalProperties.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs b/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs index 61f6864872..f998e5b4dd 100644 --- a/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs +++ b/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; +using System.Text.Json.Serialization; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library @@ -14,6 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library ExtendedContextMenuOnly = false; } + [JsonPropertyName("showInExtendedContextMenu")] public bool ExtendedContextMenuOnly { get; set; } public string ToJsonString() From e2a3b7dd224b4bd47815e2678c0923c03794395a Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Tue, 29 Aug 2023 12:22:29 +0100 Subject: [PATCH 05/20] [Peek]Fix crash while loading thumbnails for small pngs (#28190) --- .../Peek.FilePreviewer/Previewers/Helpers/BitmapHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/peek/Peek.FilePreviewer/Previewers/Helpers/BitmapHelper.cs b/src/modules/peek/Peek.FilePreviewer/Previewers/Helpers/BitmapHelper.cs index 6f0391a0e6..30cb971ee6 100644 --- a/src/modules/peek/Peek.FilePreviewer/Previewers/Helpers/BitmapHelper.cs +++ b/src/modules/peek/Peek.FilePreviewer/Previewers/Helpers/BitmapHelper.cs @@ -18,6 +18,7 @@ namespace Peek.FilePreviewer.Previewers.Helpers public static async Task GetBitmapFromHBitmapAsync(IntPtr hbitmap, bool isSupportingTransparency, CancellationToken cancellationToken) { Bitmap? bitmap = null; + Bitmap? tempBitmapForDeletion = null; try { @@ -32,7 +33,8 @@ namespace Peek.FilePreviewer.Previewers.Helpers var transparentBitmap = new Bitmap(bitmapData.Width, bitmapData.Height, bitmapData.Stride, PixelFormat.Format32bppArgb, bitmapData.Scan0); - bitmap.Dispose(); + // Can't dispose of original bitmap yet as that causes crashes on png files. Saving it for later disposal after saving to stream. + tempBitmapForDeletion = bitmap; bitmap = transparentBitmap; } @@ -53,6 +55,7 @@ namespace Peek.FilePreviewer.Previewers.Helpers finally { bitmap?.Dispose(); + tempBitmapForDeletion?.Dispose(); // delete HBitmap to avoid memory leaks NativeMethods.DeleteObject(hbitmap); From ebc181bced0941c60da3a58661e11d6fa57e2e8e Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Tue, 29 Aug 2023 12:23:23 +0100 Subject: [PATCH 06/20] [Settings]Flyout disables awake even if Settings page is opened (#28198) --- src/settings-ui/Settings.UI/SettingsXAML/Views/AwakePage.xaml.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AwakePage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/AwakePage.xaml.cs index 2079c73eae..25822b303e 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/AwakePage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AwakePage.xaml.cs @@ -182,6 +182,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public void RefreshEnabledState() { + UpdateEnabledState(_generalSettingsRepository.SettingsConfig.Enabled.Awake); ViewModel.RefreshEnabledState(); } } From 2305c8e754cd18cbb680c4aba4037406f4576794 Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Tue, 29 Aug 2023 19:59:02 +0300 Subject: [PATCH 07/20] [FancyZones] Prevent snapping to invalid zone (#28206) --- .../fancyzones/FancyZonesLib/WorkArea.cpp | 8 +++++++ .../UnitTests/WorkArea.Spec.cpp | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp index 002bcdc63b..2d4b6adf90 100644 --- a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp +++ b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp @@ -124,6 +124,14 @@ bool WorkArea::Snap(HWND window, const ZoneIndexSet& zones, bool updatePosition) return false; } + for (ZoneIndex zone : zones) + { + if (static_cast(zone) >= m_layout->Zones().size()) + { + return false; + } + } + m_layoutWindows.Assign(window, zones); AppZoneHistory::instance().SetAppLastZones(window, m_uniqueId, m_layout->Id(), zones); diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/WorkArea.Spec.cpp b/src/modules/fancyzones/FancyZonesTests/UnitTests/WorkArea.Spec.cpp index c365a06c03..0506e0c6d4 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/WorkArea.Spec.cpp +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/WorkArea.Spec.cpp @@ -316,6 +316,28 @@ namespace FancyZonesUnitTests Assert::IsTrue(expected == layoutWindows.GetZoneIndexSetFromWindow(window)); } + TEST_METHOD(SnapEmptyZones) + { + const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect); + const auto window = Mocks::WindowCreate(m_hInst); + + Assert::IsFalse(workArea->Snap(window, {})); + } + + TEST_METHOD(SnapToIncorrectZone) + { + const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect); + const auto window = Mocks::WindowCreate(m_hInst); + + const ZoneIndexSet zones = { 10 }; + Assert::IsFalse(workArea->Snap(window, zones)); + + const auto processPath = get_process_path(window); + const auto history = AppZoneHistory::instance().GetZoneHistory(processPath, m_workAreaId); + + Assert::IsFalse(history.has_value()); + } + TEST_METHOD (UnsnapPropertyTest) { const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect); From 742e50eed700ab54691273b5a329863c8a31a86f Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Tue, 29 Aug 2023 22:24:30 +0300 Subject: [PATCH 08/20] [FZEditor]Fix "Save and close" not updating layouts (#28201) * keep editing model * hotkey backup * added restore to base model * pass model as an arg to edit and backup * init canvas zones * serialization * not needed line --- .../FancyZonesEditor/CanvasEditor.xaml.cs | 16 ++--- .../CanvasEditorWindow.xaml.cs | 23 ++----- .../editor/FancyZonesEditor/EditorWindow.cs | 36 +++++----- .../FancyZonesEditor/GridEditor.xaml.cs | 15 ++--- .../FancyZonesEditor/GridEditorWindow.xaml.cs | 3 +- .../editor/FancyZonesEditor/LayoutBackup.cs | 27 ++++---- .../FancyZonesEditor/MainWindow.xaml.cs | 65 +++++-------------- .../Models/CanvasLayoutModel.cs | 3 +- .../Models/GridLayoutModel.cs | 3 +- .../Models/LayoutHotkeysModel.cs | 13 ++++ .../FancyZonesEditor/Models/LayoutModel.cs | 6 ++ .../editor/FancyZonesEditor/Overlay.cs | 25 +++---- 12 files changed, 101 insertions(+), 134 deletions(-) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs index 6dc0f7e0ac..c97d4d1173 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs @@ -19,12 +19,13 @@ namespace FancyZonesEditor private CanvasLayoutModel _model; - public CanvasEditor() + public CanvasEditor(CanvasLayoutModel layout) { InitializeComponent(); Loaded += OnLoaded; Unloaded += OnUnloaded; KeyDown += CanvasEditor_KeyDown; + _model = layout; } private void CanvasEditor_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) @@ -47,17 +48,8 @@ namespace FancyZonesEditor private void OnLoaded(object sender, RoutedEventArgs e) { - CanvasLayoutModel model = (CanvasLayoutModel)DataContext; - if (model != null) - { - _model = model; - - var workArea = App.Overlay.WorkArea; - - UpdateZoneRects(); - - _model.PropertyChanged += OnModelChanged; - } + UpdateZoneRects(); + _model.PropertyChanged += OnModelChanged; } private void OnUnloaded(object sender, RoutedEventArgs e) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs index 2bbaa067fe..029c413a6d 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs @@ -11,39 +11,28 @@ namespace FancyZonesEditor { public partial class CanvasEditorWindow : EditorWindow { - private CanvasLayoutModel _model; - private CanvasLayoutModel _stashedModel; - - public CanvasEditorWindow() + public CanvasEditorWindow(CanvasLayoutModel layout) + : base(layout) { InitializeComponent(); KeyUp += CanvasEditorWindow_KeyUp; KeyDown += CanvasEditorWindow_KeyDown; - - _model = App.Overlay.CurrentDataContext as CanvasLayoutModel; - _stashedModel = (CanvasLayoutModel)_model.Clone(); - } - - public LayoutModel Model - { - get - { - return _model; - } } private void OnAddZone(object sender, RoutedEventArgs e) { Logger.LogInfo("Add zone"); - _model.AddZone(); + if (EditingLayout is CanvasLayoutModel canvas) + { + canvas.AddZone(); + } } protected new void OnCancel(object sender, RoutedEventArgs e) { Logger.LogInfo("Cancel changes"); base.OnCancel(sender, e); - _stashedModel.RestoreTo(_model); } private void CanvasEditorWindow_KeyUp(object sender, KeyEventArgs e) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs index 2f9cd05372..b79e66c07f 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs @@ -11,29 +11,35 @@ namespace FancyZonesEditor { public class EditorWindow : Window { + public LayoutModel EditingLayout { get; set; } + + public EditorWindow(LayoutModel editingLayout) + { + EditingLayout = editingLayout; + } + protected void OnSaveApplyTemplate(object sender, RoutedEventArgs e) { Logger.LogTrace(); - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is LayoutModel model) + + // If new custom Canvas layout is created (i.e. edited Blank layout), + // it's type needs to be updated + if (EditingLayout.Type == LayoutType.Blank) { - // If new custom Canvas layout is created (i.e. edited Blank layout), - // it's type needs to be updated - if (model.Type == LayoutType.Blank) - { - model.Type = LayoutType.Custom; - } - - model.Persist(); - - MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings; - settings.SetAppliedModel(model); - App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model); + EditingLayout.Type = LayoutType.Custom; } + EditingLayout.Persist(); + + MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings; + settings.SetAppliedModel(EditingLayout); + App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(EditingLayout); + App.FancyZonesEditorIO.SerializeLayoutTemplates(); App.FancyZonesEditorIO.SerializeCustomLayouts(); App.FancyZonesEditorIO.SerializeAppliedLayouts(); + App.FancyZonesEditorIO.SerializeDefaultLayouts(); + App.FancyZonesEditorIO.SerializeLayoutHotkeys(); Close(); } @@ -46,7 +52,7 @@ namespace FancyZonesEditor protected void OnCancel(object sender, RoutedEventArgs e) { // restore backup, clean up - App.Overlay.EndEditing(true); + App.Overlay.EndEditing(EditingLayout); // select and draw applied layout var settings = ((App)Application.Current).MainWindowSettings; diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs index d49ad9232e..8af4114eec 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs @@ -36,7 +36,7 @@ namespace FancyZonesEditor private GridData _data; - public GridEditor() + public GridEditor(GridLayoutModel layoutModel) { InitializeComponent(); Loaded += GridEditor_Loaded; @@ -44,6 +44,9 @@ namespace FancyZonesEditor KeyDown += GridEditor_KeyDown; KeyUp += GridEditor_KeyUp; gridEditorUniqueId = ++gridEditorUniqueIdCounter; + + _data = new GridData(layoutModel); + Model = layoutModel; } public void FocusZone() @@ -58,16 +61,6 @@ namespace FancyZonesEditor private void GridEditor_Loaded(object sender, RoutedEventArgs e) { ((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged; - - GridLayoutModel model = (GridLayoutModel)DataContext; - if (model == null) - { - return; - } - - _data = new GridData(model); - - Model = model; Model.PropertyChanged += OnGridDimensionsChanged; SetupUI(); } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs index 1aea412c66..eb0e03d5ac 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs @@ -10,7 +10,8 @@ namespace FancyZonesEditor { public partial class GridEditorWindow : EditorWindow { - public GridEditorWindow() + public GridEditorWindow(GridLayoutModel model) + : base(model) { InitializeComponent(); diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutBackup.cs b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutBackup.cs index 36dd671107..feeb49724d 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutBackup.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutBackup.cs @@ -3,14 +3,15 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using System.Windows; using FancyZonesEditor.Models; +using FancyZonesEditor.Utils; namespace FancyZonesEditor { public class LayoutBackup { private LayoutModel _backup; + private string _hotkeyBackup; private List _defaultLayoutsBackup; public LayoutBackup() @@ -28,32 +29,31 @@ namespace FancyZonesEditor _backup = new CanvasLayoutModel(canvas); } + _hotkeyBackup = MainWindowSettingsModel.LayoutHotkeys.Key(model.Uuid); _defaultLayoutsBackup = new List(MainWindowSettingsModel.DefaultLayouts.Layouts); } - public void Restore() + public void Restore(LayoutModel layoutToRestore) { - if (_backup != null) + if (_backup != null && layoutToRestore != null) { - var settings = ((App)Application.Current).MainWindowSettings; - var selectedModel = settings.SelectedModel; - - if (selectedModel == null) - { - return; - } - if (_backup is GridLayoutModel grid) { - grid.RestoreTo((GridLayoutModel)selectedModel); + grid.RestoreTo((GridLayoutModel)layoutToRestore); grid.InitTemplateZones(); } else if (_backup is CanvasLayoutModel canvas) { - canvas.RestoreTo((CanvasLayoutModel)selectedModel); + canvas.RestoreTo((CanvasLayoutModel)layoutToRestore); + canvas.InitTemplateZones(); } } + if (_hotkeyBackup != null) + { + MainWindowSettingsModel.LayoutHotkeys.SelectKey(_hotkeyBackup, layoutToRestore.Uuid); + } + if (_defaultLayoutsBackup != null) { MainWindowSettingsModel.DefaultLayouts.Restore(_defaultLayoutsBackup); @@ -63,6 +63,7 @@ namespace FancyZonesEditor public void Clear() { _backup = null; + _hotkeyBackup = null; _defaultLayoutsBackup = null; } } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs index b5dd83edb6..944222b73d 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs @@ -146,29 +146,17 @@ namespace FancyZonesEditor private void DecrementZones_Click(object sender, RoutedEventArgs e) { - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is not LayoutModel model) + if (_settings.SelectedModel.TemplateZoneCount > 1) { - return; - } - - if (model.TemplateZoneCount > 1) - { - model.TemplateZoneCount--; + _settings.SelectedModel.TemplateZoneCount--; } } private void IncrementZones_Click(object sender, RoutedEventArgs e) { - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is not LayoutModel model) + if (_settings.SelectedModel.IsZoneAddingAllowed) { - return; - } - - if (model.IsZoneAddingAllowed) - { - model.TemplateZoneCount++; + _settings.SelectedModel.TemplateZoneCount++; } } @@ -303,25 +291,23 @@ namespace FancyZonesEditor private void Apply() { Logger.LogTrace(); - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is LayoutModel model) - { - _settings.SetAppliedModel(model); - App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model); - App.FancyZonesEditorIO.SerializeAppliedLayouts(); - App.FancyZonesEditorIO.SerializeCustomLayouts(); - } + + LayoutModel model = _settings.SelectedModel; + _settings.SetAppliedModel(model); + App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model); + App.FancyZonesEditorIO.SerializeAppliedLayouts(); + App.FancyZonesEditorIO.SerializeCustomLayouts(); } private void OnClosing(object sender, EventArgs e) { Logger.LogTrace(); - App.Overlay.EndEditing(true); App.FancyZonesEditorIO.SerializeAppliedLayouts(); App.FancyZonesEditorIO.SerializeCustomLayouts(); App.FancyZonesEditorIO.SerializeLayoutHotkeys(); App.FancyZonesEditorIO.SerializeLayoutTemplates(); + App.FancyZonesEditorIO.SerializeDefaultLayouts(); App.Overlay.CloseLayoutWindow(); App.Current.Shutdown(); } @@ -345,7 +331,8 @@ namespace FancyZonesEditor var dataContext = ((FrameworkElement)sender).DataContext; Select((LayoutModel)dataContext); - App.Overlay.StartEditing((LayoutModel)dataContext); + + App.Overlay.StartEditing(_settings.SelectedModel); Keyboard.ClearFocus(); EditLayoutDialogTitle.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Edit_Template, ((LayoutModel)dataContext).Name); @@ -358,16 +345,8 @@ namespace FancyZonesEditor var dataContext = ((FrameworkElement)sender).DataContext; Select((LayoutModel)dataContext); EditLayoutDialog.Hide(); - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is not LayoutModel model) - { - return; - } - - _settings.SetSelectedModel(model); - Hide(); - mainEditor.OpenEditor(model); + App.Overlay.OpenEditor(_settings.SelectedModel); } private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) @@ -438,7 +417,7 @@ namespace FancyZonesEditor // EditLayout: Cancel changes private void EditLayoutDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { - App.Overlay.EndEditing(false); + App.Overlay.EndEditing(_settings.SelectedModel); Select(_settings.AppliedModel); } @@ -447,13 +426,8 @@ namespace FancyZonesEditor { Logger.LogTrace(); - var mainEditor = App.Overlay; - if (mainEditor.CurrentDataContext is not LayoutModel model) - { - return; - } - - mainEditor.EndEditing(false); + App.Overlay.EndEditing(null); + LayoutModel model = _settings.SelectedModel; // update current settings if (model == _settings.AppliedModel) @@ -465,6 +439,7 @@ namespace FancyZonesEditor App.FancyZonesEditorIO.SerializeCustomLayouts(); App.FancyZonesEditorIO.SerializeLayoutTemplates(); App.FancyZonesEditorIO.SerializeLayoutHotkeys(); + App.FancyZonesEditorIO.SerializeDefaultLayouts(); // reset selected model Select(_settings.AppliedModel); @@ -653,7 +628,6 @@ namespace FancyZonesEditor if (dataContext is LayoutModel model) { MainWindowSettingsModel.DefaultLayouts.Set(model, MonitorConfigurationType.Vertical); - App.FancyZonesEditorIO.SerializeDefaultLayouts(); } } @@ -663,7 +637,6 @@ namespace FancyZonesEditor if (dataContext is LayoutModel model) { MainWindowSettingsModel.DefaultLayouts.Set(model, MonitorConfigurationType.Horizontal); - App.FancyZonesEditorIO.SerializeDefaultLayouts(); } } @@ -673,7 +646,6 @@ namespace FancyZonesEditor if (dataContext is LayoutModel model) { MainWindowSettingsModel.DefaultLayouts.Reset(MonitorConfigurationType.Horizontal); - App.FancyZonesEditorIO.SerializeDefaultLayouts(); } } @@ -683,7 +655,6 @@ namespace FancyZonesEditor if (dataContext is LayoutModel model) { MainWindowSettingsModel.DefaultLayouts.Reset(MonitorConfigurationType.Vertical); - App.FancyZonesEditorIO.SerializeDefaultLayouts(); } } } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs index bad7a06aef..7eaa5f52e8 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs @@ -184,6 +184,8 @@ namespace FancyZonesEditor.Models public void RestoreTo(CanvasLayoutModel other) { + base.RestoreTo(other); + other.Zones.Clear(); foreach (Int32Rect zone in Zones) { @@ -191,7 +193,6 @@ namespace FancyZonesEditor.Models } other._topLeft = _topLeft; - other.SensitivityRadius = SensitivityRadius; other.CanvasRect = CanvasRect; other.UpdateLayout(); } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs index 9010b2e9e6..537dd741d1 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs @@ -280,6 +280,8 @@ namespace FancyZonesEditor.Models public void RestoreTo(GridLayoutModel layout) { + base.RestoreTo(layout); + int rows = Rows; int cols = Columns; @@ -315,7 +317,6 @@ namespace FancyZonesEditor.Models layout.ShowSpacing = ShowSpacing; layout.Spacing = Spacing; - layout.SensitivityRadius = SensitivityRadius; layout.FirePropertyChanged(); } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs index f48a25b552..54311b4b03 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs @@ -68,6 +68,19 @@ namespace FancyZonesEditor.Models return true; } + public string Key(string uuid) + { + foreach (var pair in SelectedKeys) + { + if (pair.Value == uuid) + { + return pair.Key; + } + } + + return Properties.Resources.Quick_Key_None; + } + public void CleanUp() { var keys = SelectedKeys.Keys.ToList(); diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs index b7b244cdf2..8968ef6e21 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs @@ -339,6 +339,12 @@ namespace FancyZonesEditor.Models } } + public void RestoreTo(LayoutModel layout) + { + layout.SensitivityRadius = SensitivityRadius; + layout.TemplateZoneCount = TemplateZoneCount; + } + // Adds new custom Layout public void AddCustomLayout(LayoutModel model) { diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Overlay.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Overlay.cs index a1cbaeb77b..1708ae6eef 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Overlay.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Overlay.cs @@ -186,26 +186,19 @@ namespace FancyZonesEditor Logger.LogTrace(); _layoutPreview = null; - if (CurrentDataContext is GridLayoutModel) + if (model is GridLayoutModel grid) { - _editorLayout = new GridEditor(); + _editorLayout = new GridEditor(grid); + _editorWindow = new GridEditorWindow(grid); } - else if (CurrentDataContext is CanvasLayoutModel) + else if (model is CanvasLayoutModel canvas) { - _editorLayout = new CanvasEditor(); + _editorLayout = new CanvasEditor(canvas); + _editorWindow = new CanvasEditorWindow(canvas); } CurrentLayoutWindow.Content = _editorLayout; - if (model is GridLayoutModel) - { - _editorWindow = new GridEditorWindow(); - } - else - { - _editorWindow = new CanvasEditorWindow(); - } - _editorWindow.Owner = Monitors[App.Overlay.CurrentDesktop].Window; _editorWindow.DataContext = model; _editorWindow.Show(); @@ -267,11 +260,11 @@ namespace FancyZonesEditor _layoutBackup.Backup(model); } - public void EndEditing(bool restoreBackup) + public void EndEditing(LayoutModel modelToRestore) { - if (restoreBackup) + if (modelToRestore != null) { - _layoutBackup.Restore(); + _layoutBackup.Restore(modelToRestore); } _layoutBackup.Clear(); From 657e9915acf416aa2f81592d24b17c88a6dfdc94 Mon Sep 17 00:00:00 2001 From: Laszlo Nemeth <57342539+donlaci@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:18:46 +0200 Subject: [PATCH 09/20] [Registry Preview] Adding missing resource string (#28216) * Adding missing resource string * Modify value --- .../RegistryPreviewUI/Strings/en-US/Resources.resw | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/registrypreview/RegistryPreviewUI/Strings/en-US/Resources.resw b/src/modules/registrypreview/RegistryPreviewUI/Strings/en-US/Resources.resw index ec92378548..6b766a6570 100644 --- a/src/modules/registrypreview/RegistryPreviewUI/Strings/en-US/Resources.resw +++ b/src/modules/registrypreview/RegistryPreviewUI/Strings/en-US/Resources.resw @@ -178,6 +178,9 @@ Open Key + + Save As + Save as… From 25e346db9293bda3a1c370e5f57ac7a6bab984a2 Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Wed, 30 Aug 2023 17:24:19 +0300 Subject: [PATCH 10/20] [FancyZones Editor] Fix layout selection after deleting custom (#28219) --- .../Utils/FancyZonesEditorIO.cs | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/FancyZonesEditorIO.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/FancyZonesEditorIO.cs index 604c8bf33e..e5ecc31a5c 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/FancyZonesEditorIO.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/FancyZonesEditorIO.cs @@ -1019,6 +1019,45 @@ namespace FancyZonesEditor.Utils continue; } + LayoutType layoutType = JsonTagToLayoutType(layout.AppliedLayout.Type); + LayoutSettings settings = new LayoutSettings + { + ZonesetUuid = layout.AppliedLayout.Uuid, + ShowSpacing = layout.AppliedLayout.ShowSpacing, + Spacing = layout.AppliedLayout.Spacing, + Type = layoutType, + ZoneCount = layout.AppliedLayout.ZoneCount, + SensitivityRadius = layout.AppliedLayout.SensitivityRadius, + }; + + // check if the custom layout exists + bool existingLayout = layoutType != LayoutType.Custom; + if (layoutType == LayoutType.Custom) + { + foreach (LayoutModel custom in MainWindowSettingsModel.CustomModels) + { + if (custom.Uuid == layout.AppliedLayout.Uuid) + { + existingLayout = true; + break; + } + } + } + + // replace deleted layout with the Blank layout + if (!existingLayout) + { + LayoutModel blankLayout = MainWindowSettingsModel.TemplateModels[(int)LayoutType.Blank]; + settings.ZonesetUuid = blankLayout.Uuid; + settings.Type = blankLayout.Type; + settings.ZoneCount = blankLayout.TemplateZoneCount; + settings.SensitivityRadius = blankLayout.SensitivityRadius; + + // grid layout settings, just resetting them + settings.ShowSpacing = false; + settings.Spacing = 0; + } + bool unused = true; foreach (Monitor monitor in monitors) { @@ -1028,16 +1067,6 @@ namespace FancyZonesEditor.Utils (monitor.Device.VirtualDesktopId == layout.Device.VirtualDesktop || layout.Device.VirtualDesktop == DefaultVirtualDesktopGuid)) { - var settings = new LayoutSettings - { - ZonesetUuid = layout.AppliedLayout.Uuid, - ShowSpacing = layout.AppliedLayout.ShowSpacing, - Spacing = layout.AppliedLayout.Spacing, - Type = JsonTagToLayoutType(layout.AppliedLayout.Type), - ZoneCount = layout.AppliedLayout.ZoneCount, - SensitivityRadius = layout.AppliedLayout.SensitivityRadius, - }; - monitor.Settings = settings; unused = false; break; From a2a2e4b853c8725930c13e6a236d75c8a7844a24 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Thu, 31 Aug 2023 09:57:52 -0700 Subject: [PATCH 11/20] /helped markdown bug fix (#28232) --- .github/policies/resourceManagement.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index ae72e1266f..0a9e925b94 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -212,7 +212,7 @@ configuration: - addLabel: label: Resolution-Helped User - addReply: - reply: This issue is now marked as resolved. If you have any follow-up questions, please don't hesitate to ask. You can find out more about PowerToys functionalities in our [end-user documentation](https://aka.ms/powertoy-docs]. + reply: This issue is now marked as resolved. If you have any follow-up questions, please don't hesitate to ask. You can find out more about PowerToys functionalities in our [end-user documentation](https://aka.ms/powertoy-docs). - closeIssue description: - if: From 2c5659d7462bf97c24044dca55c0f44b64cb3618 Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Thu, 31 Aug 2023 18:58:24 +0200 Subject: [PATCH 12/20] 0.73 release notes (#28171) Co-authored-by: Ethan Fang <117125208+ethan-fang-MS@users.noreply.github.com> Co-authored-by: Jaime Bernardo Co-authored-by: Clint Rutkas --- .github/actions/spell-check/expect.txt | 9 +- README.md | 168 +++++++++++++------------ 2 files changed, 91 insertions(+), 86 deletions(-) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index e8af95b8ed..f86d415841 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -112,7 +112,7 @@ AUTHN AUTHZ AUTOHIDE AUTOMATIONPROPERTIES -Autorun +autorun AUTOUPDATE AValid awakeness @@ -144,7 +144,7 @@ Blockquotes blogs Blt BLUEGRAY -Bluetooth +bluetooth BLURBEHIND BLURREGION bmi @@ -564,7 +564,6 @@ FARPROC fdw feimage fff -fileapi FILEEXPLORER FILEFLAGS FILEFLAGSMASK @@ -606,9 +605,9 @@ FZE gabime GAC gacutil -Galaxi Gaeilge Gaidhlig +Galaxi GBarm Gbits Gbps @@ -1569,7 +1568,6 @@ renamable RENAMEONCOLLISION Renamer reparent -reparented reparenting reparse reportbug @@ -1882,7 +1880,6 @@ talynone TApp TApplication TApplied -Taras targ TARGETAPPHEADER TARGETDIR diff --git a/README.md b/README.md index ce589d18d7..3923a7c827 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline Go to [Microsoft PowerToys GitHub releases page][github-release-link], 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. -[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46 -[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F45 -[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-x64.exe -[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-arm64.exe -[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-x64.exe -[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-arm64.exe +[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.72.0-x64.exe][ptUserX64] | 9925894D797458C78A8C3DF6FE4BD748580638B01BB43680477763662915109A | -| Per user - ARM64 | [PowerToysUserSetup-0.72.0-arm64.exe][ptUserArm64] | 2E68139C22C56648E64514E4E8E0A0D12882F6CF30B48EB20ECC66B4CCDD5909 | -| Machine wide - x64 | [PowerToysSetup-0.72.0-x64.exe][ptMachineX64] | 788EE4D828169F092737A739030B218CEFEC79583E42858BB8F9F036B701BE6F | -| Machine wide - ARM64 | [PowerToysSetup-0.72.0-arm64.exe][ptMachineArm64] | 39C1D430A538B0F3D7869D39DF7F636A64AAFAD8DFB3C82059A97F4EBD3369C4 | +| 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. @@ -97,130 +97,138 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/ Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on. -### 0.72 - July 2023 Update +### 0.73 - August 2023 Update -In this release, we focused on stability and improvements. +In this release, we focused on releasing new features, stability and improvements. **Highlights** - - Greatly reduced the PowerToys installed space by having utilities share the same installed path. When compared to 0.71, the 0.72 x64 machine installed version of PowerToys reduces the size reported in the Installed Apps screen from 1.15GB to 785 MB and the size in File Explorer properties for the installation folder from 3.10GB to 554 MB. - - Value Generator - A new PowerToys Run plugin that generates hashes and GUID values. Thanks [@IHorvalds](https://github.com/IHorvalds)! - - Mouse Highlighter has a new feature to have a highlight always follow the mouse pointer. Thanks [@hayatogh](https://github.com/hayatogh)! - - PowerRename was reworked to support a bigger number of files without crashing. - -### Known issues - - - Due to changing paths in the installation folder, the Mouse Without Borders service might be pointing to the wrong place. Users not running as admin will have to enable service mode again after install. A toast notification will appear if Mouse Without Borders is unable to start the service correctly. - - File Explorer extensions changed paths might not be loaded correctly until File Explorer and Preview Host processes are restarted, so we advise restarting the computer when possible after updating PowerToys. + - Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. + - 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 - - Shared dependencies between applications in order to greatly reduce the installed size. - - Added missing icons and icon sizes. Thanks [@niels9001](https://github.com/niels9001)! + - 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 an issue where FancyZones wouldn't register a change to the "Switch between windows in the current zone" setting. - - Added a Setting to enable the behavior of clicking the middle mouse button to toggle multiple zone spanning. + - Fixed issue causing canvas zones being drawn only when dragging in zone area. + - Fixed user-defined default layout highlighting issue. + - Refactored and improved code quality. + - Fixed issue causing wrong layout to be applied when duplicating non-selected layout. ### File Locksmith - - Fixed a File Explorer crash when deleting a file, updating PowerToys and then trying to right-click the background of a folder in File Explorer. - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! - + - Icon update. Thanks [@jmaraujouy](https://github.com/jmaraujouy)! + ### File Explorer add-ons - - Updated the Monaco dependency for Developer Files Preview, supporting new file extensions and fixing issues. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - -### Hosts File Editor - - - Consolidated the way the Hosts application is launched. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + - Fixed issue causing thumbnail previewers to lock files. + - Open URIs from developer files in default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Installer - - Refactored the Monaco dependency inclusion. What to install is now being generated automatically. - - Removed hardlinks and simplified the installer files, now that many utilities use the same paths. + - 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 supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant. ### Mouse Highlighter - - Added a feature so that a highlight follows the mouse even if no mouse button is being pressed. Thanks [@hayatogh](https://github.com/hayatogh)! + - Fixed highlighter being invisible issue for Always on Top windows. + - Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Mouse Pointer Crosshairs - - Added a setting to hide the crosshairs when the mouse pointer is also hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Added a setting to select a fixed length for the crosshairs, which also spans across screens. Thanks [@Epp-code](https://github.com/Epp-code)! - -### Mouse Without Borders - - - Switched to a UWP mouse input API to fix mouse pointer lag issues that were reported. - - A toast notification will appear when the service can't be started and Mouse Without Borders will try to start in non-service mode instead. - - Fixed a bug where the service path wouldn't update to the new binary path when trying to re-enable service mode. - - Fixed some grammar errors in the Mouse Without Borders user facing strings. Thanks [@KhurramJalil](https://github.com/KhurramJalil)! - - Allow changing the shortcuts in the same way as other utilities and changed them to better defaults to avoid conflicting with Alt Gr+letter combos on international layouts. + - Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Peek - - Also benefits from the Monaco dependency update when peeking into files supported by the Developer Files Preview. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! - - Fixed a flash on PowerToys starting due to the Peek window activating and hiding right away. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Updated icon design. Thanks [@niels9001](https://github.com/niels9001)! - - Fixed flipped content issues on systems with RTL languages. + - Show correct file type for shortcuts. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Fixed issue causing 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 default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Show thumbnail and fallback to icon for unsupported files. Thanks [@pedrolamas](https://github.com/pedrolamas)! ### PowerRename - - Reworked the UI and resource consumption to fix crashes and hangs when trying to rename a huge number of files. - - Added the Mica background material and some UI tweaks. Thanks [@niels9001](https://github.com/niels9001)! + - Updated OOBE gif. Thanks [@ChaseKnowlden](https://github.com/ChaseKnowlden)! + - Localized renamed parts combo box. + - Introduced advanced counter functionality. + - Added remember last window size logic and optimized items sorting. + - Enable "Enumerate items" option by default. ### PowerToys Run - - New plugin: Value Generator - generates values like hashes and GUIDs. Thanks [@IHorvalds](https://github.com/IHorvalds)! - - The default input smoothing values were changed to the recommended values. Thanks [@SamMercer172](https://github.com/SamMercer172)! - - Fixed tab navigation issues when using Shift+Tab to go backwards. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Fixed a crash caused by images not being found in the image cache due to racing conditions. - - Fixed synchronization issues in the WindowWalker plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - - Fixed a synchronization crash when getting localized system paths. - - The PowerToys plugin is now activated by default. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - -### Quick Accent - - Added the ("ḍ", U+1E0D) unicode character. Thanks [@SamMercer172](https://github.com/SamMercer172)! - - Fixed an issue causing the left and right keys being discarded even when Quick Accent didn't activate. + - Fixed 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 Keep shell open option for Shell plugin. + - Added Crop And Lock to PowerToys plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Registry Preview - - Fixed a bug causing DWORD values to not be shown correctly. Thanks [@randyrants](https://github.com/randyrants)! - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + - Updated AppBarButtons to use an explicit AppBarButton.Icon. Thanks [@randyrants](https://github.com/randyrants)! + - Fixed crash on clicking Save As button. ### Runner - - Show a warning asking the user to restart the computer after updating the PowerToys version. + - 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 - - UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)! + - Use proper resources file. ### Settings - - Fix an unused Expander in the File Locksmith settings page. - - Added an info box to better explain what the extended context menu is. + - 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 - - Projects were restructured to allow sharing the same folder and dependencies and to avoid resource name conflicts. - - Added scripts to CI to guard against applications having conflicting resources. - - Added scripts to CI to guard against depending on different versions of the same dependency. - - Test projects now build to a separate path. - - Dependencies updated across the solution to ensure every project is using the same dependencies. + - 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.73 +#### What is being planned for version 0.74 -For [v0.73][github-next-release-work], we'll work on below: +For [v0.74][github-next-release-work], we'll work on below: - - New utility: Crop and Lock - Language selection - - PowerRename enumeration keywords - Modernize and refresh UX of PowerToys based on WPF - Stability / bug fixes -- Peek: UI improvements + - Peek: UI improvements ## PowerToys Community From 90e53623854a67c13b3d91456db7d4603edbd9c5 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Mon, 4 Sep 2023 16:16:26 +0100 Subject: [PATCH 13/20] [Tests]Disallow user override of culture options while running tests (#28207) * [Tests]Disallow user override of culture options while running tests * Revert unintended changes to the system's plugin * Embed utc in the date to run utc tests on other timezones --- .../ExtendedCalculatorParserTests.cs | 2 +- .../NumberTranslatorTests.cs | 14 ++++---- .../ImageTests.cs | 4 +-- .../QueryTests.cs | 4 +-- .../StringParserTests.cs | 4 +-- .../TimeDateResultTests.cs | 32 ++++++++++++------- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs index 9332eee813..b5bee39a8a 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs @@ -239,7 +239,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests // Act // Using en-us culture to have a fixed number style - var result = engine.Interpret(input, new CultureInfo("en-us"), out _); + var result = engine.Interpret(input, new CultureInfo("en-us", false), out _); // Assert Assert.IsNotNull(result); diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/NumberTranslatorTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/NumberTranslatorTests.cs index e3e57966f7..e4c3d8365e 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/NumberTranslatorTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/NumberTranslatorTests.cs @@ -46,7 +46,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void Translate_ThrowError_WhenCalledNull(string input) { // Arrange - var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US")); + var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false)); // Act Assert.ThrowsException(() => translator.Translate(input)); @@ -58,7 +58,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void Translate_WhenCalledEmpty(string input) { // Arrange - var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US")); + var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false)); // Act var result = translator.Translate(input); @@ -76,7 +76,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void Translate_NoErrors_WhenCalled(string input, string expectedResult) { // Arrange - var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US")); + var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false)); // Act var result = translator.Translate(input); @@ -95,7 +95,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void TranslateBack_NoErrors_WhenCalled(string input, string expectedResult) { // Arrange - var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US")); + var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false)); // Act var result = translator.TranslateBack(input); @@ -113,7 +113,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void Translate_RemoveNumberGroupSeparator_WhenCalled(string decimalSeparator, string groupSeparator, string input, string expectedResult) { // Arrange - var sourceCulture = new CultureInfo("en-US") + var sourceCulture = new CultureInfo("en-US", false) { NumberFormat = { @@ -121,7 +121,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests NumberGroupSeparator = groupSeparator, }, }; - var translator = NumberTranslator.Create(sourceCulture, new CultureInfo("en-US")); + var translator = NumberTranslator.Create(sourceCulture, new CultureInfo("en-US", false)); // Act var result = translator.Translate(input); @@ -137,7 +137,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests public void Translate_NoRemovalOfLeadingZeroesOnEdgeCases(string input, string expectedResult) { // Arrange - var translator = NumberTranslator.Create(new CultureInfo("de-de"), new CultureInfo("en-US")); + var translator = NumberTranslator.Create(new CultureInfo("de-de", false), new CultureInfo("en-US", false)); // Act var result = translator.Translate(input); diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/ImageTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/ImageTests.cs index a33b622d80..094e525852 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/ImageTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/ImageTests.cs @@ -24,9 +24,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests // Set culture to 'en-us' originalCulture = CultureInfo.CurrentCulture; - CultureInfo.CurrentCulture = new CultureInfo("en-us"); + CultureInfo.CurrentCulture = new CultureInfo("en-us", false); originalUiCulture = CultureInfo.CurrentUICulture; - CultureInfo.CurrentUICulture = new CultureInfo("en-us"); + CultureInfo.CurrentUICulture = new CultureInfo("en-us", false); } [DataTestMethod] diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/QueryTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/QueryTests.cs index 1ebb638df9..8fbcaf41e7 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/QueryTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/QueryTests.cs @@ -25,9 +25,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests // Set culture to 'en-us' originalCulture = CultureInfo.CurrentCulture; - CultureInfo.CurrentCulture = new CultureInfo("en-us"); + CultureInfo.CurrentCulture = new CultureInfo("en-us", false); originalUiCulture = CultureInfo.CurrentUICulture; - CultureInfo.CurrentUICulture = new CultureInfo("en-us"); + CultureInfo.CurrentUICulture = new CultureInfo("en-us", false); } [DataTestMethod] diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/StringParserTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/StringParserTests.cs index 4bbe90620b..322592a457 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/StringParserTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/StringParserTests.cs @@ -20,9 +20,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests { // Set culture to 'en-us' originalCulture = CultureInfo.CurrentCulture; - CultureInfo.CurrentCulture = new CultureInfo("en-us"); + CultureInfo.CurrentCulture = new CultureInfo("en-us", false); originalUiCulture = CultureInfo.CurrentUICulture; - CultureInfo.CurrentUICulture = new CultureInfo("en-us"); + CultureInfo.CurrentUICulture = new CultureInfo("en-us", false); } [DataTestMethod] diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/TimeDateResultTests.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/TimeDateResultTests.cs index 08931e0d57..f0f43267ee 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/TimeDateResultTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/TimeDateResultTests.cs @@ -21,14 +21,22 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests { // Set culture to 'en-us' originalCulture = CultureInfo.CurrentCulture; - CultureInfo.CurrentCulture = new CultureInfo("en-us"); + CultureInfo.CurrentCulture = new CultureInfo("en-us", false); originalUiCulture = CultureInfo.CurrentUICulture; - CultureInfo.CurrentUICulture = new CultureInfo("en-us"); + CultureInfo.CurrentUICulture = new CultureInfo("en-us", false); } - private DateTime GetDateTimeForTest() + private DateTime GetDateTimeForTest(bool embedUtc = false) { - return new DateTime(2022, 03, 02, 22, 30, 45); + var dateTime = new DateTime(2022, 03, 02, 22, 30, 45); + if (embedUtc) + { + return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); + } + else + { + return dateTime; + } } [DataTestMethod] @@ -181,8 +189,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests public void UtcFormatsWithShortTimeAndShortDate(string formatLabel, string expectedFormat) { // Setup - var helperResults = AvailableResultsList.GetList(true, false, false, GetDateTimeForTest()); - var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture); + var helperResults = AvailableResultsList.GetList(true, false, false, GetDateTimeForTest(true)); + var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture); // Act var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase)); @@ -201,8 +209,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests public void UtcFormatsWithShortTimeAndLongDate(string formatLabel, string expectedFormat) { // Setup - var helperResults = AvailableResultsList.GetList(true, false, true, GetDateTimeForTest()); - var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture); + var helperResults = AvailableResultsList.GetList(true, false, true, GetDateTimeForTest(true)); + var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture); // Act var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase)); @@ -221,8 +229,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests public void UtcFormatsWithLongTimeAndShortDate(string formatLabel, string expectedFormat) { // Setup - var helperResults = AvailableResultsList.GetList(true, true, false, GetDateTimeForTest()); - var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture); + var helperResults = AvailableResultsList.GetList(true, true, false, GetDateTimeForTest(true)); + var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture); // Act var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase)); @@ -241,8 +249,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests public void UtcFormatsWithLongTimeAndLongDate(string formatLabel, string expectedFormat) { // Setup - var helperResults = AvailableResultsList.GetList(true, true, true, GetDateTimeForTest()); - var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture); + var helperResults = AvailableResultsList.GetList(true, true, true, GetDateTimeForTest(true)); + var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture); // Act var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase)); From 752c298ef3d1e225fffba45fb3958c23ad0300a5 Mon Sep 17 00:00:00 2001 From: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:16:58 -0400 Subject: [PATCH 14/20] [PTRun][System] Sort NetworkInterfaces by IPv4, then IPv6 (#28220) Updated GetList method to sort by IPv4, then IPv6 adapter interfaces to match test logic --- .../Components/NetworkConnectionProperties.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs index c681ae0e03..d806efdb7a 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs @@ -143,15 +143,13 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Components /// List containing all network adapters internal static List GetList() { - List list = new List(); - - var interfaces = NetworkInterface.GetAllNetworkInterfaces().Where(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback && x.GetPhysicalAddress() != null); - foreach (NetworkInterface i in interfaces) - { - list.Add(new NetworkConnectionProperties(i)); - } - - return list; + var interfaces = NetworkInterface.GetAllNetworkInterfaces() + .Where(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback && x.GetPhysicalAddress() != null) + .Select(i => new NetworkConnectionProperties(i)) + .OrderByDescending(i => i.IPv4) // list IPv4 first + .ThenBy(i => i.IPv6Primary) // then IPv6 + .ToList(); + return interfaces; } /// From 83f062542778a14d5dd260d0018d3db1f6c84af6 Mon Sep 17 00:00:00 2001 From: Davide Giacometti Date: Mon, 4 Sep 2023 17:58:37 +0200 Subject: [PATCH 15/20] [FindMyMouse]Support different activation modes (#28096) * multiple activation modes for find my mouse * use custom shortcut --- .../MouseUtils/FindMyMouse/FindMyMouse.cpp | 55 +++++++++++--- .../MouseUtils/FindMyMouse/FindMyMouse.h | 11 ++- .../FindMyMouse/FindMyMouse.vcxproj | 2 + .../FindMyMouse/FindMyMouse.vcxproj.filters | 6 ++ .../FindMyMouse/WinHookEventIDs.cpp | 14 ++++ .../MouseUtils/FindMyMouse/WinHookEventIDs.h | 5 ++ .../MouseUtils/FindMyMouse/dllmain.cpp | 76 ++++++++++++++++++- .../FindMyMouseProperties.cs | 6 ++ .../FindMyMouseSettings.cs | 13 +++- ...ouseActivationIntToVisibilityConverter.cs} | 16 ++-- .../SettingsXAML/Views/MouseUtilsPage.xaml | 14 +++- .../Settings.UI/Strings/en-us/Resources.resw | 21 ++++- .../ViewModels/MouseUtilsViewModel.cs | 19 ++++- 13 files changed, 222 insertions(+), 36 deletions(-) create mode 100644 src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp create mode 100644 src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h rename src/settings-ui/Settings.UI/Converters/{FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs => FindMyMouseActivationIntToVisibilityConverter.cs} (58%) diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp index b1d1bf4f18..f5f3ff2e00 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp @@ -2,6 +2,7 @@ // #include "pch.h" #include "FindMyMouse.h" +#include "WinHookEventIDs.h" #include "trace.h" #include "common/utils/game_mode.h" #include "common/utils/process_path.h" @@ -246,6 +247,18 @@ LRESULT SuperSonar::BaseWndProc(UINT message, WPARAM wParam, LPARAM lParam) n return HTTRANSPARENT; } + if (message == WM_PRIV_SHORTCUT) + { + if (m_sonarStart == NoSonar) + { + StartSonar(); + } + else + { + StopSonar(); + } + } + return DefWindowProc(m_hwnd, message, wParam, lParam); } @@ -291,26 +304,27 @@ void SuperSonar::OnSonarInput(WPARAM flags, HRAWINPUT hInput) template void SuperSonar::OnSonarKeyboardInput(RAWINPUT const& input) { - if ( m_activationMethod != FindMyMouseActivationMethod::DoubleControlKey || input.data.keyboard.VKey != VK_CONTROL) + // Don't stop the sonar when the shortcut is released + if (m_activationMethod == FindMyMouseActivationMethod::Shortcut && (input.data.keyboard.Flags & RI_KEY_BREAK) != 0) + { + return; + } + + if ((m_activationMethod != FindMyMouseActivationMethod::DoubleRightControlKey && m_activationMethod != FindMyMouseActivationMethod::DoubleLeftControlKey) + || input.data.keyboard.VKey != VK_CONTROL) { StopSonar(); return; } bool pressed = (input.data.keyboard.Flags & RI_KEY_BREAK) == 0; - bool rightCtrl = (input.data.keyboard.Flags & RI_KEY_E0) != 0; - // Deal with rightCtrl first. - if (rightCtrl) + bool leftCtrlPressed = (input.data.keyboard.Flags & RI_KEY_E0) == 0; + bool rightCtrlPressed = (input.data.keyboard.Flags & RI_KEY_E0) != 0; + + if ((m_activationMethod == FindMyMouseActivationMethod::DoubleRightControlKey && !rightCtrlPressed) + || (m_activationMethod == FindMyMouseActivationMethod::DoubleLeftControlKey && !leftCtrlPressed)) { - /* - * SuperSonar originally exited when pressing right control after pressing left control twice. - * We take care of exiting FindMyMouse through module disabling in PowerToys settings instead. - if (m_sonarState == SonarState::ControlUp2) - { - Terminate(); - } - */ StopSonar(); return; } @@ -644,6 +658,11 @@ struct CompositionSpotlight : SuperSonar } } + HWND GetHwnd() noexcept + { + return m_hwnd; + } + private: bool OnCompositionCreate() try @@ -1057,6 +1076,8 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings) m_sonar = &sonar; Logger::info("Initialized the sonar instance."); + InitializeWinhookEventIds(); + MSG msg; // Main message loop: @@ -1072,4 +1093,14 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings) return (int)msg.wParam; } +HWND GetSonarHwnd() noexcept +{ + if (m_sonar != nullptr) + { + return m_sonar->GetHwnd(); + } + + return nullptr; +} + #pragma endregion Super_Sonar_API diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.h b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.h index bf70ee3279..149e52842b 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.h +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.h @@ -3,9 +3,11 @@ enum struct FindMyMouseActivationMethod : int { - DoubleControlKey = 0, - ShakeMouse = 1, - EnumElements = 2, // number of elements in the enum, not counting this + DoubleLeftControlKey = 0, + DoubleRightControlKey = 1, + ShakeMouse = 2, + Shortcut = 3, + EnumElements = 4, // number of elements in the enum, not counting this }; constexpr bool FIND_MY_MOUSE_DEFAULT_DO_NOT_ACTIVATE_ON_GAME_MODE = true; @@ -15,7 +17,7 @@ constexpr int FIND_MY_MOUSE_DEFAULT_OVERLAY_OPACITY = 50; constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_RADIUS = 100; constexpr int FIND_MY_MOUSE_DEFAULT_ANIMATION_DURATION_MS = 500; constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_INITIAL_ZOOM = 9; -constexpr FindMyMouseActivationMethod FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD = FindMyMouseActivationMethod::DoubleControlKey; +constexpr FindMyMouseActivationMethod FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD = FindMyMouseActivationMethod::DoubleLeftControlKey; constexpr int FIND_MY_MOUSE_DEFAULT_SHAKE_MINIMUM_DISTANCE = 1000; struct FindMyMouseSettings @@ -36,3 +38,4 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings); void FindMyMouseDisable(); bool FindMyMouseIsEnabled(); void FindMyMouseApplySettings(const FindMyMouseSettings& settings); +HWND GetSonarHwnd() noexcept; \ No newline at end of file diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj index 28ff78ab9a..8c60095541 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj @@ -93,6 +93,7 @@ + @@ -101,6 +102,7 @@ Create + diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj.filters b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj.filters index 5bd41642ef..4a2f070986 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj.filters +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj.filters @@ -30,6 +30,9 @@ Source Files + + Source Files + @@ -44,6 +47,9 @@ Resource Files + + Header Files + diff --git a/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp b/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp new file mode 100644 index 0000000000..76bfbdc861 --- /dev/null +++ b/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp @@ -0,0 +1,14 @@ +#include "pch.h" + +#include "WinHookEventIDs.h" + +UINT WM_PRIV_SHORTCUT; + +std::once_flag init_flag; + +void InitializeWinhookEventIds() +{ + std::call_once(init_flag, [&] { + WM_PRIV_SHORTCUT = RegisterWindowMessage(L"{1365FFC7-A44E-4171-9692-A3EEF378AE60}"); + }); +} diff --git a/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h b/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h new file mode 100644 index 0000000000..47596969fe --- /dev/null +++ b/src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h @@ -0,0 +1,5 @@ +#pragma once + +extern UINT WM_PRIV_SHORTCUT; // Shortcut is pressed + +void InitializeWinhookEventIds(); \ No newline at end of file diff --git a/src/modules/MouseUtils/FindMyMouse/dllmain.cpp b/src/modules/MouseUtils/FindMyMouse/dllmain.cpp index f29526b335..2d1aa55acc 100644 --- a/src/modules/MouseUtils/FindMyMouse/dllmain.cpp +++ b/src/modules/MouseUtils/FindMyMouse/dllmain.cpp @@ -3,6 +3,7 @@ #include #include "trace.h" #include "FindMyMouse.h" +#include "WinHookEventIDs.h" #include #include #include @@ -22,6 +23,7 @@ namespace const wchar_t JSON_KEY_SPOTLIGHT_INITIAL_ZOOM[] = L"spotlight_initial_zoom"; const wchar_t JSON_KEY_EXCLUDED_APPS[] = L"excluded_apps"; const wchar_t JSON_KEY_SHAKING_MINIMUM_DISTANCE[] = L"shaking_minimum_distance"; + const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"activation_shortcut"; } extern "C" IMAGE_DOS_HEADER __ImageBase; @@ -58,6 +60,9 @@ private: // The PowerToy state. bool m_enabled = false; + // Hotkey to invoke the module + HotkeyEx m_hotkey; + // Find My Mouse specific settings FindMyMouseSettings m_findMyMouseSettings; @@ -157,6 +162,27 @@ public: { return m_enabled; } + + virtual std::optional GetHotkeyEx() override + { + Logger::trace("GetHotkeyEx()"); + if (m_findMyMouseSettings.activationMethod == FindMyMouseActivationMethod::Shortcut) + { + return m_hotkey; + } + + return std::nullopt; + } + + virtual void OnHotkeyEx() override + { + Logger::trace("OnHotkeyEx()"); + HWND hwnd = GetSonarHwnd(); + if (hwnd != nullptr) + { + PostMessageW(hwnd, WM_PRIV_SHORTCUT, NULL, NULL); + } + } }; // Load the settings file. @@ -188,7 +214,15 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings) int value = static_cast(jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE)); if (value < static_cast(FindMyMouseActivationMethod::EnumElements) && value >= 0) { - findMyMouseSettings.activationMethod = static_cast(value); + std::wstring version = (std::wstring)settingsObject.GetNamedString(L"version"); + if (version == L"1.0" && value == 1) + { + findMyMouseSettings.activationMethod = FindMyMouseActivationMethod::ShakeMouse; + } + else + { + findMyMouseSettings.activationMethod = static_cast(value); + } } else { @@ -362,6 +396,46 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings) { Logger::warn("Failed to initialize Shaking Minimum Distance from settings. Will use default value"); } + + try + { + // Parse HotKey + auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_ACTIVATION_SHORTCUT); + auto hotkey = PowerToysSettings::HotkeyObject::from_json(jsonPropertiesObject); + m_hotkey = HotkeyEx(); + if (hotkey.win_pressed()) + { + m_hotkey.modifiersMask |= MOD_WIN; + } + + if (hotkey.ctrl_pressed()) + { + m_hotkey.modifiersMask |= MOD_CONTROL; + } + + if (hotkey.shift_pressed()) + { + m_hotkey.modifiersMask |= MOD_SHIFT; + } + + if (hotkey.alt_pressed()) + { + m_hotkey.modifiersMask |= MOD_ALT; + } + + m_hotkey.vkCode = static_cast(hotkey.get_code()); + } + catch (...) + { + Logger::warn("Failed to initialize Activation Shortcut from settings. Will use default value"); + } + + if (!m_hotkey.modifiersMask) + { + Logger::info("Using default Activation Shortcut"); + m_hotkey.modifiersMask = MOD_SHIFT | MOD_WIN; + m_hotkey.vkCode = 0x46; // F key + } } else { diff --git a/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs b/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs index d30b9307b8..ba97a590d7 100644 --- a/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs +++ b/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs @@ -8,9 +8,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library { public class FindMyMouseProperties { + public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x46); + [JsonPropertyName("activation_method")] public IntProperty ActivationMethod { get; set; } + [JsonPropertyName("activation_shortcut")] + public HotkeySettings ActivationShortcut { get; set; } + [JsonPropertyName("do_not_activate_on_game_mode")] public BoolProperty DoNotActivateOnGameMode { get; set; } @@ -41,6 +46,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public FindMyMouseProperties() { ActivationMethod = new IntProperty(0); + ActivationShortcut = DefaultActivationShortcut; DoNotActivateOnGameMode = new BoolProperty(true); BackgroundColor = new StringProperty("#000000"); SpotlightColor = new StringProperty("#FFFFFF"); diff --git a/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs b/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs index cd65372cdd..921bd62992 100644 --- a/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs +++ b/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs @@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library { Name = ModuleName; Properties = new FindMyMouseProperties(); - Version = "1.0"; + Version = "1.1"; } public string GetModuleName() @@ -29,6 +29,17 @@ namespace Microsoft.PowerToys.Settings.UI.Library // This can be utilized in the future if the settings.json file is to be modified/deleted. public bool UpgradeSettingsConfiguration() { + if (Version == "1.0") + { + if (Properties.ActivationMethod.Value == 1) + { + Properties.ActivationMethod = new IntProperty(2); + } + + Version = "1.1"; + return true; + } + return false; } } diff --git a/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs b/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationIntToVisibilityConverter.cs similarity index 58% rename from src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs rename to src/settings-ui/Settings.UI/Converters/FindMyMouseActivationIntToVisibilityConverter.cs index d4539fe5dc..080de07713 100644 --- a/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationIntToVisibilityConverter.cs @@ -3,26 +3,20 @@ // See the LICENSE file in the project root for more information. using System; +using System.Globalization; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Data; namespace Microsoft.PowerToys.Settings.UI.Converters { - public sealed class FindMyMouseActivationShakeMouseIntToVisibilityConverter : IValueConverter + public sealed class FindMyMouseActivationIntToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { - var activationShake = (int)value; + var selectedActivation = (int)value; + var expectedActivation = int.Parse(parameter as string, CultureInfo.InvariantCulture); - // Assumes 1 is the index for the shake mouse option in the activation method combo box - if (activationShake == 1) - { - return Visibility.Visible; - } - else - { - return Visibility.Collapsed; - } + return selectedActivation == expectedActivation ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, string language) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseUtilsPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseUtilsPage.xaml index 77ee711c07..4db60c56e4 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseUtilsPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseUtilsPage.xaml @@ -11,7 +11,7 @@ AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> - + + + + Visibility="{x:Bind Mode=OneWay, Path=ViewModel.FindMyMouseActivationMethod, Converter={StaticResource FindMyMouseActivationIntToVisibilityConverter}, ConverterParameter=2}"> + + + +