Skip to content
libinvbabuPublic

About

A tiny, sleek macOS menu bar app that pastes saved AI prompt snippets along with clipboard into the previously focused app.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Snippy

A tiny, sleek macOS menu bar app that pastes saved AI prompt snippets into the previously focused app.

⌘⌥K  →  pick 1–9  →  rendered snippet is pasted into the app you were just in

No backend, no login, no sync, no analytics, no browser extension, no global typing listener. Everything is local and the data is a human-readable JSON file.


The workflow

  1. Copy some optional context to the clipboard.
  2. Press ⌘⌥K — a compact floating panel appears, centered on your screen.
  3. Press a number key 1–9 (or click a row).
  4. The snippet is rendered (clipboard / date / time variables filled in).
  5. The panel closes, your previous app is reactivated, and the text is pasted with a synthesized ⌘V.
  6. Your previous clipboard is restored shortly after.

If macOS Accessibility permission isn't granted (or paste mode is off), Snippy falls back to copying the rendered text to your clipboard and shows a small toast, so nothing is ever lost.


Requirements

  • macOS 13 (Ventura) or later
  • Xcode / Swift toolchain (Swift 5.9+) to build

Build & run

./build.sh         # release build → assembles & ad-hoc-signs Snippy.app
./build.sh run     # build + launch
./build.sh debug   # debug build

Snippy.app is written to the project root. Launch it (open Snippy.app) and look for the clipboard icon in your menu bar. Because it's a menu-bar (LSUIElement) app, it has no Dock icon.

You can also open the package directly in Xcode (open Package.swift) and run the Snippy scheme.

Run the tests

swift test --filter SnippyCoreTests

The pure-logic core (template rendering, model, default seeds) is unit-tested.

Uninstall / reinstall

./scripts/uninstall.sh              # quit + remove app, data, prefs, and the grant
./scripts/uninstall.sh --keep-data  # remove the app but keep your snippets/prefs

./scripts/reinstall.sh              # keep data, rebuild, install to /Applications, launch
./scripts/reinstall.sh --purge      # full wipe first, then a fresh install

reinstall.sh installs into /Applications/Snippy.app (a stable home). After it runs, grant Accessibility once; run ./scripts/setup-signing.sh beforehand if you want that grant to persist across future rebuilds.


Permissions

Capability Permission needed Why
Global ⌘⌥K hotkey None Uses Carbon RegisterEventHotKey
Auto-paste (⌘V into the previous app) Accessibility Uses CGEvent to synthesize the keystroke

On first paste without permission, Snippy copies the text and offers a one-time prompt with a link to System Settings → Privacy & Security → Accessibility. You can also grant it any time from Settings.

Keep the permission across rebuilds (important for development)

macOS ties the Accessibility grant to the app's code signature hash. With an ad-hoc signature (the default), that hash changes on every ./build.sh, so macOS forgets the grant after each rebuild — the launcher will show "Accessibility off" even though System Settings still lists Snippy (a stale entry pointing at the old build).

Run this once to create a stable self-signed signing identity so the grant sticks:

./scripts/setup-signing.sh
./build.sh                 # now signs with the stable identity

(If a keychain prompt appears during signing, click Always Allow.) After this, grant Accessibility one more time and it will persist across future rebuilds.

If you already hit the "Accessibility off" problem: in System Settings → Privacy & Security → Accessibility, remove the existing Snippy entry with the – button, quit Snippy, rebuild, then re-add/enable it and relaunch.


Template variables

Variable Behavior
{{clipboard}} Current plain-text clipboard, or empty if none
{{#clipboard}} … {{/clipboard}} Block kept only if the clipboard has text; otherwise removed cleanly
{{date}} Current local date
{{time}} Current local time

A snippet shows the Clipboard badge if its template uses {{clipboard}} or {{#clipboard}}, otherwise Static.

Example:

I need to implement the following request at Animall.

{{#clipboard}}
Requirement:
{{clipboard}}
{{/clipboard}}

Please use company knowledge where relevant…

With clipboard text, the Requirement: block is included. With an empty clipboard, the whole block is dropped and surrounding blank lines are tidied.


Keyboard

In the panel Action
1–9 Paste that snippet instantly (the digit is never typed into a field)
Esc Close the panel
⌘, Open Settings
click a row Paste that snippet
gear icon Open Settings

Settings

  • Open panel shortcut — ⌘⌥K (hard-coded in v1; the UI is ready for customization later)
  • Pause Snippy — disables the hotkey
  • Paste mode — auto-paste into the previous app (vs. copy-only)
  • Restore clipboard after paste — default on
  • Launch at login
  • Manage Snippets — add / edit / delete / reorder / enable–disable

Storage

Snippets are stored as pretty-printed JSON at:

~/Library/Application Support/Snippy/snippets.json

On first launch, four default snippets are seeded (Requirement Planning, PR Review, Push Code, Debug Issue). The file is portable — edit, back up, or move it freely.


Project structure

Snippy/
  Package.swift
  build.sh                     # builds + assembles Snippy.app
  Resources/Info.plist         # LSUIElement (menu bar app), bundle id
  Sources/
    SnippyCore/                # pure logic, unit-tested, no AppKit
      Snippet.swift
      TemplateRenderer.swift
      DefaultSnippets.swift
    Snippy/                    # the app (AppKit + SwiftUI)
      App/                     # SnippyApp, AppDelegate, AppController,
                               #   LauncherController, WindowManager, Toast
      Services/                # SnippetStore, SettingsStore, Clipboard,
                               #   Hotkey, Paste, Permission
      Views/                   # LauncherPanelView, SnippetRowView,
                               #   SnippetManagerView, SnippetEditorView,
                               #   SettingsView, Theme
  Tests/SnippyCoreTests/       # template renderer + model tests

The model and renderer live in a separate SnippyCore target (instead of Snippy/Models) purely so they can be unit-tested without pulling in AppKit. Functionally identical to the proposed layout.

About

A tiny, sleek macOS menu bar app that pastes saved AI prompt snippets along with clipboard into the previously focused app.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages