Skip to content

Repository files navigation

GrabURL

Safari and Chrome web extension that copies the active tab URL exactly to the clipboard.

Behavior

  • Click the extension toolbar icon to copy the active tab URL.
  • Press Command+Shift+C (Safari) or Alt+Shift+C (Chrome) to copy the active tab URL.
  • Shows a popup with "Copied URL" confirmation that closes automatically.

For example, if the active tab is https://google.com, the clipboard receives exactly:

https://google.com

Run Locally

Install the pinned local tools with mise:

mise install

Build the signed generated macOS wrapper:

pnpm dev:mac

pnpm dev:mac builds the signed app using DEVELOPMENT_TEAM from .env or the shell environment and opens it. Start by copying the example file:

cp .env.example .env

Then put your team ID into .env and run:

pnpm dev:mac

To open the app again without rebuilding:

pnpm open:mac

Then enable it in Safari:

  1. Open Safari.
  2. Go to Settings > Extensions.
  3. Enable Copy URL.
  4. Pin or show the extension button in the toolbar if Safari hides it.

Chrome

Build the Chrome Web Store zip:

pnpm build:chrome

This copies web-extension/, patches the manifest (generic description, Alt+Shift+C shortcut), and outputs dist/graburl-chrome-v<version>.zip. Load the unpacked dist/chrome/ folder in chrome://extensions (developer mode) for local testing.

Tests

pnpm test

Architecture

The extension is a standard Manifest V3 web extension:

  • popup.html / popup.css / popup.js — the action popup shown when the toolbar icon is clicked. Runs url-copy.js to read the active tab URL and write it to the clipboard, displays "Copied URL", then closes after 1.2 seconds.
  • url-copy.js — pure utility module (window.CopyUrlExtension). Tries the Clipboard API first; falls back to document.execCommand('copy') if unavailable. No extension-specific dependencies; covered by unit tests.
  • manifest.json — declares activeTab and clipboardWrite permissions. No background service worker. Keyboard shortcut: Command+Shift+C (Safari) or Alt+Shift+C (Chrome). Chrome reserves Cmd/Ctrl+Shift+C for DevTools, so the manifest is patched at build time.
  • scripts/build-chrome.mjs — Chrome build script. Copies web-extension/, patches manifest.json (generic description + Alt+Shift+C shortcut), and zips to dist/graburl-chrome-v<version>.zip. Never edit dist/ directly.

The GrabURL/ Xcode project wraps the web-extension/ files for Safari distribution. GrabURL/GrabURL Extension/Resources/ holds identical copies that must stay in sync with web-extension/.

Source Layout

  • web-extension/: source WebExtension files (popup, manifest, icons).
  • tests/: Node tests for active-tab URL resolution and exact clipboard behavior.
  • GrabURL/: generated Safari macOS wrapper project (Xcode build).
  • web/: Astro landing page (deployed separately).
  • scripts/: build automation (macOS signing, Chrome Web Store packaging, icon rendering, web deploy).
  • dist/: Chrome build output (gitignored). Generated by pnpm build:chrome.
  • docs/: design specs and project documentation.

Contributing

  1. Edit extension source in web-extension/ — mirror changes identically to GrabURL/GrabURL Extension/Resources/.
  2. Run pnpm test before submitting changes.
  3. To build the Chrome package, run pnpm build:chrome. Never edit dist/ directly — it is regenerated on every build.

License

MIT

About

Safari web extension that copies the current tab's URL

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages