Skip to content

Python script to synchronize the clipboard between Wayland and X11.

Notifications You must be signed in to change notification settings

arabianq/wl-x11-clipsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Wayland ↔ X11 Clipboard Sync

This Python script synchronizes the clipboard between Wayland (via wl-copy/wl-paste) and X11 (via xclip). It listens for clipboard changes using clipnotify and automatically transfers new data from one side to the other, handling text, HTML, images, and file URIs.

Features

  • Automatic two-way sync between Wayland and X11 clipboards.
  • MIME priority:
    • First tries text/uri-list for file transfers,
    • then text/html (some applications, like Firefox, provide images as HTML),
    • then raw images image/*,
    • and finally text/plain.
  • Text normalization: removes extra newlines/trailing spaces to avoid duplicate triggers (especially from Firefox).
  • No polling: uses clipnotify to react to clipboard events.

Requirements

Make sure you have the following installed:

  • wl-clipboard (provides wl-copy and wl-paste)
  • xclip
  • clipnotify
  • A Python 3 environment

Usage

  1. Clone or download the clipsync.py script.
  2. Make it executable: chmod +x clipsync.py
  3. Run it in a terminal or background process: ./clipsync.py

Now, whenever you copy something in a Wayland-native app, the same data becomes available to X11 apps, and vice versa.

Notes and Caveats

  • Copying images to X11 works really badly.
  • For file copy-paste, this script prioritizes text/uri-list only. Some DEs (like GNOME/KDE) may use other formats (application/x-gnome-copied-files, etc.). If needed, add them to the priority in the script.
  • If both Wayland and X11 clipboards change "simultaneously", the script gives priority to Wayland content to resolve conflicts.

Contributing

Feel free to open issues or pull requests if you have additional MIME formats, suggestions, or improvements. This script is provided as-is, in the hope it helps anyone needing bridging between Wayland and X11 clipboards.

Enjoy seamless clipboard sharing between Wayland and X11!

About

Python script to synchronize the clipboard between Wayland and X11.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages