How alexfrmn/ruswitch works
RuSwitch is a Windows RU/EN keyboard-layout switcher. Its main workflow captures keystrokes, buffers words until a boundary, checks the detected script and dictionary, remaps likely wrong-layout words, and replaces the typed text. Users can also manually remap, undo recent corrections, configure exclusions and hotkeys, and manage learned words through the tray and settings GUI. The excerpts show the detector, dictionary, replacement, configuration, and UI responsibilities; some wiring is supported only by the SOURCE INDEX or README.
Main entry points: main.py App orchestrator · dictionary.py Dictionary manager · config.py Configuration · detector.py Word detector
Components 14
Keyboard runtime
- App orchestrator
main.py - Keyboard hooks
- Foreground app
- Text replacement and undo
replacer.py
Detection and language
- Word detector
detector.py - Layout mapping
keymap.py - Dictionary manager
dictionary.py - Base word lists
dictionaries
User state
- Configuration
config.py - Config JSON
- User words and learning
User interface
- System tray
tray.py - Settings GUI
settings_gui.py
Other components
- User
Connections 23
- User → App orchestrator: starts
README.md - App orchestrator → Configuration: loads
main.py - Configuration → Config JSON: reads and writes
config.py - App orchestrator → Dictionary manager: creates
main.py - Dictionary manager → Base word lists: loads
dictionary.py - Dictionary manager → User words and learning: persists
dictionary.py - Dictionary manager → Configuration: reads threshold
dictionary.py - App orchestrator → Keyboard hooks: registers hooks
main.py - Keyboard hooks → App orchestrator: sends keys
main.py - App orchestrator → Foreground app: checks process
main.py - App orchestrator → Word detector: feeds characters
main.py - Word detector → Layout mapping: detects and remaps
detector.py - Word detector → Dictionary manager: checks and records
detector.py - Word detector → Configuration: reads settings
detector.py - App orchestrator → Text replacement and undo: replaces detected word
main.py - App orchestrator → System tray: runs and notifies
main.py - System tray → App orchestrator: dispatches actions
tray.py - App orchestrator → Settings GUI: opens settings
main.py - Settings GUI → Configuration: saves settings
settings_gui.py - Settings GUI → Dictionary manager: manages user words
settings_gui.py - Settings GUI → App orchestrator: applies saved settings
main.py - User → Keyboard hooks: types or presses hotkeys
README.md - App orchestrator → Text replacement and undo: undoes recent correction
README.md