Recognize modifiers keys in EFI - uefi

when you press a modifier key in macOS,Windows or Linux,... The On-screen Keyboard shows which modifiers are being pressed, even when you don't press a normal key. So how to do the same thing in EFI(EDKII).
Thanks.

Related

How to remap Caps Lock to Win key?

I have an IBM Model M keyboard that doesn't have a Win key, and I'd like to remap CapsLock using Autohotkey.
Ideally, I'd like to remap all possible combinations at once (eg. CapsLock->Windows) rather than having to treat each combination in a seaprate line (eg. CapsLock+Shift+W -> Win+Shift+W)
The script below works for simple key combos, like Win+R.
*Capslock::Send "{LWin down}"
*Capslock Up::Send "{LWin up}"
But it's not working when I press down multiple modifier keys, for example Win+Shift+W.
The simple remap below also isn't working for combined modifiers:
Capslock::LWin
If I open On Screen Keyboard, remove focus, and press down CapsLock and L-Alt, it shows me both Win and L-Alt are pressed.
Pressing the thrid key, for example W, would not be shown by On Screen Keyboard even when using a real Win key on another keyboard.

Unity rebinded Keys names are wrong on azerty keyboard

So I have a working rebinder script, but the problem is when I want to display the rebinded keys names.
The code below returns the right names for a qwerty keyboard, but not for a azerty keyborad !
However, the bindings are correct, since the controls are working regardless of the keyboard layout. The only broken thing is the display, that is to say the value fed in the "UpdateText(string key)" void:
RebindSection[j].UpdateText(InputControlPath.ToHumanReadableString(
Actions[j].action.bindings[bindingIndex].effectivePath,
InputControlPath.HumanReadableStringOptions.OmitDevice));
Does anyone know how I can get the real name of the key and not the location of the key in us keyboard ?
Edit: I'm developing the game on ubuntu, And the script I wrote above works in the editor, but not in the builds...
To put it bluntly, the Unity Engine uses physical key signal to detect inputs from the keyboard, but as it's kinda hard to guess what an "0100100" keyboard signal means, it puts a QWERTY-based tag on the key's signals so that we, devs, can at least have an idea of what is going on.
The only kinda-problem that comes from this approach is the differential keys that exist between the 2 types of keyboards such as the "< >" key right to the left shift key that doesn't always exists on the QWERTY keyboard. (Most AZERTY keyboards has a small left shift key and a key in-between it and the W key with "<>" while most QWERTY keyboards just have a wide Left Shift key that covers both key at once.)
That's where the physical key kinda hits a snag as, in such case, the "<>" of the AZERTY keyboard key is actually just... absent on the QWERTY keyboard. Unity can register the key (as it does have its own unique signal), but that would make the key inaccessible on a QWERTY keyboard. Those kind of keys are called "White Keys" in development jargon which has a kinda rule to "Never use those by default unless it's for action available elsewhere. Leave it to the user to define those if possible.".
If you want the actual keyboard-based key name, you can access the key string with the following code:
Keyboard.current.KEYCODE.displayName
Replacing "KEYCODE" with the key name such as "aKey" which will give you the physical key located at "A" on a QWERTY keyboard based on your current keyboard language & layout.

Match both shift keys being pressed in AutoHotKey

One of my keyboards has a larger Shift key where my pipe/backslash key normally is. Is there a way to match Shift-Shift in AutoHotKey (i.e. both Shift keys pressed) so that I can still type pipes (|) in the way I would with my other keyboards? I have tried simply ++ but that seems to equate to Shift-+.
Thanks to #0x464e's comment, I was able to find the Virtual Key codes (VKs) for left shift and right shift by:
Adding ++::Send {U+007C} to my ahk script (right of the :: is irrelevant here, this is just so that Shift shows up in the key history)
Right click the script in the system tray, click Open, select Key History in the View tab.
Type Shift-+ a few times with each Shift key into a text editor.
Hit F5 in the Key History window and read off the values for Virtual Key for Left Shift and Right Shift (VKA0 and VKA1 respectively in my case).
Then I added the following rules to my ahk script to send a pipe whenever I held the Right Shift key and pressed the Left Shift key:
VKA1 & VKA0::Send {U+007C}

Trying to recognize Fn + V on my keyboard

I hate that when I'm using my laptop on its own I often type FN+v when I mean to paste. So I decided to solve my problem with AHK. I installed a keyboard hook in my main script,and used that to extract the fn keys value, 163. My initial test worked, but adding the & to make it a modifier does not. What am I overlooking?
So this doesn't work
SC163 & v::
MsgBox, %A_ThisHotkey% was pressed.
return
but this did work
SC163::
MsgBox, %A_ThisHotkey% was pressed.
return
When you hit the FN key, it might be remapping the "v" to something else (like "Media_Play_Pause" button) in the keyboard driver. Therefore the key code wouldn't be SC163 & v but something like SC159.
The Special Keys section for mentions a method to get the Scan code:
Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar.
Double-click that script's tray icon to open its main window.
Press one of the "mystery keys" on your keyboard.
Select the menu item "View->Key history"
Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see Special Keys.
If your key is detectable, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).

How do read DrRacket keybindings (and in general)

I have never been able to understand keybinding syntax well (bc it's hard to google if you don't know the name of a symbol to begin with!).
In DrRacket, I see bindings like "c:g" or "esc;g" .. I have tried hitting those keys in order to no avail. I have tried hitting them simultaneously. Nothing seems to work.
What do they mean? And, in general, how does one go about understanding this syntax?
A generic shortcut:
<modifier-key-1>:<key-1>;<modifier-key-2>:<key-2>;...;<key-n>
means:
press both <modifier-key-1> and <key-1> (that is: start pressing the modifier key, and while it is pressed, press key-1, then release both),
then, immediately, perform the same operation for the remaining combinations of keys,
finally, press <key-n>
Where the standard modifier keys are:
c - the control key modifier
s - the shift key modifier
m - the meta key modifier (not present in many keyboards)
a - the alt key modifier (sometimes already used to insert special characters)
(actually there are other key modifiers in different keyboards).
So, c:x;c:g;s:t means the following combination: Control-X, followed by Control-g, followed by Shift T (this insert Σ, the greek uppercase letter sigma in DrRacket), while c:x;c:g;s means Control-X followed by Control-G followed by the key s (insert the greek letter ς). Finally, the combination m-c-right means press both the modifier keys Meta and Control with the right arrow key.
When the meta modifier key is not present, it is often replace by the ESC (escape) key. Since this is not a key modifier, but a regular key, in this case it must be pressed and released before the next character. In other words, esc:g means: press the ESC key, release it, then immediately press the regular G key. esc-c-right means: press ESC, release it, then press C-→.
Moreover, when the ALT key is already used by the operating system to insert special characters, like in Mac OS X, it can be used as regular modifier key in DrRacket by setting a special preference (in Preferences > Editing > General).
In DrRacket you can find the current keybinding with the menu item: Edit > Keybindings > Show Active Keybindings, and you can find the relevant documentation here.