Skip to content

Instantly share code, notes, and snippets.

@derjohn
Last active September 23, 2024 12:16
Show Gist options
  • Save derjohn/957c8f43fe8247b48e4cd5f6127ff8d0 to your computer and use it in GitHub Desktop.
Save derjohn/957c8f43fe8247b48e4cd5f6127ff8d0 to your computer and use it in GitHub Desktop.
X11 / Wayland "Type for me" instead of pasting the clipboard. Good for services that don't accept CTRL-V
#!/bin/sh
# Hint: Wayland uses ydotool instead
# FYI: Multiline a special thing, because keyboard do not send the newline style that Linux wants
# To workaround that tr and sed are in place
# I bind that command to shift-alt-N because that's neither occupied by a Windows nor a KDE default hotkey.
xdotool sleep 0.100 type --clearmodifiers -- "$(xsel -bo | tr \\n \\r | sed s/\\r*\$//)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment