GitHub - sagivo/textsnap

3 min read Original article ↗

A lightweight macOS menu bar app that improves any selected text using LLMs. Highlight text anywhere, press a shortcut, and get an improved version pasted back — powered by the Vercel AI SDK.

How It Works

  1. Select text in any app
  2. Press ⌘⇧I (customizable)
  3. The app captures the selection, sends it to your chosen LLM, and pastes the improved text back

No windows, no context-switching — it lives entirely in your menu bar.

Features

  • System-wide — works in any app that supports standard copy/paste
  • Multiple LLM providers — OpenAI, Anthropic, Google, or any OpenAI-compatible API (Groq, Together, Ollama, etc.)
  • 6 built-in prompts — Improve Writing, Fix Grammar, Make Concise, Make Friendly, Make Professional, Simplify
  • Custom prompts — add your own prompt templates with system instructions and {text} placeholders
  • Configurable shortcut — record any key combo in settings
  • Dark mode support

Getting Started

Prerequisites

  • macOS
  • Node.js 18+

Install & Run

First Run

  1. The app appears as a menu bar icon. Click or right-click to access Settings.
  2. Grant Accessibility permissions — the app uses System Events to read selected text. Go to System Settings → Privacy & Security → Accessibility and add the Electron app.
  3. Add a model — open Settings → Models → Add Model. Enter your API key and model ID.
  4. Select text anywhere, press ⌘⇧I, and the improved text replaces your selection.

Configuration

Models

Add one or more models in Settings → Models. Each needs:

Field Description
Display Name Label shown in the dropdown
Provider OpenAI, Anthropic, Google, or OpenAI-Compatible
API Key Your provider API key
Base URL (optional) Custom endpoint, e.g. http://localhost:11434/v1 for Ollama
Model ID e.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.0-flash

Prompts

Each prompt template has a name, a system prompt (sets the AI's behavior), and a user template that must include {text} as the placeholder for selected text. The 6 defaults cover the most common use cases, and you can add as many custom prompts as you like.

Keyboard Shortcuts

Shortcut Action
⌘⇧I (default) Trigger text improvement

Change the trigger shortcut in Settings → General → Record.

Releasing

scripts/release.sh builds a signed (and notarized, when credentials are present) macOS .dmg and publishes it as a GitHub release.

Prerequisites

  • A Developer ID Application certificate in your login keychain (security find-identity -v -p codesigning)
  • The GitHub CLI authenticated (gh auth login)
  • For notarization: an Apple ID with an app-specific password and your Team ID

Setup

cp .env.example .env   # then fill in APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD, APPLE_TEAM_ID

.env is git-ignored. Any of these values can also be supplied as real environment variables, which take precedence over .env.

Run

# bump the version in package.json first, then:
npm run release

# options:
npm run release -- --draft        # create the GitHub release as a draft
npm run release -- --prerelease   # mark as a pre-release
npm run release -- --skip-build   # reuse existing dist/ artifacts

The script tags the release v<version> (from package.json), verifies the code signature and Gatekeeper status, then uploads the .dmg. If notarization credentials are missing it still builds a signed package but warns that it isn't notarized.

Tech Stack

  • Electron — menu bar app, no dock icon
  • Vercel AI SDKai, @ai-sdk/openai, @ai-sdk/anthropic, @ai-sdk/google
  • Vanilla JS — no framework, no build step

License

MIT