Skip to content

Conversation

@hn-88
Copy link
Contributor

@hn-88 hn-88 commented Oct 6, 2025

It turns out that xclip is actually waiting for Chromium / CEF to return the clipboard content, which does not happen. Adding a timeout, as in this commit, prevents OpenSpace from "hanging" due to this paste request on Linux.

One workaround, to enable the pasting of content copied from CEF, is to run

while true; do xclip -o | tee >(xclip -selection clipboard -i); sleep 1; done

in another terminal window. This will change ownership of the clipboard from Chromium/CEF so that pasting can happen. This loop will then need to be manually terminated when closing OpenSpace.

fix crash on Linux due to the first MIME type being returned by xclip
to prevent it from blocking OpenSpace when pasting content from Chromium / CEF
@alexanderbock
Copy link
Member

Does this actually solve the issue? Since it seems to be a problem that CEF is taking first pass at the copy/paste command, wouldn't it work to change that part of OpenSpace instead? It seems like instead of always having a timeout, fixing the underlying issue so that we don't ever need to wait would be the more stable solution?

@hn-88
Copy link
Contributor Author

hn-88 commented Dec 18, 2025

@alexanderbock , adding the timeout just prevents openspace from crashing when we hit Ctrl-V and the source is CEF.

I tried lots of workarounds. It seems that the issue is that CEF needs to interact with the event loop of whichever process is requesting the clipboard content, if the content was copied from CEF. If I try with code like this, openspace would crash - probably because of conflicting event loops or something like that.

Since I didn't want to make too many changes to the OpenSpace code, I did not try another workaround, which would be to copy the text into a global variable from CEF (on Linux), and on paste, if the clipboard times out, then paste the contents of the global variable instead.

Another workaround I did not try was to use CEF clipboard functions. Since this clipboard function is in Ghoul, and CEF is in a separate module, I was not sure how you would like to integrate it.

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.

2 participants