I would like to have keyboard-layout dependent hotkeys for a very limited number of layouts, e.g. ^B on a US layout and ^+F on a German layout.
I know how to achieve this using DllCall("GetKeyboardLayout") and similar functions, but it is cumbersome to manage and sub-optimal performancewise to call at each keypress.
Since it is already possible to define hotkeys vkXX, and it is possible to define hotkeys like scYYY, the keyboard hook already should have all the required information, so it would probably not be too hard to implement hotkeys which only fires if a key with a specific vk code AND scancode was pressed.
Combined hotkeys vkXXscYYY
-
- Posts: 13
- Joined: 07 Sep 2022, 04:04
Re: Combined hotkeys vkXXscYYY
GetKeyboardLayout is surely a very fast call. There is probably a higher, but still insubstantial, cost to DllCall itself. I think it's also possible to listen for changes to the input language with OnMessage.
Implementing vkXXscYYY will likely be difficult. The hotkey recognition code is designed to handle each event either by scancode or by virtual keycode. This part of the code is kind of "monolithic" and difficult to maintain, not fun to work on.
Nonetheless, I plan to do this at some point.
Implementing vkXXscYYY will likely be difficult. The hotkey recognition code is designed to handle each event either by scancode or by virtual keycode. This part of the code is kind of "monolithic" and difficult to maintain, not fun to work on.
Nonetheless, I plan to do this at some point.
-
- Posts: 13
- Joined: 07 Sep 2022, 04:04
Re: Combined hotkeys vkXXscYYY
1. It occurred to me that my proposal would only be semi-useful. For instance, most letter keys have the same vk and sc on both the German and US keyboard. It would be necessary to look for a specific key/sc combination which is different, and not necessarily the key(s) to be remapped.lexikos wrote: ↑10 Sep 2023, 21:33GetKeyboardLayout is surely a very fast call. There is probably a higher, but still insubstantial, cost to DllCall itself. I think it's also possible to listen for changes to the input language with OnMessage.
Implementing vkXXscYYY will likely be difficult. The hotkey recognition code is designed to handle each event either by scancode or by virtual keycode. This part of the code is kind of "monolithic" and difficult to maintain, not fun to work on.
Nonetheless, I plan to do this at some point.
2. The reason I cannot use OnMessage to remap keys in all programs is apparently the same why the following does not work.
I tried to use one of the GetKeyName/GetKeySC/GetKeyVK functions in a condition to check for different keyboard layouts:
Code: Select all
#HotIf (GetKeyName("sc015") == "y")
...
I want this to work in all windows (not just the window of the script).
Who is online
Users browsing this forum: No registered users and 17 guests