Switching layout while certain keys are pressed

Get help with using AutoHotkey and its commands and hotkeys
AndrewKun
Posts: 24
Joined: 03 Jun 2015, 12:03

Switching layout while certain keys are pressed

05 Aug 2020, 06:51

Hi,

I'm a Colemak user, and as with most Dvorak/Colemak users, I have issues with keyboard shortcuts. I heard MacOS have a built-in feature that, whenever any of the following keys are pressed, the layout is switched to QWERTY: Ctrl/Cmd, Alt, Shift, Meta/Win

Then, as soon as all of those keys are releasd, the layout is back to Dvorak/Colemak.

Can something like this be implemented in AHK on Windows? Any help is appreciated.
AndrewKun
Posts: 24
Joined: 03 Jun 2015, 12:03

Re: Switching layout while certain keys are pressed

06 Aug 2020, 04:21

mshafer1 wrote:
05 Aug 2020, 08:03
actually, Win10 has this builtin as well: https://www.windowscentral.com/how-change-your-keyboard-layout-windows-10
Win + Space
Thank you, unfortunately it's not what I need, as this shortcut scrolls between the available layouts. What I need, on the other hand, is that layout is only switched from default to another while any of the specified keys are pressed, and switched back while the key is released. What complicates that matter, is that shortcuts typically consists of multiple keys, e.g. Alt+Shift+R, or Ctrl+Alt+Shift+S e.t.c. So, I imagine the logic will be:

while (any of [ctrl, alt, win] key is pressed down) {
switch layout to specific one, and ignore the rest of the keys from [ctrl, alt, win] range.
}

So then when the first key is released (up), switch layout back to default one.
mshafer1 wrote:
05 Aug 2020, 08:03
but also looks like https://www.autohotkey.com/boards/viewtopic.php?f=6&t=18519 has a library where you can call SetDefaultKeyboard, for example: https://www.autohotkey.com/boards/viewtopic.php?t=19534
Yes, this looks like the function I want, thank you. Now I need to figure out how to implement that. I'll try to do it myself, but any hints are appreciated.
mshafer1
Posts: 49
Joined: 16 Jul 2017, 14:49
GitHub: mshafer1
Contact:

Re: Switching layout while certain keys are pressed

06 Aug 2020, 13:11

Another option is to manually code the whole thing - https://autohotkey.com/board/topic/7462-qwerty-remapped-as-dvorak/

Maybe make keyboard shortcuts to start and stop that script?? (You could use Hotkey, but that would be a lot of hotkeys to turn on and off - so at minimum I would suggest code-gen'ing that)

Return to “Ask For Help”

Who is online

Users browsing this forum: aifritz, Google [Bot], mikeyww and 45 guests