There is a solution for my problem, that possible without any external dependencies!!
According to https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Keyboard.html native Emacs can:
w32-apps-modifier
Variable: Modifier to use for the "Apps" key.
w32-lwindow-modifier
Variable: Modifier to use for the left "Windows" key.
w32-rwindow-modifier
Variable: Modifier to use for the right "Windows" key.
w32-scroll-lock-modifier
Variable: Modifier to use for the Scroll Lock ON state.
In article Keyboard and mouse class drivers it is mentioned that it is possible to adjust keyboard layout (for all user) playing with keycodes.
There is Keyboard Scan Code Specification for PS/2 compatible keyboards.
Firstly I try to use w32-scroll-lock-modifier
:
(setq w32-scroll-lock-modifier 'super)
in order to keep other modifiers without changes:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
; CapsLock => ScrollLock
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,46,00,3a,00,00,00,00,00
but Scroll Lock keeps state, so releasing after first pressing keeps scroll
on as if super key is still pressed and not released.
It can be emacs-w32 v24 Cygwin bug. So I moved further and succeeded with:
(when (eq window-system 'w32)
(setq w32-apps-modifier 'super))
But my hands trained to work with LWin, and not with Caps Lock. So I made 2 swaps and with:
; CapsLock (3a,00) => LWin (5b,e0); LWin (5b,e0) => Apps (5d,e0)
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,5b,e0,3a,00,5d,e0,5b,e0,00,00,00,00
LWin key is actually Apps key and LWin moved to Caps Lock.
Now my Windows keyboard workflow doesn't differ from X workflow.
Of course I disabled layout switching to preserve Ctrl / Alt / Shift solely to Emacs with:
[HKEY_CURRENT_USER\Keyboard Layout\Toggle]
; The value 1 specifies that LEFT ALT+SHIFT switches locales.
; The value 2 specifies CTRL+SHIFT.
; 3 disables the key sequence altogether.
; I decide use AutoHotkey to switch locales.
;
; These customisations have affect at least after logout/login.
"Hotkey"="3"
"Language Hotkey"="3"
"Layout Hotkey"="3"
There is a way to switch layout in Windows 10 with Win + Space (or Caps Lock + Space after keyboard layout twicks)!