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

Enable wlr_data_control protocol #101

Merged
merged 7 commits into from
Nov 13, 2023

Conversation

xDarksome
Copy link
Contributor

@xDarksome xDarksome commented Apr 16, 2023

Resolves #99

@xDarksome xDarksome changed the title Implement wlr_data_control protocol Draft: Implement wlr_data_control protocol Apr 16, 2023
@xDarksome xDarksome marked this pull request as ready for review May 6, 2023 15:53
@xDarksome
Copy link
Contributor Author

@Drakulix what is the best way to test Wayland <-> X clipboard integration? I don't actually use any X clients.

I tried xclip , but it behaves like a separate clipboard, in hyprland as well. So I'm not sure whether it's a bug on my side.

@Drakulix
Copy link
Member

Drakulix commented May 7, 2023

I tried xclip , but it behaves like a separate clipboard, in hyprland as well. So I'm not sure whether it's a bug on my side.

You would have to use xclip with the -selection clipboard argument, but even then I am not sure it will work, given cosmic will deny X11 clipboard access if no X11 window has focus.

You can start some terminals, text editors, browsers etc forcing them to go through Xwayland by unsetting WAYLAND_DISPLAY, when launching them.

@xDarksome
Copy link
Contributor Author

First day of daily driving went fine. Experienced only a single crash 😄
I'm going to test it more during the week.

@Drakulix
Copy link
Member

Drakulix commented May 8, 2023

First day of daily driving went fine. Experienced only a single crash smile

Sounds good! Please give me a ping once this is ready for a proper review. :)

@xDarksome
Copy link
Contributor Author

xDarksome commented May 8, 2023

@Drakulix I'm not planning to do any changes, unless I find some bugs. The crash I experienced today is unrelated, it's something about switching tilingmode + using fullscreen, but I'm not sure yet. I'll file a bug report, once I identify it more clearly.

I still need to verify X-wayland clipboard integration, which I'm going to do sometime this week. But the PR may be considered ready for review. Although it's no rush as I'm already using it and don't care that much about when it's going to hit upstream.

@xDarksome
Copy link
Contributor Author

xDarksome commented May 13, 2023

Selection sources used:

  • Firefox with MOZ_WAYLAND_ENABLE=0 (xwayland)
  • Gedit with GDK_BACKEND=x11 (xwayland)
  • Alacritty (native wayland)
  • wl-clipboard (data_control)

Results of manual testing (master):
✔️ xwayland clipboard -> data_device
❌ data_device -> xwayland clipboard (See *behavior A)
❌ xwayland primary -> primary_selection (nothing happens)
❌ primary_selection -> xwayland primary (See *behavior B)

Results of manual testing (this PR):
✔️ xwayland clipboard -> data_device
❌ data_device -> xwayland clipboard (See *behavior A)
❌ xwayland primary -> primary_selection (nothing happens)
❌ primary_selection -> xwayland primary (See *behavior B)

✔️ xwayland clipboard -> data_control
❌ data_control -> xwayland clipboard (See *behavior A)
❌ xwayland primary -> data_control (nothing happens)
❌ data_control -> xwayland primary (selection is not being applied at all, maybe bug on my side)

✔️ data_control <-> data_device
✔️ primary_selection -> data_control
❌ data_control -> primary_selection (nothing happens)

*behavior A - First time pressing CTRL-V inside the window works fine, then nothing happens and this being printed in logs: WARN Mime type requested by X client not offered. Then it sometimes works if you copy and paste quick enough 🙃 (seems like the selection is being asynchronously dropped somehow somewhere)

*behavior B - Similar to A, but we don't have this 100% working the first try, and we immediately get into the nondeterministic behavior when it sometimes work depending on how quick you are

My general conclusion is: there is maybe one bug on my side related to (data_control -> xwayland primary) route. Everything else seems unrelated to this PR. There seem to be multiple bugs in xwayland and primary_selection implementations in smithay, though.

@Drakulix
Copy link
Member

Drakulix commented May 15, 2023

Thanks for the detailed report and reproduction instructions, very much appreciated.
I will try to replicate these issue and merge fixes together with your work on the data-control protocol soon. I am currently just a little busy with a bunch of shell changes.

@kchibisov
Copy link

The upstream smithay has support for this protocol now which works with any sort of direction. So this could be closed now, I guess.

@xDarksome xDarksome changed the title Draft: Implement wlr_data_control protocol Draft: Enable wlr_data_control protocol Nov 12, 2023
@xDarksome xDarksome changed the title Draft: Enable wlr_data_control protocol Enable wlr_data_control protocol Nov 12, 2023
@xDarksome
Copy link
Contributor Author

Switched to the Smithay implementation, works fine for my usecase.
Haven't tested all the possible combinations

Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry this took so long, but with the new changes this is quite easy to review now. 😅

@Drakulix Drakulix merged commit 72ee1c4 into pop-os:master_jammy Nov 13, 2023
1 check passed
@rafaeldelboni
Copy link

Hi sorry to necro bump this, but how can I use this, I saw this feature is behind a config data_control_enabled, but is not clear to me where enable it.

@xDarksome
Copy link
Contributor Author

Hi sorry to necro bump this, but how can I use this, I saw this feature is behind a config data_control_enabled, but is not clear to me where enable it.

Seems like it requires this env var to be set now

let data_control_state = std::env::var("COSMIC_DATA_CONTROL_ENABLED")

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.

Using system clipboard inside a fullscreen Helix editor makes the Alacritty window to reposition itself
4 participants