winapps-org / winapps-org/winapps
Solution to layout (language) changing in MS Word and etc
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 16k
- Forks
- 508
- Avg merge
- 13h 35m
- Merged PRs (30d)
- 3
Description
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 https://github.com/winapps-org/winapps/discussions/848#discussioncomment-16627284
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the KDE launcher definition at ~/.local/share/winapps/apps/word-o365-x86/info and the two AutoHotkey scripts included in the issue. Check whether this user-specific MS Word layout workaround fits the project's documentation or launcher configuration; the issue names no repository file, test, or defined acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, shell
- Domain
- desktop, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100