Skip to content

Instantly share code, notes, and snippets.

@kousu
Created July 2, 2025 14:52
Show Gist options
  • Save kousu/224a9bac98695f869c0bd30334aa115a to your computer and use it in GitHub Desktop.
Save kousu/224a9bac98695f869c0bd30334aa115a to your computer and use it in GitHub Desktop.
Magic Wormhole Receive for Android

This makes magic-wormhole(1) much more accessible by putting it on your Android home screen.

Once installed, usage is:

  1. scan QR code from wormhole send or have sender tell you the code and copy it to your clipboard
  2. Run 'wormhole-receive'
  3. Paste scanned/copied code into prompt
  4. Downloads end up in /sdcard/Downloads/

TODO

  • Adapt it so it can receive wormhole-transfer: URLs directly
#!/data/data/com.termux/files/usr/bin/env bash
# wormhole-receive-termux-gui.sh
#
# Install:
# 1. pkg i magic-wormhole-rs jq termux-api
# 2. install Termux:Widget
# 3. place this in ~/.shortcuts/wormhole-receive (and chmod +x it)
# 4. termux-setup-storage # if not already done
set -e
# TODO: termux-dialog outputs a status code in a JSON ".code" field instead of as a POSIX status code
# how do I convert that to a POSIX status code? I should be able to get JQ to help but it's being janky
code="$(termux-dialog text -t "Wormhole URL" -i "wormhole-transfer:0-apple-bus" | jq -erj '.text')";
if [ -n "$code" ]; then
#echo "got $code"
code=$(echo -n "$code" | sed 's/^wormhole-transfer://') # if given--it's in the QR code wormhole send generates
#echo "$code"
#sleep 5
wormhole-rs receive --noconfirm --out-dir "storage/shared/Download" "$code"
else
echo 'user quit'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment