Skip to content

Add clipboard widget with history, search, and image support#666

Open
stylebending wants to merge 5 commits intoamnweb:mainfrom
stylebending:add-clipboard-widget
Open

Add clipboard widget with history, search, and image support#666
stylebending wants to merge 5 commits intoamnweb:mainfrom
stylebending:add-clipboard-widget

Conversation

@stylebending
Copy link

@stylebending stylebending commented Jan 29, 2026

Summary

This PR adds a new clipboard widget to YASB, providing a searchable clipboard history with long text preview and support for both text and images.

Features

Built-in search bar.
Clear history or delete single item.
Preview long text per history item by hovering over it.
Full support for copying and previewing images directly in the history list.

This is my first contribution of this size to a free and open-source project, so any feedback (code, structure, or UX) is very welcome 🙂

Tested with both text and image clipboard content on Windows 11.

@amnweb
Copy link
Owner

amnweb commented Jan 29, 2026

Isn't it better to use the official API to access Windows clipboard data in realtime? https://learn.microsoft.com/en-us/windows/win32/dataxchg/clipboard

@stylebending
Copy link
Author

Isn't it better to use the official API to access Windows clipboard data in realtime? https://learn.microsoft.com/en-us/windows/win32/dataxchg/clipboard

Thanks for the suggestion and the link! That makes sense, and I agree that using the official Windows clipboard API is the better approach for real-time access.

Would you prefer that I update this PR with the new approach, or close it and open a fresh one once the changes are ready?

@amnweb
Copy link
Owner

amnweb commented Jan 30, 2026

Would you prefer that I update this PR with the new approach, or close it and open a fresh one once the changes are ready?

As you wish, your choice.

@stylebending stylebending changed the title Add clipboard widget with history, pinning, search, and image support Add clipboard widget with history, search, and image support Jan 31, 2026
@stylebending
Copy link
Author

This is as complete as I could get it, only thing missing is the pinning feature but the Python WinRT package doesn't support clipboard pinning it seems. Sorry for the multiple commits.

@amnweb
Copy link
Owner

amnweb commented Feb 4, 2026

I will probably check this this week when I have some free time, but let me know, using WinRT will require having the clipboard enabled in Windows OS, right?

@Video-Nomad
Copy link
Contributor

Thanks for the PR @stylebending. Same issue as with your other PR regarding the new validation schema format. It was a necessary change, so please check other widgets to get the general idea. Also Writing Widgets was updated.

@stylebending
Copy link
Author

I will probably check this this week when I have some free time, but let me know, using WinRT will require having the clipboard enabled in Windows OS, right?

Yes it specifically requires 'Clipboard History' to be toggled On in Windows System Settings. If disabled, the WinRT API won't have a history buffer to pull from, and the widget will default to 'No items match your search.' I can add a small note to the widgets' README/Docs about this if you think it's necessary!

Thanks for the PR @stylebending. Same issue as with your other PR regarding the new validation schema format. It was a necessary change, so please check other widgets to get the general idea. Also Writing Widgets was updated.

Thanks again for the heads-up! I've updated the validation schema to follow the new Pydantic format, using the other widgets and the updated documentation as a reference. This is ready for another look, let me know if any further tweaks are needed!

@amnweb
Copy link
Owner

amnweb commented Feb 8, 2026

Ok, tested.

  1. This widget requires winrt.windows.applicationmodel.datatransfer to work, which is not defined in the project.
  2. .clipboard-menu .clipboard-item [icon] should use a class name if needed, not [icon].
  3. QScrollBar should be defined inside the widget, same as we have in the GitHub widget, for example.
  4. Style and example are not correct; many things are missing to make this widget work out of the box.
  5. If clipboard is not enabled in Windows, we should show a message inside the widget that users need to enable it.
  6. Remove container_padding: PaddingConfig = PaddingConfig(); this is deprecated, and new widgets should not include it. Just use margin 0,0,0,0 in the widget.
  7. Showing copied text inside the bar looks bad. We need to have an icon inside the config so users can define their own icons or text string for each action, and also delete button icon, copy, copied, etc.
  8. That's all for now what i found...

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.

3 participants