Created
February 18, 2026 11:10
-
-
Save retspen/5b57a24e2063c155fb8db6bbc154a0c4 to your computer and use it in GitHub Desktop.
dotool wrapper for ydotool – reliable paste with Non-US layouts (Wayland)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Copy from pipe | |
| wl-copy | |
| # Get text from buffer | |
| text="$(wl-paste)" | |
| # Remove prefix "type " if it exist | |
| if [[ "$text" == type\ * ]]; then | |
| text="${text#type }" | |
| fi | |
| # Put back to clipboard | |
| printf '%s' "$text" | wl-copy | |
| # Shift+Insert | |
| ydotool key 29:1 42:1 47:1 47:0 42:0 29:0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Starts ydotoold service (user) | |
| After=graphical-session.target | |
| [Service] | |
| Type=simple | |
| Restart=on-failure | |
| RestartSec=1 | |
| ExecStart=/usr/bin/ydotoold | |
| ExecReload=/usr/bin/kill -HUP $MAINPID | |
| [Install] | |
| WantedBy=graphical-session.target |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This wrapper avoids layout-dependent issues when using
ydotool typeunder Wayland with Non-US keyboard layouts.Instead of injecting characters directly, it copies stdin to the clipboard and pastes it using
Shift+Insert, which is layout-agnostic and reliable.Installation
Add user to input group and setup permission:
Download and install the wrapper:
Ensure the systemd user directory exists:
mkdir -p $HOME/.config/systemd/userDownload service file:
Reload and enable the service:
systemctl --user daemon-reload systemctl --user enable --now ydotool.serviceReboot and ensure ydotoold starts automatically after the graphical session.