A Bash wrapper around ydotool that translates keyboard input from non-QWERTY layouts to QWERTY, allowing proper text input with AZERTY, QWERTZ, and other keyboard layouts.
ydotool is a Linux keyboard/mouse automation tool that internally uses QWERTY layout regardless of your system keyboard layout. This wrapper automatically translates input to QWERTY before passing it to ydotool.
Example (French AZERTY):
- Input:
ydotool type "Bonjour" - Without wrapper: Types
Vonjout - With wrapper: Types
Bonjour
| Layout | Description | Key differences |
|---|---|---|
fr |
French AZERTY | a/q, z/w, m swaps, accents |
de |
German QWERTZ | z/y swap, umlauts, sharp s |
be |
Belgian AZERTY | Similar to FR, different number row |
it |
Italian | QWERTY-based, accented vowels on special keys |
es |
Spanish | QWERTY-based, ñ, ç, ¡/¿, dead keys for accents |
us |
US QWERTY | Passthrough (no translation) |
git clone https://github.com/david-vct/ydotool-rebind.git
cd ydotool-rebind
sudo ./install.shRequirements: ydotool installed, Bash 4.0+, root access
The project now follows standard Bash naming conventions in the repository and on disk:
bin/ydotool-rebind.sh: explicit development entrypointlib/translate.sh: translation library and CLI helperlib/layout.sh: layout detection and loadinglib/utils.sh: shared utility functionsshare/layouts/*.sh: layout data files
Installed paths under /usr/local:
/usr/local/bin/ydotool/usr/local/lib/ydotool-rebind/translate.sh/usr/local/lib/ydotool-rebind/layout.sh/usr/local/lib/ydotool-rebind/utils.sh/usr/local/share/ydotool-rebind/layouts/*.sh/usr/local/etc/ydotool-rebind.conf
If an older version was previously installed in /usr/bin, the installer automatically migrates it to the new layout.
The layout is detected automatically by cascade:
YDOTOOL_LAYOUTenvironment variable/usr/local/etc/ydotool-rebind.conffile (LAYOUT=fr)setxkbmapauto-detection (X11)localectlauto-detection (systemd)- Fallback:
fr
To change the default layout:
# Edit config file
sudo nano /usr/local/etc/ydotool-rebind.conf
# Set: LAYOUT=de
# Or use environment variable
YDOTOOL_LAYOUT=de ydotool type "Hallo Welt"After installation, use ydotool normally:
# Types correctly with your keyboard layout
ydotool type "Bonjour, ça va ?"
# File mode
ydotool type -f /path/to/file.txt
# Other commands work as usual
ydotool key Return
ydotool mousemove 100 100bin/ydotool-rebind.shintercepts allydotoolcommands.- For
type, it sourceslib/utils.sh,lib/layout.sh, andlib/translate.sh, then parses options, loads the keyboard layout mapping, and translates the input. - The wrapper then forwards only the translated payload to the real system
ydotool.
The library can also be executed directly for debugging or scripting:
./lib/translate.sh detect-layout
./lib/translate.sh translate "Bonjour, ça va ?"
./lib/translate.sh translate -f /tmp/test.txt- French accents: e, e, e, a, u, c (circumflex, diaeresis)
- German umlauts: a, o, u, ss
- Ligatures: ae, oe
- All layout-specific symbols and key positions
DEBUG=1 ydotool type "test"
# Log: /tmp/ydotool-rebind-debug.logsudo ./uninstall.shThe uninstall script removes the /usr/local installation and also restores the original /usr/bin/ydotool if it detects a legacy installation.
MIT License - see LICENSE