I make Cutling, an app that keeps the text you type again and again (your address, bank details, an email signature, the reply you send every week) and pastes it with one tap. On iPhone and iPad it's a keyboard you switch to in any app; on the Mac it sits in the menu bar and Shift-Command-V opens a picker at your cursor. The code is open source under GPL-3.0 (GitHub). Here's how the two halves work, and the platform corners I ran into.
On iPhone: a keyboard extension that inserts text
A custom keyboard gets a textDocumentProxy, and inserting a snippet is one call: proxy.insertText(value). Images are different, because a keyboard can't insert an image into a text field. Cutling puts the image on UIPasteboard.general with its real type (it reads the type from the data with CGImageSourceGetType, so a GIF stays a GIF) and you paste it.
That pasteboard write is why the keyboard asks for Full Access (RequestsOpenAccess in its Info.plist). Without it, a keyboard extension can't touch the pasteboard or the shared container at all. Cutling has no server, no analytics and no account, so Full Access here means "the keyboard can read the snippets the app saved and copy an image for you", and nothing leaves the phone unless you turn iCloud sync on.
The proxy also tells the keyboard what kind of field it's in through keyboardType and textContentType. Cutling uses that to put the right snippets first: in an email field your email addresses come up before your signature.
On the Mac: a global hotkey, a picker and a synthesized ⌘V
macOS still has no modern replacement for Carbon's RegisterEventHotKey, so that's what registers Shift-Command-V system-wide (the same path the sindresorhus/KeyboardShortcuts library uses). The hotkey opens a picker at the cursor. When you choose a snippet, Cutling puts it on the pasteboard and posts a ⌘V key-down and key-up into the front app with CGEvent on the HID event tap.
Posting key events into another app needs Accessibility permission, and without it the CGEvent posts fail silently, with no error at all. So Cutling checks AXIsProcessTrusted() first, prompts if it isn't, falls back to copy-only when you say no, and has a deep link into System Settings for when the prompt was already dismissed.
Clipboard history without a change notification
The Mac app also keeps a history of what you copy. macOS has no pasteboard-change notification, so Cutling polls NSPasteboard.general.changeCount on a timer every 500 ms, the same approach Maccy takes, which is quick enough that you don't notice and light on CPU.
The part I care about most is what it refuses to record. Password managers and other apps flag sensitive or short-lived copies with marker types, and Cutling skips any item carrying org.nspasteboard.ConcealedType, org.nspasteboard.TransientType, org.nspasteboard.AutoGeneratedType, com.apple.is-sensitive or 1Password's own type. Those names come from the conventions at nspasteboard.org, and following them is how a clipboard manager stays out of your passwords.
Small things that turned out to matter
- Snippets can expire on a date you pick, which is what you want for a one-time code or a temporary address.
- Each snippet gets one of 12 colours and an SF Symbol, because on a keyboard you scan by colour long before you read.
- Deleted snippets sit in Recently Deleted for 30 days, since a keyboard is an easy place to delete the wrong thing.
Cutling is $4.99 once on the App Store, one purchase for Mac, iPhone and iPad. If you build keyboard extensions yourself and know a better way around the image-insert limit, I'd like to hear it in the comments.
Top comments (0)