I have three languages on my system: English, Russian and Japanese. But I only want to be able to Alt+Shift between English and Russian. Is there a way to do it on Windows 10?
This question doesn't apply here, because it doesn't work on Windows 10.
I have three languages on my system: English, Russian and Japanese. But I only want to be able to Alt+Shift between English and Russian. Is there a way to do it on Windows 10?
This question doesn't apply here, because it doesn't work on Windows 10.
Follow this steps:
; This scripts changes the functionality of Shift + Alt from "switch keyboard layout" ; to "change to previous layout". ; this is usefull when you have more than 2 keyboard layouts and want to switch between ; only 2 of them. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. LAlt & LShift::send, #^{space down}{space up}
If you are satisfied you can compile the script (right click -> compile) to create the .exe file. then move the .exe or .ahk file to the start-up folder (open RUN and type "shell:startup" without quotes).
Extra Notes:
I suggest probably slightly better approach with same autohotkey solution.
Instead of switching to previous layout (which might be the third), better to disable native Alt+Shift cycling hotkey and make way for own layout switching logic.
And use following script, maybe with desired adjustments:
#SingleInstance force
SendMode Input
; Cycled list of language ids
; refer to https://docs.microsoft.com/en-us/windows/win32/intl/language-identifiers
; and https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings
; for finding out correct values
; in this case 0x409 means standard US English, and 0x419 means standard Russian
AltShiftLangs := [0x0409, 0x0419]
; 0x411 means japanese IME
CtrlAltLang := 0x0411
; This returns currently active language id
GetKeyboardLayout() {
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
return DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt") & 0xFFFF
}
; This sends request to change system language to lang argument
SetKeyboardLayout(lang) {
PostMessage, 0x50,, lang,, A
}
; This returns 0-based index of Value in Arr
IndexOf(Arr, Value) {
Loop % Arr.Length()
if Arr[A_Index] == Value {
return A_Index-1
}
return -1
}
; This sets language based on current system lanuage and next value by index in Arr
; If current language is not found, it sets system to first language from Arr
SetNextLanguage(Arr) {
lang := GetKeyboardLayout()
idx := IndexOf(Arr, lang)
if (idx < 0) {
SetKeyboardLayout(Arr[1])
return
}
nextIdx := mod(idx+1, Arr.Length())
next := Arr[nextIdx+1]
SetKeyboardLayout(next)
}
; Alt+Shift hotkey - cycle between AltShiftLangs
LAlt & LShift::
SetNextLanguage(AltShiftLangs)
return
; Ctrl+Alt hotkey - switch directly to isolated CtrlAltLang
LCtrl & LAlt::
SetKeyboardLayout(CtrlAltLang)
return
I had a same problem and found a pretty simple way to solve it with reg editing wrote a guide with a help of chat gpt
It will remove chosen languge from shortcuts and language bar
How to Exclude a Language from Win+Space or Alt+Shift Shortcut in Windows
Note: Please exercise caution when editing the Windows Registry, as it can have system-wide effects. Always back up your registry or create a system restore point before making changes.
Step 1: Open Language Bar Options
Step 2: Create a Special Shortcut for the Language
Step 3: Open the Registry Editor
Press Win + R to open the Run dialog.
Type "regedit" and press Enter. This opens the Windows Registry Editor.
Step 4: Navigate to the Keyboard Layout Preload Key
In the Registry Editor, navigate to the following key:
HKEY_CURRENT_USER\Keyboard Layout\Preload
Step 5: Identify the Language Value
In the right pane, you will see a list of language codes and values. Each value corresponds to a keyboard layout.
Identify the value that corresponds to the language you want to exclude (e.g., "00000407" for German). It will have a numerical code associated with it.
Step 6: Remove the Language Value
Step 7: Close the Registry Editor Close the Registry Editor.
Note: This action will remove the language from the list of preload keyboard layouts, and it should no longer appear when you use the Win+Space or Alt+Shift shortcut to switch languages. You can still access the excluded language using the custom keyboard shortcut you created in Step 2 or by adding it back to the preload list in the Registry when needed.
Remember to be cautious when editing the Windows Registry, and make sure to back up your registry or create a system restore point before making changes