Repository navigation
[Feature] PowerToys hotkey conflict detection - #41029
Shawn Yuan (shuaiyuanxx) merged 63 commits into
Conversation
remove the ui for shortcut conflicts and prepair for rebase to the new ui design. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Update Shortcut control. Update UI for hotkey conflict in AdvancedPaste module. Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Added navigation to hotkey conflict detection dialog card. Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
| { | ||
| private static IPCResponseService _instance; | ||
|
|
||
| public static IPCResponseService Instance => _instance ??= new IPCResponseService(); |
There was a problem hiding this comment.
Right now, you cannot do unittest easily for the core logic here, given it has strong binding with Shell related implementation.
Consider to make IPCResponseService, and use DI to inject the right implementation accordingly.
For DI, you can refer to CommandPalette, you can see in its App.xaml.cs, it will register the singleton creation for instance.
As the result, you can inject different implementation during unittest.
There was a problem hiding this comment.
I think if this Service can be replacing implementation, probably GlobalHotKeyConfictManager as well as PageViewModelBase.cs (or just pick one ViewModel) can be do unittest.
|
|
||
| namespace Microsoft.PowerToys.Settings.UI.ViewModels | ||
| { | ||
| public class ShortcutConflictViewModel : PageViewModelBase, IDisposable |
There was a problem hiding this comment.
I believe both this ViewModel (or you can pick anyone inherit it) and the SettingsFactory can do unittest.
Especially if you already want to see if there is anything "you worry" people doesn't implement correctly, instead of failing during runtime, you can fail at unittest instead of just write debug information.
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
This guidance is intended to help developers understand how to add conflict detection support when introducing new hotkeys. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements comprehensive hotkey conflict detection and resolution for PowerToys, adding real-time conflict checking and a centralized management interface. The implementation provides visual indicators for hotkey conflicts, a dedicated conflict resolution dialog, and integration throughout the Settings UI.
Key changes include:
- Implementation of global hotkey conflict management with IPC communication for real-time updates
- Creation of a new
PageViewModelBaseclass that standardizes conflict handling across all module ViewModels - Addition of hotkey conflict detection infrastructure with visual feedback in hotkey controls
Reviewed Changes
Copilot reviewed 102 out of 104 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/settings-ui/Settings.UI/ViewModels/PageViewModelBase.cs |
New base class providing conflict management functionality for all module ViewModels |
src/settings-ui/Settings.UI/Services/GlobalHotkeyConflictManager.cs |
Central service for managing hotkey conflicts with IPC communication |
src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictWindow.xaml |
New dedicated window for viewing and resolving hotkey conflicts |
src/settings-ui/Settings.UI/Library/HotkeySettings.cs |
Enhanced with conflict detection properties and change notifications |
Multiple ViewModels (*ViewModel.cs) |
Updated to inherit from PageViewModelBase and implement hotkey conflict detection |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| { | ||
| Settings.Properties.ToggleEasyMouseShortcut = value ?? MouseWithoutBordersProperties.DefaultHotKeyToggleEasyMouse; | ||
| NotifyPropertyChanged(); | ||
| NotifyModuleUpdatedSettings(); |
There was a problem hiding this comment.
The method NotifyModuleUpdatedSettings() is being called but is not defined in this class or its base class. This will cause a compilation error.
| Settings.Properties.LockMachineShortcut = value; | ||
| Settings.Properties.LockMachineShortcut = value ?? MouseWithoutBordersProperties.DefaultHotKeyLockMachine; | ||
| NotifyPropertyChanged(); | ||
| NotifyModuleUpdatedSettings(); |
There was a problem hiding this comment.
The method NotifyModuleUpdatedSettings() is being called but is not defined in this class or its base class. This will cause a compilation error.
| Settings.Properties.ReconnectShortcut = value; | ||
| Settings.Properties.ReconnectShortcut = value ?? MouseWithoutBordersProperties.DefaultHotKeyReconnect; | ||
| NotifyPropertyChanged(); | ||
| NotifyModuleUpdatedSettings(); |
There was a problem hiding this comment.
The method NotifyModuleUpdatedSettings() is being called but is not defined in this class or its base class. This will cause a compilation error.
| Settings.Properties.Switch2AllPCShortcut = value; | ||
| Settings.Properties.Switch2AllPCShortcut = value ?? MouseWithoutBordersProperties.DefaultHotKeySwitch2AllPC; | ||
| NotifyPropertyChanged(); | ||
| NotifyModuleUpdatedSettings(); |
There was a problem hiding this comment.
The method NotifyModuleUpdatedSettings() is being called but is not defined in this class or its base class. This will cause a compilation error.
| int isEnabled = 0; | ||
| NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0); | ||
|
|
||
| Utilities.NativeMethods.SystemParametersInfo(Utilities.NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0); |
There was a problem hiding this comment.
The namespace Utilities.NativeMethods appears to be incorrect. Based on the original code pattern, this should likely be NativeMethods.SystemParametersInfo without the Utilities prefix.
| Utilities.NativeMethods.SystemParametersInfo(Utilities.NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0); | |
| NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0); |
Summary of the Pull Request
Implements comprehensive hotkey conflict detection and resolution system for PowerToys, providing real-time conflict checking and centralized management interface.
PR Checklist
TODO Lists
ShortcutConflictDialogContentControlto align with the specShortcutConflictDialogContentControlShortcut Conflict Support Modules
Demo videos
demo1.mp4
demo2.1.mp4
demo3.1.mp4
demo6.mp4
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Manually validation performed.