cofuente21 downloadsAutomatically copies highlighted text to the clipboard when the selection changes, mirroring Linux primary-selection behavior.
An Obsidian plugin that automatically copies highlighted text to the clipboard whenever the selection changes — the same behavior Linux users know as "primary selection" on X11, brought into Obsidian on every platform.
Works for both mouse drags and keyboard selection (Shift+arrows, Shift+Home,
double-click, triple-click). Debounced so that fast keyboard selection doesn't
spam the clipboard.
(Once the plugin is accepted by the Obsidian team.)
main.js and manifest.json from the
latest release<your-vault>/.obsidian/plugins/copy-on-selection/| Setting | Default | Description |
|---|---|---|
| Debounce (ms) | 150 | How long to wait after the selection stops changing before copying. Lower = more immediate, higher = fewer writes. |
| Minimum selection length | 1 | Selections shorter than this are ignored. |
| Show notice on copy | ✓ | Briefly display a toast each time text is copied. |
| Enable on touch (mobile) | ✗ | Also fire after touch-based selection. iOS may silently block clipboard writes outside direct user gestures. |
A Reset button at the bottom of the settings tab restores every value to its default.
navigator.clipboard.writeText()
only works from direct user gestures. Selection-triggered copies may fail
silently in some contexts. If mobile support matters to you, keep
"Enable on touch" off until you've verified it works in your setup.This project is set up for a Docker-based dev loop so nothing needs to be installed on the host.
docker compose build
docker compose up # or: docker compose watch
esbuild runs in watch mode inside the container and writes main.js to
the repo root. Symlink the repo into your vault's plugins directory so
Obsidian picks it up:
ln -s "$(pwd)" /path/to/vault/.obsidian/plugins/copy-on-selection
After each rebuild, toggle the plugin off and on in Obsidian's community
plugins list to pick up the new main.js (or install the Hot-Reload
community plugin to automate this).
MIT — see LICENSE.