Add clipboard history selector #44

Open
opened 2026-07-05 20:47:57 +00:00 by javif89 · 0 comments
Owner

Show the past x clipboard items (image or text) and selection should copy them.

Research

On Wayland, there usually is no clipboard history unless a clipboard manager was already running.

There's this tool called cliphist that acts as one of these clipboard watchers. We'll probably have to build something like this on waycast and put it as a separate command like waycast clipboard that will show the clipboard history instead of the normal launcher so users can set a keybind for it.

The tough part is adding ourselves as a clipboard watcher. The cliphist readme shows something like:

wl-paste --watch cliphist store

Since we want to provide a good user experience, we should figure out if there's a better way. Maybe starting a dbus service or something like that.

Storing the clipboard history

We already have a sqlite database, so we can store clipboard items there and model it as a ring buffer with a configurable size so only the latest X items are stored and we delete older ones once we reach the limit.

We obviously can't store images in the database, so we'll probably have to store them somewhere if we want to keep them in history.

Things to keep in mind

  • If we put an item we had store back into the clipboard (user selects it), we don't want to store it again. We should either do nothing, or simply switch it's spot in the buffer to be first
Show the past x clipboard items (image or text) and selection should copy them. ## Research On Wayland, there usually is no clipboard history unless a clipboard manager was already running. There's this tool called [cliphist](https://github.com/sentriz/cliphist) that acts as one of these clipboard watchers. We'll probably have to build something like this on waycast and put it as a separate command like `waycast clipboard` that will show the clipboard history instead of the normal launcher so users can set a keybind for it. The tough part is adding ourselves as a clipboard watcher. The cliphist readme shows something like: `wl-paste --watch cliphist store` Since we want to provide a good user experience, we should figure out if there's a better way. Maybe starting a dbus service or something like that. ### Links that might be helpful - https://wayland.app/protocols/wlr-data-control-unstable-v1 - https://github.com/decodetalkers/wayland-clipboard-listener - https://github.com/YaLTeR/wl-clipboard-rs ## Storing the clipboard history We already have a sqlite database, so we can store clipboard items there and model it as a ring buffer with a configurable size so only the latest X items are stored and we delete older ones once we reach the limit. We obviously can't store images in the database, so we'll probably have to store them somewhere if we want to keep them in history. ## Things to keep in mind - If we put an item we had store back into the clipboard (user selects it), we don't want to store it again. We should either do nothing, or simply switch it's spot in the buffer to be first
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
waycasthq/waycast#44
No description provided.