Skip to content

handy-paste.sh

Files / handy-paste / handy-paste.sh

Files in handy-paste/

  • Directoryhandy-paste/
    • handy-paste.sh 934 bytes
    • LICENSE 1.0 KB
DownloadRawShell script · 22 lines · 934 bytes

From Dictation on Linux with Handy, and tidy text with OpenCode Go. MIT licence: LICENSE.

handy-paste/handy-paste.sh
#!/usr/bin/env bash
# Handy's paste step, as its "External Script" paste method (2026-10-19).
#
# Does what Handy's own "Clipboard (Shift+Insert)" method does (put the text on
# the clipboard, press Shift+Insert), minus the first step: Handy 0.9.8 reads the
# old clipboard before pasting, on its UI thread and with no timeout. When the
# clipboard's owner doesn't answer, that read never returns and Handy freezes
# for good (2026-10-19, twice). This script never reads the clipboard.
#
# Handy runs it with the text as the only argument and waits for it to exit.
# Clipboard Handling "Copy to Clipboard" still leaves the text on the clipboard.
set -u
text=${1-}
[ -n "$text" ] || exit 0
# wl-copy forks a helper that holds the clipboard and returns at once.
timeout 2 wl-copy -- "$text" || exit 1
sleep 0.06
# Shift+Insert as raw keycodes (ydotool 1.x): 42 = Left Shift, 110 = Insert.
timeout 2 ydotool key 42:1 110:1 110:0 42:0

Text, photos and drawings: CC BY 4.0. Code: MIT. Share and adapt them, crediting HomeLab Guides (blog.jacq.cc). Licence and privacy