Hello there. I've found a solution to that. You would need AutoHotKey and Ahk2Exe tools.
I've created two scripts:
"C:\Users\MyWindowsUser\Scripts\ChangeLayout.ahk"
#Requires AutoHotkey v2.0
#SingleInstance Force
; Windows keyboard layout IDs
; US = 00000409
; Russian = 00000419
hklEN := DllCall("LoadKeyboardLayoutW", "Str", "00000409", "UInt", 0x00000002, "Ptr")
hklRU := DllCall("LoadKeyboardLayoutW", "Str", "00000419", "UInt", 0x00000002, "Ptr")
toggleLayout() {
global hklEN, hklRU
hwnd := WinActive("A")
if !hwnd
return
tid := DllCall("GetWindowThreadProcessId", "Ptr", hwnd, "UInt*", 0, "UInt")
cur := DllCall("GetKeyboardLayout", "UInt", tid, "Ptr")
lang := cur & 0xFFFF
target := (lang = 0x0419) ? hklEN : hklRU
PostMessage 0x50, 0, target,, "ahk_id " hwnd ; WM_INPUTLANGCHANGEREQUEST
}
F12::toggleLayout()
"C:\Users\MyWindowsUser\Scripts\WordWithLayout.ahk"
#Requires AutoHotkey v2.0
#SingleInstance Force
layoutExe := "C:\Users\MyWindowsUser\Scripts\ChangeLayout.exe"
wordExe := "C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"
if !ProcessExist("ChangeLayout.exe")
Run('"' layoutExe '"')
cmd := '"' wordExe '"'
for _, arg in A_Args
cmd .= ' "' arg '"'
RunWait(cmd)
Convert both of them to .exe file.
Then you need to change your .desktop launcher in linux. I use KDE, so for me it was this file for MS Word:
~/.local/share/winapps/apps/word-o365-x86/info
You have to change executable line to this one:
WIN_EXECUTABLE="C:\\Users\\MyWindowsUser\\Scripts\\WordWithLayout.exe"
Originally posted by @lazbaphilipp in #848 (comment)
Hello there. I've found a solution to that. You would need AutoHotKey and Ahk2Exe tools.
I've created two scripts:
"C:\Users\MyWindowsUser\Scripts\ChangeLayout.ahk"
"C:\Users\MyWindowsUser\Scripts\WordWithLayout.ahk"
Convert both of them to .exe file.
Then you need to change your .desktop launcher in linux. I use KDE, so for me it was this file for MS Word:
~/.local/share/winapps/apps/word-o365-x86/infoYou have to change executable line to this one:
WIN_EXECUTABLE="C:\\Users\\MyWindowsUser\\Scripts\\WordWithLayout.exe"Originally posted by @lazbaphilipp in #848 (comment)