-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Key shortcuts quirky when elevated (Implement a centralized shortcut key handler) #6060
Comments
In order to implement this feature, we need to refactor existing code so that ColorPicker is shown immediately after being launched. Can this be done using |
@ivan100sic I don't really know what you mean by showing immediately after being launched, but you probably want to change the code in KeyboardMonitor.cs - Hook_KeyboardPressed - here you can see what happens when you press activation key. I assume you want to replace local low keyboard hook with your logic, this would be the place to do so. |
We want to change ColorPicker so that:
|
I don't like this approach due to several issues with that:
Also dependency should be reversed - each module should register itself in some keyboard manager and let it know that it want to react on some hotkey. Parent (in this case The runner) should not know about actual modules that are using its keyboard manager. |
@martinchrzan Initially we are not going to support arguments when starting the app, but for sure we can add a startup argument.
Not sure what do you mean, is it a problem of not receiving the Esc event or about how to proceed to quit the .exe? |
What are the reasons for not implementing the keyboard manager in the runner? |
I have nothing against implementing it in runner, I was just saying that modules should register themselves (think of dependency injection) rather than runner knowing explicitly about all modules that are interested in key hooks. This logic should be in runner. I do not have any hard data about performance, just doing some tests:
Now I noticed even a bigger issue - activation key handling is not enough for color picker! I am running a low level mouse hook and that one needs to run in admin mode as well - if it doesn't, you are not able to pick the color, because the left mouse key is not fired if clicking into an elevated app. |
The original design made the runner the coordinator for all modules. The runner is responsible to load and start each module and coordinate with the settings app (modules should not invoke the Settings app directly).
PT Run is one of those modules and for it the plan is to not restart it every time. With regard to the mouse hook, it seems also clear that ColorPicker needs to run elevated all the time, trying to use a centralized mouse hook is not an ideal solution because we don't want to keep the mouse hook running when it's not needed, so it would make more sense and be more flexible if it runs on demand inside the application itself (we do the same in FZ, we have a keyboard and a mouse hooks active only while a windows is dragged). |
PT Run not working with any hotkey I set. I've attached logs if it helps. |
@rdorris |
@enricogior |
@rdorris |
The centralized shortcut key handler will allow modules that don't run elevated to be invoked when the foreground window is elevated. It will require the runner to run elevated.
The text was updated successfully, but these errors were encountered: