dragon icon indicating copy to clipboard operation
dragon copied to clipboard

Dragon doesnt work on Sway

Open HappyCthulhu opened this issue 1 year ago • 2 comments

Hello. I switched to sway few weeks ago. Im in love with CLI-tools, that allow me to drag&drop from CLI, but im expiriencing troobles with that on Wayland. Drag window shows up, but i cant drop anything. Sometimes i can, sometimes - cant. Can u suggest some solution for me? Or, at least, tell me, how to debug it properly.

Also, your app gives me error:

(dragon:161804): Gdk-WARNING **: 14:59:50.047: Error writing selection data: Error writing to file descriptor: Broken pipe

If this error is related to my bug - how can i enable moving popups? Is that even possible?

Demonstration:

https://github.com/mwh/dragon/assets/23531195/9a4597e7-98ff-431e-b9be-dbd5955d0ddc

HappyCthulhu avatar Apr 07 '24 13:04 HappyCthulhu

Similar to vimpostor/blobdrop#5, it appears that this is an issue with the drop target (google-chrome in this case) running under XWayland, meanwhile dragon-drop is running in native Wayland mode.

Edit: Given the other two issues you opened (https://github.com/mwh/dragon/issues/72 https://github.com/nik012003/ripdrag/issues/43), I suspect that this is not an issue in blobdrop but rather with Chrome running in XWayland, while blobdrop is running in native Wayland mode. If that is the case, you can either try starting Chrome in native Wayland mode, or alternatively blame the Wayland folks for still not having fixed DnD between XWayland and Wayland in 2024.

-- vimpostor commented on Apr 7, 2024

If you have further issues with drag & drop between applications, you can verify if any are running under XWayland with:

# Utility from Arch Linux package: extra/xorg-xlsclients
# sudo pacman -Sy xorg-xlsclients

xlsclients

FWIW: I've been able to reproduce this issue by trying to drag & drop from dragon-drop to another app running under XWayland:

(dragon-drop:2096045): Gdk-WARNING **: 15:49:33.100: Error writing selection data: Error writing to file descriptor: Broken pipe

trinitronx avatar Sep 09 '24 21:09 trinitronx

For future reference, as explained here it's possible to use the following environment variables to control which display server protocol backend is used:

Application GUI Toolkit Environment variable
GDK / GTK GDK_BACKEND
Qt QT_QPA_PLATFORM

Below is a simple key to know which variable to set for a given client application to force either X11 or Wayland display server backend.

Support Matrix:

Application GUI Toolkit X11 Wayland
GDK / GTK export GDK_BACKEND=x11 export GDK_BACKEND=wayland
Qt export QT_QPA_PLATFORM=xcb export QT_QPA_PLATFORM=wayland

Due to limitations of drag & drop functionality between Xorg/X11 and Wayland client applications, it's often essential[^1] that both applications are running under the same display server backend. Either both need to be running as X11 clients, or both need to be Wayland clients. (for best results)

[^1]: Intended as a general "rule of thumb", since "your mileage may vary", etc... (e.g. KWin purportedly supports this, meanwhile wlroots only supported Wayland -> XWayland DnD, leaving the other direction unimplemented until a later time).

trinitronx avatar Sep 09 '24 22:09 trinitronx