Combined hotkeys vkXXscYYY

Propose new features and changes
Federhalter
Posts: 13
Joined: 07 Sep 2022, 04:04

Combined hotkeys vkXXscYYY

06 Sep 2023, 09:00

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.
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Combined hotkeys vkXXscYYY

10 Sep 2023, 21:33

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.
Federhalter
Posts: 13
Joined: 07 Sep 2022, 04:04

Re: Combined hotkeys vkXXscYYY

11 Sep 2023, 06:37

lexikos wrote:
10 Sep 2023, 21:33
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.
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.

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")
...
The input message change is only sent to the active window (so the script never sees this message.) I can not intercept a message for windows of other (non-AHK) programs.

I want this to work in all windows (not just the window of the script).

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 17 guests