S
S
simon_db2021-02-18 13:05:45
X Window System
simon_db, 2021-02-18 13:05:45

Is there a solution to switch keyboard layout in Window and X11 (wsl2) by CapsLock combination?

Hello. I have idea installed in WSL2. On Windows 10, it is forwarded through X11 (XcXsrv). In XcXsrv, the layout switching rule "-xkblayout us,ru -xkboptions grp:caps_toggle" is configured. This rule works fine, but only if the same rule is not set for switching layouts in Windows. That is, if you enable CapsLock layout change in Windows, then the layout does not switch in the X11 session. That is, the problem is that if you set up a single key combination to switch layouts in Windows and X11, then in Windows it switches, but in an application that is displayed through X11 it remains the same. Apparently Windows intercepts this combination and does not send it to X11. Is there any solution to this issue.

I tried to work with switching ALT + Shift (simultaneously in X11 and Windows), but even here there are problems, in the X11 application (in this case Idea), the combination Ctrl + Shift + Alt + T is not reproduced. Shift flies out of this combination, idea thinks, that I press Ctrl+Alt+T.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Slinkin, 2021-07-22
@niknils

you can try to make the key combination for switching the language in Windows and / or in X11 different, and then write a program , for example, using pyHook or even PowerShell , which would wait (listen) for specific keystrokes and print its own. that is, pressing '[Caps Lock]' provokes pressing other keys that change the language .
I think it's better to run such a tool on the Windows side.
As far as I know, this cannot be done through WSH / VBScript, since there are no such tools. it might be possible to call the libraries via VBScript, but I think the PowerShell (slow out of the box) and pyHook (requires Python) options are better.

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question