udevbe / greenfield

HTML5 Wayland compositor :seedling:
GNU Affero General Public License v3.0
901 stars 27 forks source link

Clipboard doesn't cross over on firefox #101

Closed rosensvv closed 2 years ago

rosensvv commented 2 years ago

86 Is not fixed for me, I cannot copy outside the browser window and I cannot copy into the browser window from the system clipboard.

Zubnix commented 2 years ago

What browser are you using? Do you see anything in the browser logs? What native app are you using inside greenfield and on your client?

Sadly clipboard crossover is notoriously difficult to get right in all cases. I've test on Chrome using gtk3-demo-application & kwrite running on XWayland in greenfield, and gnome-terminal as the native client app.

rosensvv commented 2 years ago

I tried on firefox and it didn't work. Now that I read your comment I tried it on Edge and it prompted me to allow reading of the clipboard (which firefox didn't) and it works. So I'm guessing it works on chrome-based browsers but not on firefox :(

rosensvv commented 2 years ago

This is likely a fault of firefox, but when the following settings are enabled in about:config :

dom.events.asyncClipboard.clipboardItem
dom.events.asyncClipboard.read

whenever I try to paste something from greenfield, it only shows [object Promise] as the text that gets pasted. The async clipboard implementation in firefox is still in development?

Zubnix commented 2 years ago

Yeah it looks like the Clipboard API is still in development in Firefox. Looking at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard at the bottom of the page and clicking on table cells under the Firefox header does seem to indicate that. I'll see if I can implement some workarounds.

Zubnix commented 2 years ago

I've added a fallback to text selection. Firefox by default only allows writing to the clipboard, so remote app to native client app should work by default. The other way around requires some permissions/features explicitly enabled.

Zubnix commented 2 years ago

Is this fixed for you? I believe it's working as well as it can for Firefox?