A lightweight macOS menu bar utility that transforms the clipboard and pastes
the result into the active app. Triggered by a global hotkey (default
⌃⌥⌘V), it shows a floating popup with keyboard‑ and mouse‑navigable
actions; selecting one rewrites the clipboard, simulates ⌘V, and then
restores the original clipboard contents.
Built with SwiftUI for macOS 14+ (Sonoma, Sequoia, Tahoe).
- Global hotkey (default
⌃⌥⌘V), configurable in Settings. - Floating popup with three navigation modes:
↑/↓to move the highlight,Returnto confirm.1–9thena–zto pick an item directly by its badge.- Mouse hover + click.
Escor click outside the popup cancels.- Reads plain text or RTF/RTFD/HTML from the clipboard, applies the
transformation, pastes the plain text via simulated
⌘V, then restores the previous clipboard so other apps don't see the change. - Built-in actions: Remove formatting, UPPERCASE, lowercase, camelCase,
snake_case, Clean URL (strips tracking parameters like
utm_*,fbclid,gclid, Facebook__cft__*/__tn__*, Amazonpf_rd_*/pd_rd_*, etc., with host-specific rules for YouTube, Twitter/X, Instagram, LinkedIn, TikTok, Spotify, Reddit, and Amazon). Facebook group "multi-permalinks" feed links are rebuilt into the canonical/groups/<id>/posts/<id>/direct link. - Optional Dock icon (default ON) rendered programmatically, with a right‑click menu mirroring the menu bar item.
- 8 selectable popup themes.
- Settings window with a live shortcut recorder.
TextCleaner.xcodeproj Xcode project
TextCleaner/
TextCleanerApp.swift App entry
AppDelegate.swift Lifecycle, status item, hotkey wiring,
Dock menu, Accessibility prompt
AppIcon.swift Programmatic Dock icon
AppSettings.swift Observable user prefs (Dock toggle, theme)
HotKeyManager.swift Carbon RegisterEventHotKey wrapper
KeyboardShortcut.swift Shortcut model + display string
HotKeySettings.swift UserDefaults persistence
TextAction.swift Actions + transformations
URLCleaner.swift Tracking-parameter stripping for Clean URL
PopupTheme.swift Theme palette
PopupView.swift SwiftUI popup UI
PopupWindowController.swift NSPanel host, key routing
PasteSimulator.swift Clipboard snapshot/restore + Cmd-V
SettingsView.swift Settings UI
SettingsWindowController.swift Hosts SettingsView in a custom NSWindow
ShortcutRecorder.swift NSView-based shortcut recorder
Info.plist
TextCleaner.entitlements
open TextCleaner.xcodeprojThen build and run with ⌘R.
The first time you build, set a signing team to keep the binary's code signature stable across rebuilds:
- Select the
TextCleanerproject in the Project Navigator. - In the project editor pane, select the
TextCleanertarget. - Open the Signing & Capabilities tab.
- Tick Automatically manage signing and pick your team in the Team dropdown (a free Personal Team works).
Without a stable team, every rebuild produces a slightly different signature and macOS revokes the Accessibility permission you granted to the previous build.
The first time you trigger an action, macOS prompts to grant
Accessibility permission, which is needed to post the simulated ⌘V
keystroke to other apps.
System Settings → Privacy & Security → Accessibility → enable TextMagician.
If the hotkey doesn't fire, check System Settings → Keyboard →
Keyboard Shortcuts for a conflict with the default ⌃⌥⌘V, or change
the shortcut in the app's Settings window.
- Global hotkey uses Carbon's
RegisterEventHotKey, still the recommended approach on modern macOS for non‑sandboxed utilities. It works without Accessibility permission. - The popup is an
NSPanelwith.nonactivatingPanel, so opening it doesn't deactivate the front app. The previously frontmost app is also remembered explicitly and re‑activated right before posting⌘V, which makes paste reliable even when the Dock icon is visible. - After posting
⌘V, the simulator restores every original pasteboard item (plain text, RTF, HTML, images, etc.) so the user's clipboard appears untouched. - App sandbox is disabled in the entitlements — required to post events to other apps via the HID event tap.