-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MouseJump] WIP - long-lived executable with hotkey handler (#26073) #27558
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There's a lot of files touched in this PR, so here's a summary in case it helps work though it quicker... MouseJump
MouseJumpUI
The remaining handful of changes are really just to integrate the ones above into the application. |
Btw, I don't have any hard stats on performance, but it certainly feels a lot more responsive now that it's a long-lived background task rather than having to launch a whole new MouseJump.exe process every time the hotkey is activated. Have a play with the current PowerToys release first to get a feel for how quickly the popup is displayed before you try the one in this PR, and see if it feels faster... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mikeclayton ,
Thank you for the contribution!
Sorry for the delay in reviewing the PR, since we had entered "wrap up release" mode last week.
Giving the PR a try, there's some shortcuts that are not supported anymore, but they were without the changes. I tested Win+J, for example. This is through the use of shortcuts instead of low level keyboard hooks. LLKH however shouldn't be used in C#.
I think a better approach here would be to let the module interface keep handling activation by using a event instead to signal actiavation to MouseJumpUI. No need to add all that boiler code to the project this way.
This is used, for example, by Peek, ColorPicker, TextExtractor(PowerOCR) and even PowerLauncher when using the centralized key hook.
TextExtractor might be the best one to look at to understand this, since it's pretty similar in what it does (running in the background to then show an overlay). If you look in the solution for the strings SHOW_POWEROCR_SHARED_EVENT
and ShowPowerOCRSharedEvent
it should give a good idea of the workflow. The modules interface registers the event and then the UI listens for it with NativeEventWaiter.WaitForEventLoop
.
What do you think about this?
Someone in the core team can help bring this method in if you want :) |
@jaimecbernardo - No worries. I'm on leave at the moment, but I'll take a look when I'm back home - I'll give it a go myself and yell if I get stuck :-).. I'll put this back to WIP in the meantime... |
I'm going to close this PR as the proposed fix re Windows Events is probably easiest to just start on again from main... |
Summary of the Pull Request
Changes the way activation works in Mouse Jump to use a long-lived background process that handles its own hotkey activation, rather than having the main runner launch a short-lived instance of MouseJumpUI.exe every time the activation keys are pressed.
This reduces the time to display the preview popup since the Mouse Jump application itself doesn't have to load up from scratch for every activation.
PR Checklist
Detailed Description of the Pull Request / Additional comments
The main PowerToys runner now simply starts MouseJumpUI.exe when the tool is enabled, and terminates the process when the tool is disabled - this is similar to how FancyZones works, except there's no graceful IPC at present to signal to the MouseJumpUI.exe instance to close itself before it gets terminated.
MouseJumpUI.exe installs its own hotkey monitor (using the shared config file to determine what key sequence to register, and listens for activation. When it receives a Windows message that thee hotkey has been activated it displays the popup form, and hides it again when the user clicks or cancels the popup form.
Validation Steps Performed