Skip to content

Fix text copy via mouse click on Wayland#50406

Open
soundslocke wants to merge 1 commit intozed-industries:mainfrom
soundslocke:main
Open

Fix text copy via mouse click on Wayland#50406
soundslocke wants to merge 1 commit intozed-industries:mainfrom
soundslocke:main

Conversation

@soundslocke
Copy link

I've been working on a GPUI application which has a button for copying text. After starting the app in Wayland in Linux I noticed that when I click the button to copy text it does not work. After interacting with other buttons and/or copying text via keyboard shortcuts then my copy button works.

I thought I was handling something wrong, but then I noticed that Zed also exhibits this behavior: upon starting Zed if you highlight text and right-click and select "Copy" then nothing happens. After you interact with other UI elements and/or keyboard shortcuts then copy buttons seem to work fine.

This paper cut has been annoying me and with the help of Claude Code I arrived at this small fix. This solves the problem and this appears to be the way the serial should be handled for clipboard actions via button clicks in Wayland, as far as I've been able to learn. Here are a couple related Wayland documentation pages that I double checked:

  1. https://wayland.app/protocols/wayland#wl_data_device:request:set_selection
  2. https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing-devices
  • Added a solid test coverage and/or screenshots from doing manual testing

  • Done a self-review taking into account security and performance aspects

    • None that I could find or think of
  • Aligned any UI changes with the UI checklist

    • I don't believe this is applicable...

Release Notes:

  • Improved first mouse-driven text copy action on Wayland

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 28, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant