dual icon indicating copy to clipboard operation
dual copied to clipboard

Troubles with non-english layout.

Open jumper047 opened this issue 5 years ago • 4 comments

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

jumper047 avatar Jun 17 '19 11:06 jumper047