Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow copying to clipboard #22

Open
arp242 opened this issue Jan 1, 2021 · 3 comments
Open

Allow copying to clipboard #22

arp242 opened this issue Jan 1, 2021 · 3 comments

Comments

@arp242
Copy link
Owner

arp242 commented Jan 1, 2021

From HN comment https://news.ycombinator.com/item?id=21780608

echo -n "$selected_symbol" | xclip -i

And then fake a middle click to insert in the current application:

xdotool click 2o

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.

@skuzzymiglet
Copy link

@arp242
Copy link
Owner Author

arp242 commented Jan 2, 2021

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

@arp242
Copy link
Owner Author

arp242 commented Apr 2, 2022

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...

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

No branches or pull requests

2 participants