Trimmy-style clipboard flattener for macOS. Auto-detects multi-line shell commands in your clipboard and flattens them to a single line.
Built for Intel Mac users who can't run Trimmy (ARM-only), or anyone who prefers a lightweight, zero-dependency alternative.
Copy a multi-line command from a blog post, README, or Stack Overflow:
docker run \
--name my-app \
-p 8080:80 \
-v /data:/data \
nginx:latest
ClipFlat automatically rewrites your clipboard to:
docker run --name my-app -p 8080:80 -v /data:/data nginx:latest
Paste once, run once.
- Smart detection — Scoring system identifies shell commands (pipes,
&&,\continuations, redirects, known command prefixes likegit,docker,curl, etc.) - False positive protection — Won't touch source code, bullet lists, markdown headings, or plain text
- Full transform pipeline:
- Box-drawing character removal (
│,┃,─, etc.) - Shell prompt stripping (
$and#) - URL fragment repair (joins URLs split across lines)
- Path quoting (wraps paths with spaces)
- Line flattening (joins
\continuations and remaining lines)
- Box-drawing character removal (
- Safety limits — Skips text over 10 lines or 5000 characters
- Self-write detection — Won't re-process its own clipboard writes
- Auto-start — LaunchAgent starts at login, restarts on crash
- macOS (Intel or Apple Silicon)
- bash (pre-installed)
- perl (pre-installed — used for Unicode box-drawing removal)
No other dependencies. No Homebrew packages. No Xcode.
Note: While ClipFlat was built for Intel Macs where Trimmy can't run, it works on Apple Silicon too. If you want a native Swift menu-bar app with more features, check out Trimmy. If you want something simple and dependency-free, ClipFlat is for you.
git clone https://github.com/enderyildirim/clipflat.git ~/dev/clipflat
bash ~/dev/clipflat/install.shThis creates a symlink at ~/.local/bin/clipflat and registers a LaunchAgent that starts automatically at login.
bash ~/dev/clipflat/uninstall.shClipFlat runs in the background — no interaction needed. Copy a multi-line shell command, wait ~200ms, paste it. Done.
# Check if running
launchctl list | grep clipflat
# Stop
launchctl unload ~/Library/LaunchAgents/com.clipflat.agent.plist
# Start
launchctl load ~/Library/LaunchAgents/com.clipflat.agent.plist
# Watch activity
tail -f /tmp/clipflat.log- Polls the clipboard every 150ms (lightweight, hash-based change detection)
- Scores the text for shell command signals:
- Strong signals (+2):
\continuation,|pipe,&&/||,>/<redirects - Weak signals (+1): known command prefix,
--flag,VAR=value
- Strong signals (+2):
- If score >= 2 and text passes false-positive checks, runs the transform pipeline
- Writes the flattened result back to the clipboard
172 tests covering every function and edge case:
bash ~/dev/clipflat/test_clipflat.shIssues and pull requests are welcome! If you find a false positive (text that shouldn't be flattened but is) or a false negative (command that should be flattened but isn't), please open an issue.
MIT