Skip to content

Instantly share code, notes, and snippets.

@LemonNekoGH
Forked from ssddi456/README.md
Last active February 24, 2026 08:20
Show Gist options
  • Select an option

  • Save LemonNekoGH/f7583e0f4fa83e29dfd96d8334144650 to your computer and use it in GitHub Desktop.

Select an option

Save LemonNekoGH/f7583e0f4fa83e29dfd96d8334144650 to your computer and use it in GitHub Desktop.
adbpaste
#!/usr/bin/env bash
set -euo pipefail
ADB_IME="com.android.adbkeyboard/.AdbIME"
origin_ime="$(adb shell settings get secure default_input_method | tr -d '\r')"
cleanup() { adb shell ime set "$origin_ime"; }
trap cleanup EXIT
adb shell ime enable "$ADB_IME"
adb shell ime set "$ADB_IME"
# wait for IME actually switched
for _ in $(seq 1 50); do
cur="$(adb shell settings get secure default_input_method | tr -d '\r')"
[[ "$cur" == "$ADB_IME" ]] && break
sleep 0.1
done
adb shell am broadcast -a ADB_INPUT_B64 --es msg "$(pbpaste | base64 | tr -d '\n')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment