[PR #3330] [MERGED] Launcher: sync clipboard on Linux Wayland and X11 #4907

Closed
opened 2026-11-03 05:08:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3330
Author: @josegil1909
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/launcher-clipboard-linux


📝 Commits (2)

  • 8339f6d fix(launcher): sync clipboard on Linux Wayland and X11
  • 5bc76cb Launcher clipboard: one loop over the desktop's copy tools

📊 Changes

1 file changed (+53 additions, -9 deletions)

View changed files

📝 launcher/src/main.rs (+53 -9)

📄 Description

What and why

On Linux under Wayland, clicking "Copy" buttons in the launcher (such as Microsoft sign-in codes, crash reports, server addresses, agent commands, and invite links) fails to update the system clipboard.

Cause

In GPUI 0.2.2's Wayland backend, write_to_clipboard looks up the KeyPress event serial (state.serial_tracker.get(SerialKind::KeyPress)). When copying text via a button click with the mouse, the interaction event serial belongs to MousePress, leaving the KeyPress serial at 0 or stale. Wayland compositors (such as GNOME Mutter) require that wl_data_device.set_selection carries the serial of the user event that initiated it, causing the selection request to be silently discarded.

Solution

  • Add a shared helper in launcher/src/clipboard.rs providing clipboard::copy(cx, text).
  • Updates GPUI's internal clipboard and, on Linux, synchronizes the text with standard desktop clipboard tools (wl-copy on Wayland, xclip/xsel on X11) without adding external C library dependencies or modifying Cargo.lock.
  • Migrate the 5 copy button call sites across agents_page.rs, servers_page.rs, main.rs, and internet.rs.

Vanilla reference

Horizon-only (the launcher).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main)

Check Result
Scope ✅ 5 files, +95 −9
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅
launcher clippy ✅
launcher tests ✅ 137 passed
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3330 **Author:** [@josegil1909](https://github.com/josegil1909) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/launcher-clipboard-linux` --- ### 📝 Commits (2) - [`8339f6d`](https://github.com/horizon-rust/horizon/commit/8339f6d12f309a269ca6ceb3a00731ff4c9f0c3c) fix(launcher): sync clipboard on Linux Wayland and X11 - [`5bc76cb`](https://github.com/horizon-rust/horizon/commit/5bc76cbba985c3f56566b2a3be7f18b6bf55a126) Launcher clipboard: one loop over the desktop's copy tools ### 📊 Changes **1 file changed** (+53 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/main.rs` (+53 -9) </details> ### 📄 Description ## What and why On Linux under Wayland, clicking "Copy" buttons in the launcher (such as Microsoft sign-in codes, crash reports, server addresses, agent commands, and invite links) fails to update the system clipboard. ### Cause In GPUI 0.2.2's Wayland backend, `write_to_clipboard` looks up the `KeyPress` event serial (`state.serial_tracker.get(SerialKind::KeyPress)`). When copying text via a button click with the mouse, the interaction event serial belongs to `MousePress`, leaving the `KeyPress` serial at 0 or stale. Wayland compositors (such as GNOME Mutter) require that `wl_data_device.set_selection` carries the serial of the user event that initiated it, causing the selection request to be silently discarded. ### Solution - Add a shared helper in `launcher/src/clipboard.rs` providing `clipboard::copy(cx, text)`. - Updates GPUI's internal clipboard and, on Linux, synchronizes the text with standard desktop clipboard tools (`wl-copy` on Wayland, `xclip`/`xsel` on X11) without adding external C library dependencies or modifying `Cargo.lock`. - Migrate the 5 copy button call sites across `agents_page.rs`, `servers_page.rs`, `main.rs`, and `internet.rs`. ## Vanilla reference Horizon-only (the launcher). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main`) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +95 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ | | launcher clippy | ✅ | | launcher tests | ✅ 137 passed | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:48 +07:00
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
horizon-rust/horizon#4907
No description provided.