Open arp242 opened 3 years ago
How about https://godoc.org/github.com/BurntSushi/xgb or https://godoc.org/github.com/BurntSushi/xgbutil? Both are pure Go.
Yeah, I think I looked at that actually; I probably just didn't feel like working on it because the dmenu
integration works well enough for me haha
https://github.com/golang-design/clipboard is nice, and cross-platform.
The big problem with this is how the X clipboard works. When you "copy" something nothing is actually copied; the application just takes ownership of the clipboard, and on paste X asks the application which text to send. This is a well-known annoyance: quit an application and if you had something copied in there then it's lost.
Tools like xclip work around this by forking and staying active, so that print foo | xclip
doesn't block your shell. Forking in Go seems rather hard though, and not something that's easily possible.
Running xclip also doesn't really work, since it will wait for xclip to finish, although that may be solvable.
And need to look at this whole wayland thing, too.
Meh...
From HN comment https://news.ycombinator.com/item?id=21780608
Also maybe send as direct input (xdotool can do this, but is apparently not reliable across all apps/characters).
Can also link to libX11, but this requires cgo and makes builds harder.