• You are not logged in.
  • Index
  • Technical
  • Windows: switching layout from command line?

    Windows: switching layout from command line?

    • Started by spremino
    • 3 Replies:
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Hello,

    sometimes I have to switch keyboard layout to allow a colleague of mine to use my Windows computer. I despise having two layouts active at once, since Windows (XP) seems to switch at random, and I'm a bit annoyed about having to use the Control Panel applet each time - sometimes I have to switch more than once in a row - and I wish there was a faster way.

    Is there a program to switch keyboard layout from command line on Windows? I think I've found the registry key which does the hack, but  I'd prefer a documented solution.

    Having to log out and log in again would not be an issue.

    Thanks in advance.

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Windows doesn't switch at random. You have to disable the hotkey that switches with Alt+Shift or Ctrl+Shift, because you'll mishit that one causing seemingly random switches. Those tend to get activated each time you install a new layout so be aware. Instead, use the Ctrl+Shift+# hotkey option to switch to a specified layout and another one to switch back.

    You'll have to teach your colleague that as long as your layout is the default he'll have to activate the other layout for each app he uses.

    Switching layout by registry key is something I haven't tried out so I don't know whether it'll work on the fly or not. I'm suspecting not, since some dynamic links are made to allow the keyboard API to address the right layout DLL, but what do I know.

    I'd love to be able to switch focus to a different DLL without modifying the registry! Then I could provide an alternative DLL with my own layout and switch to that one portably. Yeah, I don't think I'll succeed with that. It'd also be potentially insecure I fear.

    If on-the-fly layout switching by hotkey strikes you as suboptimal (I get annoyed at the per-application focus, myself), I recommend using PKL instead. I've set my PKL to use a Ctrl+Shift+# type hotkey to switch between my extended Colemak and a 'virtualkey' QWERTY layout which is transparent (but allows Extend key goodness - yay!); another option is to just use a Suspend hotkey (like my wife does at home whenever she starts typing and experiences the well-known 'colemak/QWERTY aphasia' disorientation). I use Crtl+Shift+` which is very easy to hit yet complex enough to not get in the way of other apps' hotkeys. Either way, there's an icon in the system tray telling me which layout is active (or whether PKL is suspended) at the moment.

    Last edited by DreymaR (25-Mar-2010 11:24:52)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189
    DreymaR said:

    Windows doesn't switch at random. You have to disable the hotkey that switches with Alt+Shift or Ctrl+Shift, because you'll mishit that one causing seemingly random switches. Those tend to get activated each time you install a new layout so be aware.

    DreymaR, you saved my day. Thanks! I didn't know about this issue.

    Since the need to switch layout is rare, and the ` and ~ are not easily accessed on the Italian layout, I have just disabled the hot-keys. The switching applet in the Windows' bar will be enough.

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Nice to be able to help!  :)

    You don't need the `~ for anything; just use what suits you. In particular, using for instance Ctrl+Shift+1 for your default layout and Ctrl+Shift+2 for the alternative is a very workable solution (or just Ctrl+Shift+2 to switch between PKL layouts if you prefer that).

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
      • Index
      • Technical
      • Windows: switching layout from command line?