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
Cannot override system shortcuts on Windows and OS X #11
Comments
Thats very possible. Special shortcuts that are used by OS cannot be easily overriden. The interesting part is that no errors are beeing reported. I tested ctrl+print on windows right now, and by debugging saw that the windows-os funktion So apparently, there are hotkeys that can be registered, but are then ignored by windows. And since the OS functions don't report any error, there is no way for me to find that out... I haven't tried on OsX, but I'm pretty sure it's the same situation there. |
ShareX does this though. I'm talking to the dev about it. |
Shure I bet it's possible, but not with the standard Hotkey stuff. There are most likley other APIs like keyboard hooks you need to utilize for that. But that's out of scope for this project. |
https://github.com/ShareX/ShareX/blob/b5cfbc61fc222eeb4ad2f6957dcc09f78c4eb8a5/ShareX.HelpersLib/Input/HotkeyForm.cs#L47 |
Interesting. I tried it out earlier, but nothing was delivered for that specific key combination. It is possible that If you can find out the exact values for keycode and modifiers used by XShare for ctrl+print (this value), you could try to set them as native shortcut ( |
There we have it (See https://msdn.microsoft.com/de-de/library/windows/desktop/dd375731(v=vs.85).aspx):
So as expected, it is simply translated incorrectly. There is nothing I can do about that. It seems, there is no Solution: Use the native keycodes directly, by passing I guess it's a very similar situation for OsX. You need to figure out the virtual key code the corresponds to the "snapshot" key, and set it as native shortcut. |
Maybe translate print to snapshot? I'll look at macos in a bit |
The thing is: print itself is a valid key, so simply translating print to snapshot would not work. However, it would be possible to add some kind of key mapping. This way you as developer could add such "macros" by yourself, whenever the need arises. In your application code, it would propably look like that:
Would that be satisfying for you as a solution? This way you can keep "ctrl+print", but still get the correct result. |
The problem is these are by user input, plus it'd make more sense to #ifdef Q_OS_WIN
QHotkey::addGlobalMapping(Qt::Key_Print, VK_SNAPSHOT);
#endif |
Well, we can't possibly know what a user will enter ;) So adding this function makes it possible for you to add those mappings as reported as missing by your users. But I don't agree to simply map keys. Doing that for your example would prevent one from using the normal
Of course you have to try that out. Maybe you need I will add something like that once I have a windows machine, and use this problem as an example on how to use the mapping. |
Aha, I see. Makes sense. |
Any updates on this issue? |
Im sorry, I already have it implemented, but apparently forgot to push... As soon as I get to the machine the commit is on, I will push it (should be in the next 24 hours) |
Hello!
I've received complaints from my Windows and OS X users that they cannot override Ctrl+Print and CMD+Shift+4 respectively. The shortcuts get registered but never fire.
The text was updated successfully, but these errors were encountered: