Skip to content

Fix clipboard deadlock by removing aggressive Wayland image watcher - #11715

Open
D-Pagey wants to merge 1 commit into
omacom:quattrofrom
D-Pagey:fix/clipboard-image-deadlock
Open

D-Pagey wants to merge 1 commit into
omacom:quattrofrom
D-Pagey:fix/clipboard-image-deadlock

Conversation

@D-Pagey

@D-Pagey D-Pagey commented Sep 13, 2026

Copy link
Copy Markdown

Problem:
The Omarchy clipboard manager ran a continuous wl-paste --type image/png --watch process to capture image history. In Wayland, when an image is copied (e.g., from Chromium, Brave, or a screenshot tool), the source application often uses a single-use pipe to serve the clipboard data. Because this background watcher immediately requests the data, it consumes the single-use pipe before the user can paste it into another application. This leaves the user's paste target with nothing and results in stuck wl-copy processes that deadlock the clipboard entirely.

Solution:
This PR completely removes the imageWatchProc from the clipboard manager.

While this means Omarchy no longer maintains a background history of copied images, it guarantees that image pasting works reliably 100% of the time. Text history remains perfectly intact because text payloads are tiny and aren't subject to the same single-use pipe restrictions. An explicit test has been added to ensure the image watcher is not accidentally reintroduced.


Retaining Image History

Removing the background watcher drops the image history feature. Building a background image clipboard manager on Wayland using purely bash and wl-paste is fundamentally flawed due to the single-use pipe issue. If the project wants to retain image history, here are the architectural alternatives:

1. "Capture on Demand" (Best UX without new dependencies)
Instead of a background watcher, modify Clipboard.qml to read the clipboard only when the user opens the history menu (Super+Ctrl+V).

  • Pros: Zero background SSD/CPU thrashing, 100% reliable pasting.
  • Cons: It won't keep a historical backlog of every image copied, only the one currently on the clipboard when the menu is opened.

2. Opt-In Toggle
Restore the watcher but put it behind a toggle (e.g. omarchy toggle image-clipboard-history).

  • Pros: Preserves the feature for users who rely on it.
  • Cons: Leaves a known, confusing bug in the system for anyone who enables it and then tries to paste an image into an affected app.

3. Native Wayland Daemon
Integrate a native Wayland data-control daemon (like cliphist or wl-clip-persist) that is explicitly designed to safely proxy and store clipboard file descriptors without destroying the offer for the user.

  • Pros: Perfect UX (background history + reliable pasting).
  • Cons: Requires adding and maintaining a new compiled dependency in the Omarchy package set.

@D-Pagey
D-Pagey force-pushed the fix/clipboard-image-deadlock branch from 8ac2f51 to 03a253c Compare September 13, 2026 16:55
@D-Pagey D-Pagey changed the title Fix clipboard deadlock by replacing aggressive image watcher with a polling timer Fix clipboard deadlock by removing aggressive Wayland image watcher Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant