Skip to content

apprt/gtk: remove explicit X11 clipboard atom#9570

Merged
mitchellh merged 1 commit intoghostty-org:mainfrom
vancluever:remove-explicit-x11-clipboard-atom
Nov 12, 2025
Merged

apprt/gtk: remove explicit X11 clipboard atom#9570
mitchellh merged 1 commit intoghostty-org:mainfrom
vancluever:remove-explicit-x11-clipboard-atom

Conversation

@vancluever
Copy link
Copy Markdown
Contributor

Fixes #9532
Supersedes #9554

Turns out the explicit UTF8_STRING atom was not needed after all and GTK adds it automatically when running under X11; just having the explicit UTF-8 charset type is enough.

This corrects situations where it may not be necessary to include (Wayland), in addition to removing a duplicate atom under X11.

Importantly, this also corrects issues under Wayland in some scenarios, such as using Electron-based apps (e.g., VSCode/Codium under Ubuntu 24.04 LTS).

@vancluever vancluever requested a review from a team as a code owner November 12, 2025 21:12
Turns out this was not needed after all and GTK adds it automatically
when running under X11; just having the explicit UTF-8 charset type is
enough.

This corrects situations where it may not be necessary to include
(Wayland), in addition to removing a duplicate atom under X11.

Importantly, this also corrects issues under Wayland in some scenarios,
such as using Electron-based apps (e.g., VSCode/Codium under Ubuntu
24.04 LTS).
@vancluever vancluever force-pushed the remove-explicit-x11-clipboard-atom branch from 67ccde2 to 4f6c5a8 Compare November 12, 2025 21:13
@mitchellh mitchellh enabled auto-merge November 12, 2025 21:19
@mitchellh mitchellh added this to the 1.3.0 milestone Nov 12, 2025
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the diligence on this!

@mitchellh mitchellh merged commit 0f64b9a into ghostty-org:main Nov 12, 2025
54 checks passed
@vancluever
Copy link
Copy Markdown
Contributor Author

No problem @mitchellh!

Another small addendum: I just decided to check foot, and they offer UTF-8 first, along with the X11 atoms (offered last). However, pretty sure my assumption about the actual selected type being up to the client still stands:

(https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing)

Data negotiation

A client providing data to other clients will create a wl_data_source object and advertise the mime types for the formats it supports for that data through the wl_data_source.offer request. On the receiving end, the data offer object will generate one wl_data_offer.offer event for each supported mime type.

The actual data transfer happens when the receiving client sends a wl_data_offer.receive request. This request takes a mime type and a file descriptor as arguments. This request will generate a wl_data_source.send event on the sending client with the same arguments, and the latter client is expected to write its data to the given file descriptor using the chosen mime type.

So we got some extra context here in the event that we see more clients misbehave than not and we actually do need to adjust the order (or actually add the X11 atoms in Wayland).

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.

tip: Ghostty copies text to the clipboard as 'UTF8_STRING', which breaks pasting to Electron apps

2 participants