Every time I read something about ICCCM, this post comes into my mind:
I really like the part about pasting a host name. Interesting to reflect on how this happens in the design phase. Seems obvious we should add some structure to the data. Hostname is something of an important type in the era. So makes sense, in that regard. But when would a program want a hostname and just randomly ask, anybody got a hostname, anybody, anybody?
I’m reminded of the syslog interface, which has anointed types for ftp and uucp (uucp! Which my phone autocorrects to yuck.) so they’re dead, but other daemons exist, and the whole works is crammed into the daemon facility now.
Lesson: probably unwise to make a “generic” interface and then enumerate every option.
Some time ago, I wrote a C library to interact with the X and MS Windows clipboard in a cross-platform way without large dependencies like Gtk+. It only supports text, but at least Unicode text. I haven’t used it anymore since then, though. From that experience, I can definitely say that the X clipboard system is ridiculously complex. Does anyone have a pointer to me whether Wayland has improved on that topic?
At one point I decided I wanted to write the Wayland equivalent of xclip, and I started looking into the documentation. Unfortunately for me, it turns out that Wayland will only let you read or write the clipboard in response to an input event, like a mouse-click or key-press. This is so that unscrupulous programs can’t lurk in the background and send all your clipboard-copies to the Russian mafia and cause your pastes to produce Viagra adverts. A noble goal, but it makes a hypothetical wayclip program much less usable.
Of course, in practice every Wayland desktop will have Xwayland installed for compatibility with existing X11 apps… which means that under Wayland, you keep using xclip and it works just fine.
See Also: “The X Selection Mechanism, or How to Cut and Paste in 1000 lines or more”:
While we’re pasting links about X clipboards: https://www.jwz.org/doc/x-cut-and-paste.html