Skip to content

Troubles with non-english layout. #10

@jumper047

Description

@jumper047

First, thank you for your code - i cant live without dual role keys,
and your script is only working solution on windows.
Is use dual as BigCtrl replacememnt - with config smth like that.

*Space::
*Space UP::dual.combine("RCtrl", A_ThisHotkey)

Everything works
fine except second layout. In russian layout keys with dots, braces,
etc produces them not regarding what layout is currently selected. So,
i found workaround for that - add for every wrong working key.

*,::
StringReplace, KeytoSend, A_ThisHotkey, *
dual.combo(",")
if (current_is_ru() && !GetKeyState("RCtrl") && !GetKeyState("RAlt") && !GetKeyState("LAlt")) {
	if (GetKeyState("Shift")) {
	dual.SendInput("{Shift Down}{vkBC}{Shift Up}")
} Else {
	dual.SendInput("{vkBC}")
}
} Else {
		SendInput {Blind}{%KeyToSend%}
}
Return

; Some helper functions
; RU - 0x4190419
; EN - 0x4090409
current_layout()
{
  SetFormat, Integer, H
  WinGet, WinID,, A
  ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
  InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt")
  Return InputLocaleID
;  if (InputLocaleID == "0x4190419") Return True  
}

current_is_ru()
{
	CurrLoc := current_layout()
	if(CurrLoc = "0x4190419") {
		return True
	}
}

I uploaded entire config here - https://gist.github.com/jumper047/ae15b5e484bfe207d14387b6ff82c5f1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions