Skip to content

About

A minimal macOS agent app that intercepts HTTP/HTTPS URLs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Link Catcher

A minimal macOS agent app that intercepts all HTTP/HTTPS URLs, copies them to clipboard, and shows a dialog. No network requests, no data stored on disk.

Overview

Feature Detail
App type Background agent (no Dock icon) via LSUIElement
URL handling Registers as default web browser for http/https and intercepts all links
User feedback Alert dialog with selectable URL text
Preferences Boolean toggles via status-bar menu
Network Zero network requests
Disk storage None (only UserDefaults booleans)

Prerequisites

  • macOS 12+ (Monterey or later)
  • Xcode Command Line Tools: xcode-select --install

Build & Install

git clone https://github.com/Neison32/link-catcher-macos.git
cd link-catcher-macos
make build
make install

The built app bundle appears at build/LinkCatcher.app. make install copies it to /Applications/, registers it with Launch Services, and prints a reminder to set it as the default browser.

Note: The build uses a vfs-overlay.yaml to work around a known CLT bug where SwiftBridging module is defined twice. If you have full Xcode installed, you can remove -vfsoverlay vfs-overlay.yaml from the Makefile.

Makefile Commands

Command What it does
make build Compiles Swift sources into build/LinkCatcher.app
make icon ICON=/abs/path/icon.jpeg Generates Resources/AppIcon.icns from a JPEG/PNG
make install Copies the built app to /Applications/ and registers it with Launch Services
make uninstall Removes the app from /Applications/
make clean Deletes the build/ directory

Development Workflow

After making changes to the source code, run the full update cycle:

make clean        # Remove old build artifacts
make build        # Compile the updated sources
make install      # Copy the new build to /Applications

When do I need to rebuild? Only when you change .swift files, Info.plist, or vfs-overlay.yaml. Changes to README.md, LICENSE, or .gitignore do not require a rebuild.

To completely remove the app:

make uninstall

Set as Default Browser

  1. Open System Settings
  2. Go to Desktop & Dock
  3. Find Default web browser
  4. Select Link Catcher

You may need to restart System Settings or log out/in for Link Catcher to appear in the list.

Usage

Once set as default browser, every URL opened on your Mac flows through Link Catcher:

  • All URLs are intercepted by default — a dialog is shown with the URL and it is auto-copied to clipboard.

Welcome Dialog

When you open Link Catcher directly (from Finder, Spotlight, or the Dock) without an incoming URL, a welcome dialog appears explaining how the app works. It also offers a shortcut to open System Settings so you can set Link Catcher as your default browser.

Alert Dialog

When a URL is intercepted, a modal dialog appears with:

  • A title: "🔗 Link Intercepted"
  • A scrollable, selectable text field showing the full URL (monospaced font)
  • Two buttons:
    • OK — dismisses the dialog
    • Open in Safari — opens the URL in Safari (or Chrome as fallback)

The app temporarily shows in the Dock while the dialog is open, then hides again.

Test It

# Should intercept → clipboard + dialog
open "https://accounts.google.com/o/oauth2/auth?client_id=test&redirect_uri=http://localhost"

# Also intercepted
open "https://example.com"

Status Bar Menu

A 🔗 icon (or SF Symbol link.badge.plus) in the menu bar provides toggles:

Menu Item Default Effect
Auto-Copy URL to Clipboard ✅ ON Copy intercepted URLs to clipboard on arrival
How It Works… — Shows the welcome/info dialog
Quit Link Catcher — Terminates the agent

Tip: The app always uses dialog mode so the full URL is visible and selectable every time.

Revert to Safari/Chrome

  1. Open System Settings
  2. Go to Desktop & Dock
  3. Change Default web browser back to Safari or Google Chrome

To fully remove the app, run make uninstall (see Makefile Commands above).

File Structure

Sources/
├── main.swift                 # App bootstrap (NSApplication, accessory mode)
├── AppDelegate.swift          # URL handling, clipboard, dialogs
└── StatusBarController.swift  # Menu bar status item + preference toggles
Resources/
└── Info.plist                 # Bundle config, URL schemes, LSUIElement
Makefile                       # build, install, uninstall, clean targets
vfs-overlay.yaml               # CLT module-map fix (can remove with full Xcode)

Entitlements

None required. The app uses only public macOS APIs:

  • NSPasteboard — clipboard
  • NSWorkspace — open URLs in Safari/Chrome
  • NSStatusItem — menu bar icon
  • NSAlert — modal dialog with selectable URL text

How It Works

macOS opens http/https URL
        │
        ▼
Link Catcher receives URL(s)
  via application(_:open:)
        │
        ▼
Auto-copy to clipboard
(if enabled)
        │
        ▼
Show alert dialog
with selectable URL

License

MIT

About

A minimal macOS agent app that intercepts HTTP/HTTPS URLs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages