Skip to content

Instantly share code, notes, and snippets.

@anvanvan
Last active April 23, 2026 20:25
Show Gist options
  • Select an option

  • Save anvanvan/d7244b8fd707ac08db7c12a55a764f80 to your computer and use it in GitHub Desktop.

Select an option

Save anvanvan/d7244b8fd707ac08db7c12a55a764f80 to your computer and use it in GitHub Desktop.
Save the current Safari tab to Fabric via the fabric CLI

fabric-link — save the current Safari tab to Fabric

A small AppleScript that grabs the URL of Safari's active tab and runs fabric link <url> (stand-in until Fabric ships a native Safari extension).

Two versions in this gist:

  • fabric-link.applescript — minimal, zero dependencies. Notification posts via AppleScript's built-in display notification (icon is the script's host app, e.g. Script Editor or Raycast).
  • fabric-link-alerter.applescript — notification shows the Fabric app icon and clicking it opens Fabric.app. Requires alerter — a modern (UNUserNotificationCenter-based) replacement for terminal-notifier, which is abandoned and has broken click handling on macOS Sonoma/Sequoia.

Prerequisites

  • macOS (Sonoma 14+ recommended), Safari
  • fabric CLI installed and authenticated
  • First run prompts for Automation + Notification permissions — allow both

The script auto-locates fabric via (1) login-shell PATH, (2) ~/.fabric/bin/fabric, (3) /opt/homebrew/bin/fabric, (4) /usr/local/bin/fabric.

Setup with Raycast

  1. Save the .applescript into a folder Raycast watches (Raycast → Extensions → Script Commands → Add Directories).
  2. chmod +x <path>/fabric-link.applescript
  3. The command appears in Raycast as "Fabric Link (current Safari tab)". Bind a hotkey if you want.

Setup without Raycast

Pick any of:

  • Shortcuts.app — create a shortcut with a single "Run AppleScript" action containing the script body. Toggle Pin in Menu Bar or assign a keyboard shortcut in System Settings → Keyboard → Keyboard Shortcuts → Services.
  • Script Editor — open the file, File → Export…File Format: Application. Drop the resulting .app in your Dock.
  • Terminalosascript /path/to/fabric-link.applescript

Optional: alerter version (Fabric icon + click-to-open)

Use fabric-link-alerter.applescript if you want:

  • The notification to show Fabric's icon instead of Script Editor's / Raycast's
  • Clicking the notification to open (or foreground) Fabric.app

Install alerter:

brew install vjeantet/tap/alerter

Then same setup as above.

Why not terminal-notifier?

terminal-notifier (previously the common tool for this) was last released in November 2017 and is built on the deprecated NSUserNotification API. On macOS Sonoma/Sequoia its click handlers (-activate, -execute, -open) frequently do not fire at all. alerter is the maintained successor using the modern UNUserNotificationCenter API and works reliably on current macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment