iPhone Clipboard Bridge for Omarchy
Copy text, photos, or files on an iPhone, trigger an Apple Shortcut, and paste the item normally in Omarchy. Transfers use a private, authenticated Tailscale Serve route—no cloud clipboard account or public internet endpoint.
Requirements
- Omarchy 4+
- Tailscale connected on both the iPhone and Omarchy machine
python3,wl-copy,notify-send, ImageMagick (magick),tailscale,jq, andss
On Omarchy, install any missing packages before setup:
omarchy pkg add python wl-clipboard libnotify imagemagick tailscale jq iproute2
Omarchy plugins do not run install hooks, so setup.sh is a required manual
step on each new machine.
Install
Add the plugin without enabling it, run setup, and then enable it:
omarchy plugin add https://github.com/aaronkhawkins/omarchy-iphone-clipboard.git
~/.config/omarchy/plugins/io.github.aaronkhawkins.iphone-clipboard/setup.sh
omarchy plugin enable io.github.aaronkhawkins.iphone-clipboard
Setup checks dependencies, refuses to reuse a port or Tailscale route owned by
another program, creates a private bearer token, and configures only the
/clipboard Tailscale Serve path. It prints the URL and authorization header
needed by the iPhone Shortcut.
iPhone Shortcut
Create a shortcut named Send Clipboard to Framework. This final layout works
from Back Tap and from the Photos Share Sheet:
- Open the Shortcut's details and enable Show in Share Sheet. In the Receive … input from Share Sheet row, accept Images and Files, set the no-input behavior to Continue, and turn off Get What's On Screen.
- Add If Shortcut Input has any value.
- Inside If, use Set Variable to set
Transfer Itemsto Shortcut Input. - Inside Otherwise, add Get Clipboard, then set
Transfer Itemsto the Clipboard result.
- Inside If, use Set Variable to set
- After End If, add URL using the URL printed by
setup.sh. Keep this action above and outside the remaining If and Repeat actions. - Add Count, choose Items, and count
Transfer Items. - Add If Count is greater than 1.
- Add Random Number and set its range to
100000000–999999999. - Add Repeat with Each using
Transfer Items. - Inside Repeat, add Get Contents of URL. Select the earlier URL magic
variable, set Method to
POST, Request Body toFile, and File to Repeat Item. Add these headers:Authorization: the completeBearer …value printed by setupX-Clipboard-Batch-ID: Random NumberX-Clipboard-Item-Index: Repeat IndexX-Clipboard-Item-Count: Count
- Add Random Number and set its range to
- Inside Otherwise, add one Get Contents of URL action using the earlier
URL. Set Method to
POST, Request Body toFile, File toTransfer Items, and add only theAuthorizationheader. - Finish with End If. If upgrading the old one-item Shortcut, move its POST into Otherwise; do not leave a second POST outside the branch.
For example, if setup prints:
Name: Authorization
Value: Bearer abc123
enter Authorization as the header name and Bearer abc123 as its value.
Include the word Bearer, one space, and the entire token. Do not enter only
abc123, and do not add quotation marks. Use the real value printed on your
machine rather than this example.
Run it once and approve the network and clipboard prompts. For one-gesture use, assign it under Settings → Accessibility → Touch → Back Tap, or to the iPhone Action Button. For several photos, select them in Photos and choose Share → Send Clipboard to Framework. Back Tap also handles several copied items when iOS exposes them as a list; temporarily use Quick Look after Get Clipboard if you want to verify what that iOS version provides.
The receiver accepts 2–32 batch items and updates the clipboard only after all
items arrive. Multiple photos paste as files because Wayland represents a
multi-file clipboard as text/uri-list; one photo continues to paste directly
as an image.
To print the existing URL and token again, rerun setup.sh. The token remains
unchanged unless its file is removed.
Behavior
- Text is placed directly in the Wayland clipboard.
- JPEG, HEIC, GIF, TIFF, and WebP photos are validated and converted to PNG
because many Wayland applications accept pasted images only as
image/png. - PDFs, archives, and other file-like items are retained under
~/.local/state/iphone-clipboard/items/and exposed as a pasteable file. - The input limit is 1 GiB. Large compressed images can require additional temporary disk and memory during conversion.
- Retained files are capped at 10 GiB and 4,096 files total. Transfers and image conversions are rejected before they would leave less than 2 GiB free. Upload staging and retained-file commits also require at least 1,024 free filesystem entries. Rejection is used instead of eviction so existing clipboard-history file links are not silently broken.
- Transfers are processed one at a time.
- Text, photos, and files appear in Omarchy's native clipboard history. Open it with Super + Ctrl + V. File payloads use content-addressed names and remain available so older history entries do not break.
- Fresh multi-file paste works in apps that accept pasted files or file URI
lists. Apps that accept only one
image/pngmay not accept several photos at once. Omarchy currently recalls a multi-file history row as plain URI text, so use the freshly received entry for multi-file paste; this is an upstream clipboard-history limitation.
Security and privacy
The receiver listens only on 127.0.0.1; Tailscale Serve provides tailnet-only
HTTPS access at /clipboard. POST requests also require the random bearer token
stored with mode 0600 at ~/.local/state/iphone-clipboard/token. Clipboard
contents are not logged. Anyone who has both network access to the Serve route
and this token can replace the desktop clipboard, so do not share the token.
The health-check GET endpoint intentionally returns only status and the maximum payload size. Incoming image formats are signature-checked before ImageMagick is used, conversion resources are bounded, and upload processing is serialized. Setup refuses symlinked token/state paths and creates a new token through an exclusive, no-follow file descriptor. Multi-item batches are bounded and staged privately; an incomplete batch never replaces the current clipboard.
Troubleshooting
omarchy plugin list
tailscale serve status
curl https://YOUR-MACHINE.YOUR-TAILNET.ts.net/clipboard
ss -ltn 'sport = :8787'
- If Safari can open the URL but POST returns
Unauthorized, copy the completeBearer …value fromsetup.shinto the Shortcut's Authorization header. - If nothing listens on port 8787, rerun setup, then disable and enable the plugin. Startup retries are bounded so a configuration error cannot create a permanent crash loop.
- Confirm Tailscale is connected on both devices and that tailnet policy permits the iPhone to reach the Omarchy machine.
Remove
Disable the plugin, remove only its Tailscale route, and then remove the plugin:
omarchy plugin disable io.github.aaronkhawkins.iphone-clipboard
~/.config/omarchy/plugins/io.github.aaronkhawkins.iphone-clipboard/remove-route.sh
omarchy plugin remove io.github.aaronkhawkins.iphone-clipboard
Received files and the token are deliberately retained, including files still referenced by clipboard history. To remove them too (old file history rows will no longer open):
gio trash ~/.local/state/iphone-clipboard
License
MIT © Aaron K. Hawkins