Documentation · Where it works
Lang Switcher in browsers, Word and Telegram: how the word gets replaced
In ordinary windows, the program selects the word you typed and types the replacement over it in one go, so autocomplete can’t swallow any letters. The clipboard isn’t touched.
How the replacement works
In ordinary windows, such as a browser, Word, Telegram or Notepad, the program selects the word you typed (Shift+← once per letter, counted the way Windows moves the cursor, so a letter with accents or marks is one press) and types the replacement over the selection, so the word is replaced in one go. Then it switches the window’s layout.
Erasing letter by letter would be simpler, but in programs with autocomplete and autocorrect, a single Backspace can erase a whole suggested word instead of one letter.
The clipboard isn’t touched. Only text you select yourself goes through it: the program copies the selection, converts it, pastes it, and then puts back whatever was on the clipboard before.
Browsers
- The address bar. The list of suggestions that drops down as you type doesn’t cut the word off: the program can tell this change of focus from you moving to another field.
- Password fields. Keystrokes there are deliberately not remembered, and
Pauseonly switches the layout. - A page script that moves the cursor to the next field by itself, as confirmation code fields often do, looks to the program just like typing. If you press the hotkey right after such a jump, the fix may land in the new field.
- Microsoft Edge. After you click in a text field, a layout switch, whether by Lang Switcher or with Windows’ own keys, sometimes doesn’t reach Edge: as far as Windows is concerned, the new layout is on, but Edge keeps typing in the previous one until you restart it. This is Edge’s own behavior: it happens even when Lang Switcher isn’t running.
Word and Outlook
- Word’s AutoCorrect doesn’t get in the way: the word is selected and replaced as a whole.
- The layout switched back on its own? That’s the Office option “Automatically switch keyboard to match language of surrounding text”: Office changes the layout itself, after the replacement. You can turn it off in Office: in Word, under File → Options → Advanced → Editing options; in Outlook, under File → Options → Mail → Editor Options → Advanced.
Telegram
Telegram Desktop handles input its own way: a character sent as a press without a release gets repeated, so instead of “hello” you’d get “hhhhh”. That’s why the program sends every character of the replacement as a press and a release, and in Telegram Desktop the word arrives whole.
AnyDesk, RustDesk and remote desktop
In an AnyDesk or RustDesk window, the program fixes a word with keys: it erases the word and types the same keys again in the new layout. Which computer turns those keys into letters depends on whose layout the remote access program uses:
- Your computer: AnyDesk with the keyboard layout set to Auto or Local, or RustDesk in translate or legacy mode. The word gets fixed.
- The remote computer: AnyDesk set to Remote, or RustDesk in map mode (RustDesk’s default). The word stays as it was. In that case, run Lang Switcher on the remote computer, and on yours, add
AnyDesk.exeorrustdesk.exeto the exclusions.
Selected text in AnyDesk and RustDesk windows isn’t converted: the hotkey only switches the layout there. For Windows Remote Desktop Connection, Lang Switcher needs to run on the remote computer; for TightVNC, on yours.
If Lang Switcher runs on both computers and your hotkey is a double Shift, the remote computer gets only the first tap in an AnyDesk or RustDesk window, so only one copy fixes the word: yours. A capital letter typed with that second Shift still reaches the remote computer as a capital.
Known issue: in AnyDesk, the first word after you connect sometimes gets fixed only in part, and a second press doesn’t bring back what you typed.
Code editors
On Ctrl+C with nothing selected, VS Code and similar editors copy the whole line. If you press the hotkey without having typed a word, the program takes that line for selected text and pastes a converted copy of it. If that gets in the way, turn off “Fix the selected text” in the “General” section of the settings.
If something goes wrong
- A program reads the keyboard directly, bypassing Windows, as many games do: add it to the exclusions.
- Letters go missing or get replaced wrong: in the settings file, you can set the replacement method by hand,
[replacement] method=backspaceorselection, and a pause between events,[replacement] inter_event_delay_ms. That’s a last resort:autosuits almost everyone. - Write to me: tray menu → “Write to the author…”. Switch to the window where it didn’t work, and the wizard fills in the program’s name by itself.
See also
Questions and problemson GitHub Issues ↗ or by email: send.me@panda-pishet-kod.dev