# CodeMirror PRIMARY Bridge

> Restores middle-click paste from CodeMirror editors (GitHub Gist, codemirror.net…) on Linux/BSD by forwarding selections to the X11/Wayland PRIMARY buffer. Per-domain allowlist, off by default. Requires a companion native helper.

Canonical page: [https://chrome-stats.com/d/codemirror-primary-bridge](https://chrome-stats.com/d/codemirror-primary-bridge)

## Overview

- **ID:** `codemirror-primary-bridge`
- **Platform:** Firefox
- **Type:** Firefox add-on
- **Status:** Available
- **Publisher:** Nicolas Hainaux
- **Category:** web-development
- **Daily users:** 9
- **Weekly downloads:** 1
- **Rating:** 5.00 / 5 (1 ratings)
- **Version:** 1.0.0
- **Last updated:** 2026-06-07
- **First published:** 2026-06-04
- **Size:** 19 KB
- **Data as of:** 2026-09-13
- **Store listing:** [Firefox Add-ons Store](https://addons.mozilla.org/firefox/addon/codemirror-primary-bridge/)
- **Website:** [https://gitlab.com/nicolas.hainaux/cm\_primary/-/issues](https://gitlab.com/nicolas.hainaux/cm_primary/-/issues)

## Description

On Linux/BSD, CodeMirror-based editors (GitHub Gist, <a href="https://prod.outgoing.prod.webservices.mozgcp.net/v1/a4b9d11a056f9e1fe6f33032ce772c8a549c598074e0f4730851b5a812cc08eb/http%3A//codemirror.net" rel="nofollow">codemirror.net</a>, and others) don't propagate text selections to the X11/Wayland PRIMARY buffer. The result: middle-click paste from those editors silently does nothing. This extension restores that workflow.

A content script watches the selection inside CodeMirror editors on allowlisted sites. When the selection changes, it sends the text to a small Python "native messaging host" running outside the browser, which
writes it to PRIMARY via <code>xsel</code>, <code>xclip</code>, or <code>wl-copy</code>.

<ol><li>The extension itself (this page).</li><li>A small Python helper, installed separately by running <a href="https://prod.outgoing.prod.webservices.mozgcp.net/v1/0485b70010290e4dc71858444bbdbdf4ad854cb9c18ef1f58a5bec3d3a3dd9fb/https%3A//gitlab.com/nicolas.hainaux/cm_primary/-/blob/main/install.sh" rel="nofollow">install.sh</a> from the source tree. WebExtension APIs cannot reach clipboard tools directly — the helper is required and AMO cannot install it for you.</li></ol>
Full instructions, including the source repository, are at <a href="https://prod.outgoing.prod.webservices.mozgcp.net/v1/93843c86fc896052738fc54ddd2162403e12ee864f98efb0248d030a99490106/https%3A//gitlab.com/nicolas.hainaux/cm_primary" rel="nofollow">https://gitlab.com/nicolas.hainaux/cm_primary</a>.

Off everywhere by default. The extension only forwards selections on hostnames you explicitly add to the allowlist in the options page — no allowlist entry, no message to the helper, no write to PRIMARY.

This mirrors the conservative choice Firefox made after CVE-2023-6208, which was patched by dropping all JavaScript-driven PRIMARY updates. This extension reopens that path only on sites you've explicitly trusted.

No telemetry, no analytics, no remote servers. Selections are only forwarded to your local PRIMARY buffer.

Linux X11 (tested with <code>xsel</code>). BSD and Wayland support is implemented but untested — feedback welcome.

## Rankings

- #35,118 — Overall
- #127 — error
- #241 — prime

## Permissions and access

### Permissions

- `nativeMessaging`
- `storage`

### Host permissions

- `<all_urls>`

### Content script matches

- `<all_urls>`

## Safety

- **Risk impact:** Moderate risk impact
- **Risk likelihood:** Moderate risk likelihood

### Analysis details

- Allows access to all websites, posing a significant security risk as it can monitor and modify data from any visited site.
- This extension has low user count. Unpopular extensions may not be stable or safe.

> Some risk analysis details are omitted from this free response. [Upgrade to view the full analysis](https://chrome-stats.com/pricing).

## Similar extensions and apps

- [copy-on-mouse-select](https://chrome-stats.com/d/copy-on-mouse-select) — 2 users, 5.00 / 5
- [codeCollab Extension](https://chrome-stats.com/d/codecollab-extension)
- [Guacamole Clipboard Bridge](https://chrome-stats.com/d/guacamole-clipboard-bridge) — 6 users
- [Chrome Emacs](https://chrome-stats.com/d/chrome-emacs) — 52 users, 5.00 / 5
- [Paste for Monaco](https://chrome-stats.com/d/paste-for-monaco) — 2 users
- [Ctrl + Shift + C Should Copy](https://chrome-stats.com/d/ctrl-shift-c-should-copy) — 432 users, 5.00 / 5
- [Grant Clipboard](https://chrome-stats.com/d/grant-clipboard) — 16 users, 5.00 / 5
- [Copy On Select 2](https://chrome-stats.com/d/copy-on-select-2) — 319 users, 4.91 / 5
- [Claude Code Browser Bridge](https://chrome-stats.com/d/claude-code-browser-bridge) — 2 users
- [Simple Allow Copy](https://chrome-stats.com/d/simple-allow-copy) — 4,234 users, 3.60 / 5
- [Don't F\*\*\* With Paste](https://chrome-stats.com/d/dont-f-with-paste) — 43 users
- [Copycat](https://chrome-stats.com/d/extension-copycat) — 874 users, 4.32 / 5

---

Source: [Chrome-Stats](https://chrome-stats.com/d/codemirror-primary-bridge)
