X11/Wayland clipboard synchronization tool. Keeps the cutbuffer, CLIPBOARD, and PRIMARY selections in sync.
This is an actively maintained fork of sigmike/autocutsel.
Pre-built packages are available via the openSUSE Build Service.
sudo zypper addrepo https://download.opensuse.org/repositories/home:Pihaar:autocutsel/openSUSE_Tumbleweed/home:Pihaar:autocutsel.repo
sudo zypper refresh
sudo zypper install autocutselsudo zypper addrepo https://download.opensuse.org/repositories/home:Pihaar:autocutsel/15.6/home:Pihaar:autocutsel.repo
sudo zypper refresh
sudo zypper install autocutselsudo dnf config-manager --add-repo https://download.opensuse.org/repositories/home:Pihaar:autocutsel/Fedora_43/home:Pihaar:autocutsel.repo
sudo dnf install autocutselRHEL is not available on OBS due to licensing. Use the binary-compatible RockyLinux 9 repository instead:
sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/home:Pihaar:autocutsel/RockyLinux_9/home:Pihaar:autocutsel.repo
sudo dnf install autocutselecho 'deb [signed-by=/etc/apt/keyrings/home_Pihaar_autocutsel.gpg] https://download.opensuse.org/repositories/home:/Pihaar:/autocutsel/Debian_13/ /' | sudo tee /etc/apt/sources.list.d/home_Pihaar_autocutsel.list
curl -fsSL https://download.opensuse.org/repositories/home:/Pihaar:/autocutsel/Debian_13/Release.key | gpg --dearmor | sudo tee /etc/apt/keyrings/home_Pihaar_autocutsel.gpg > /dev/null
sudo apt update
sudo apt install autocutselPackages for additional distributions (Arch, CentOS Stream, RockyLinux, SUSE SLFO, and more) are listed on the OBS project page.
-mouseonly— sync PRIMARY to CLIPBOARD on mouse selection only, with automatic reverse sync (CLIPBOARD to PRIMARY) for browser copy buttons and application clipboard writes- Wayland auto-detection — direct selection sync when cutbuffer is unavailable
-encoding— charset conversion for VNC clients with legacy encodings- Systemd user service — template unit with sandboxing and per-instance configuration
- Single-instance lock — prevents duplicate processes per selection
- PRIMARY clear — clears stale PRIMARY holders (e.g. xterm highlighting) after CLIPBOARD sync
Fedora/RHEL/CentOS:
sudo dnf install gcc make autoconf automake libtool pkg-config \
libX11-devel libXt-devel libXmu-devel libXaw-devel libXext-devel \
libinput-devel systemd-develUbuntu/Debian:
sudo apt-get install gcc make autoconf automake libtool pkg-config \
libx11-dev libxt-dev libxmu-dev libxaw7-dev libxext-dev \
libinput-dev libudev-devopenSUSE:
sudo zypper install gcc make autoconf automake libtool pkg-config \
libX11-devel libXt-devel libXmu-devel libXaw-devel libXext-devel \
libinput-devel systemd-devel./bootstrap
./configure
make
make check # run tests
sudo make installThe traditional approach uses two instances to keep CLIPBOARD, PRIMARY, and the cutbuffer in sync:
autocutsel & # CLIPBOARD ↔ cutbuffer
autocutsel -selection PRIMARY & # PRIMARY ↔ cutbufferAdd -fork to daemonize, or use the systemd service for automatic startup.
On Wayland (detected automatically via WAYLAND_DISPLAY), the cutbuffer is not available and selections are synced directly. A single instance is sufficient:
autocutsel -selection PRIMARY &| Option | Description | Default |
|---|---|---|
-selection NAME |
X selection to operate on (CLIPBOARD, PRIMARY) |
CLIPBOARD |
-cutbuffer N |
Cutbuffer number (0–7), not used on Wayland | 0 |
-pause MS |
Polling interval in milliseconds | 500 |
-buttonup |
Only sync when mouse button is released (helps with LibreOffice and similar) | off |
-fork |
Daemonize (run in background) | off |
-mouseonly |
Bidirectional: mouse selection syncs PRIMARY→CLIPBOARD, external CLIPBOARD writes (browser copy, Ctrl+C) sync back to PRIMARY. Requires libinput, input group |
off |
-encoding CHARSET |
Convert between UTF-8 and the given charset (e.g. WINDOWS-1252 for VNC) |
off |
-debug |
Print debug output | off |
-verbose |
Report version and sync events | off |
With -mouseonly, only mouse-based text selection is synced from PRIMARY to CLIPBOARD — keyboard selections (Shift+Arrow etc.) are ignored. Additionally, external CLIPBOARD writes (e.g. browser "copy" buttons using the Clipboard API, or Ctrl+C in applications) are automatically synced back to PRIMARY, making the clipboard content available for middle-click paste. This requires access to input devices via libinput:
sudo usermod -aG input $USER # re-login required
autocutsel -selection PRIMARY -mouseonlyOnly a single instance is needed (unlike the classic two-instance setup).
cutsel is a companion tool for inspecting and manipulating selections and cutbuffers:
cutsel cut # print cutbuffer content
cutsel cut "text" # set cutbuffer content
cutsel sel # print CLIPBOARD content
cutsel sel -selection PRIMARY # print PRIMARY content
cutsel targets # list selection targets offered by the ownerautocutsel ships a template unit autocutsel@.service with example argument files.
# Create config directory and copy example
mkdir -p ~/.config/autocutsel
cp /usr/share/doc/autocutsel/examples/mouseonly.args ~/.config/autocutsel/
# Enable and start
systemctl --user daemon-reload
systemctl --user enable --now autocutsel@mouseonly
# View logs
journalctl --user -u 'autocutsel@*'Available configurations in examples/:
| File | Description |
|---|---|
mouseonly.args |
Sync PRIMARY to CLIPBOARD on mouse selection only |
clipboard.args |
Sync CLIPBOARD with cutbuffer (traditional, pair with primary) |
primary.args |
Sync PRIMARY with cutbuffer (traditional, pair with clipboard) |
- Xvfb cutbuffer cross-process visibility: On some Xvfb versions (confirmed on 1.20.11),
XStoreBufferfrom one process is not visible toXFetchBufferfrom another process. This does not affect real Xorg or XWayland servers. The test suite probes for this behavior and skips affected tests automatically.
Native Wayland clipboard monitoring (via wl-paste --watch) requires the wlr-data-control protocol, which is only available on wlroots-based compositors (Sway, Hyprland). GNOME (Mutter) and KDE (KWin) do not support this protocol.
However, native Wayland support is not needed on GNOME and KDE: these compositors automatically bridge CLIPBOARD and PRIMARY between XWayland and native Wayland applications in both directions. autocutsel works transparently through this bridge — clipboard content from native Wayland apps (including browser "copy" buttons) is visible to autocutsel via XWayland, and vice versa.
For wlroots-based compositors, wl-paste --watch can be used as a standalone clipboard monitor alongside autocutsel.
autocutsel was originally created by Michael Witrant (sigmike). Original project: https://www.nongnu.org/autocutsel/
GNU General Public License v2.0 or later — see COPYING.