Skip to content

donny-son/sugarfree

Repository files navigation

Sugarfree

Save tokens. Save time.

SCR-20260620-pdfl

Sugarfree is a tiny macOS app that strips formatting "sugar" from whatever you copy and lives in your menubar.

AI chat tools (Claude, ChatGPT, Gemini) love to copy text with formatting baked in — HTML <strong>/<em>/<u>/<s>, RTF font traits, markdown **/*/~~. That styling leaks into every app you paste into. Sugarfree sits in your menu bar, watches the clipboard, and quietly removes the sugars you choose so the text you paste is the text you wanted.

Features

  • Menu bar only — no Dock icon, no window clutter (LSUIElement agent app).
  • Automatic cleanup — polls NSPasteboard and rewrites copied text in place.
  • Pick your sugars — strip any of bold, italic, underline, strikethrough, each independently toggleable (bold + italic on by default).
  • Works across representations — RTF font traits and underline/strikethrough attributes, HTML tags + inline styles, and markdown markers.
  • Structural transforms — optionally reshape content after stripping. Currently Tables → list: convert Markdown/HTML tables into YAML-style or TOML-style list items. Transforms are lossy, so they're off by default and live in their own section.
  • Non-destructive — only changed representations are rewritten; unrelated pasteboard types and items are preserved.
  • Configurable polling interval — 0.25s / 0.5s / 1.0s / 1.5s.
  • Manual mode — "Clean Now" cleans the current clipboard on demand.
  • Keyboard shortcuts — ⌘⇧P toggle automatic cleanup, ⌘⇧K clean now.
  • Activity tracking — total cleanups and last action shown in the dashboard.

Requirements

  • macOS 13 (Ventura) or later
  • Xcode 15+ and the command-line tools (to build)
  • XcodeGenbrew install xcodegen

Install

From a release

Download the latest Sugarfree.app from the Releases page, unzip it, and drag it into /Applications.

The app is distributed unsigned. On first launch macOS Gatekeeper may block it. Right-click the app → Open, then confirm. (Or run xattr -dr com.apple.quarantine /Applications/Sugarfree.app.)

From source

git clone https://github.com/donny-son/sugarfree.git
cd sugarfree
./build.sh            # generates the Xcode project and builds Debug
./build.sh --run      # build and launch

The build script runs XcodeGen against project.yml, then xcodebuild. The built app lands at build/DerivedData/Build/Products/Debug/Sugarfree.app.

To work in Xcode:

xcodegen generate     # regenerate Sugarfree.xcodeproj from project.yml
open Sugarfree.xcodeproj

Usage

  1. Launch Sugarfree. The lollipop icon appears in the menu bar with a status dot (pink = active, amber = no sugar enabled, grey = paused).
  2. Click the icon to open the dashboard: toggle automatic cleanup, run "Clean Now", choose which sugars to strip, enable structural transforms, set the polling interval, and see an activity summary — all in one place.
  3. Copy formatted text from anywhere — paste it, and the sugar is gone.

Command-line tool

The same stripping and table-transform logic ships as a cross-platform CLI, sugarfree, for use in shell pipelines, AI-harness hooks, and build steps. It reuses the shared SugarCore package, so its behavior never drifts from the app.

swift build -c release --product sugarfree          # build it
printf '**bold** and *italic*' | sugarfree           # → "bold and italic"
sugarfree --all notes.md                             # strip every sugar from a file
sugarfree --none --tables in.md                      # just flatten tables to YAML

How to get it per platform:

  • macOS — the .dmg app bundles the CLI. On first launch Sugarfree symlinks sugarfree into /usr/local/bin for you (prompting for admin only if needed), so it just works in your terminal after you install the app. A standalone macOS CLI tarball is also attached to each release if you want only the CLI.
  • Linux / Windows — download the CLI binary for your platform from the releases (there's no desktop app on these platforms — it's CLI-only).

See cli/README.md for the full flag reference and hooks/README.md for harness/CI recipes.

How it works

Sugarfree polls NSPasteboard.general.changeCount on the chosen interval. When the clipboard changes, it inspects the RTF, HTML, and plain-text representations, strips the sugars you enabled from each, and writes the cleaned versions back. A selfWriteCount guard ignores the app's own writes so it never loops on itself. Representations it doesn't touch are left intact.

Release signing

For signed builds or notarized archives, copy the signing config template and fill in your team identity:

cp Configs/LocalSigning.xcconfig.example Configs/LocalSigning.xcconfig
# set DEVELOPMENT_TEAM and CODE_SIGN_IDENTITY

Configs/Release.xcconfig includes LocalSigning.xcconfig if present.

License

MIT © 2026 Dongook Son

About

Strip formatting sugar from the clipboard — a macOS menu-bar utility

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors