electron-overlay-window icon indicating copy to clipboard operation
electron-overlay-window copied to clipboard

Add Wayland support for KDE Plasma (Closes #28)

Open MagellaX opened this issue 7 months ago • 10 comments

  • Add complete Wayland backend implementation (src/lib/wayland.c)
  • Add KDE Plasma protocol definitions (src/lib/wayland-protocols.h)
  • Update build system with Wayland dependencies (binding.gyp)
  • Add automatic environment detection for Wayland vs X11
  • Add comprehensive documentation (WAYLAND_SUPPORT.md)
  • Update README with Wayland support information
  • Maintain backward compatibility with existing API

This addresses issue #28 by providing experimental Wayland support specifically for KDE Plasma environments. The implementation includes:

  • Automatic Wayland environment detection
  • KDE Plasma window management protocol support
  • Full event handling (attach, focus, blur, detach, fullscreen, moveresize)
  • Memory management and cleanup
  • Comprehensive documentation and troubleshooting guide

Limitations:

  • Experimental support for KDE Plasma only
  • Screenshot functionality not implemented for Wayland
  • Requires KDE Plasma window management protocols

MagellaX avatar Jul 31 '25 07:07 MagellaX

Hey @SnosMe can you merge this asap!!

MagellaX avatar Jul 31 '25 07:07 MagellaX

i think you can merge it now @SnosMe

MagellaX avatar Jul 31 '25 10:07 MagellaX

I don't have Linux at hand, and I assume you're developing in KDE so you can easily test it. Just so I don't look like an asshole for making you do extra work, I just recorded my desktop too.

https://github.com/user-attachments/assets/9d1dd868-8e68-40be-b32d-c8fd1c47a3be

SnosMe avatar Jul 31 '25 10:07 SnosMe

i think the checks have passed. What went wrong exactly in that video?

MagellaX avatar Jul 31 '25 10:07 MagellaX

Checks are nice to have, but ultimately I care about merging the code that works. You can't unit test this, this is a classic manual QA, I want to see that it works on Wayland KDE on recording.

P.S. I'm not against AI generated code, but you at least should verify that it works.

SnosMe avatar Jul 31 '25 10:07 SnosMe

Checks are nice to have, but ultimately I care about merging the code that works. You can't unit test this, this is a classic manual QA

Yeah but what exactly went wrong?

MagellaX avatar Jul 31 '25 10:07 MagellaX

What went wrong exactly in that video?

Nothing, because it's main branch on my machine. And I want you to record same video with your branch on KDE.

SnosMe avatar Jul 31 '25 11:07 SnosMe

What went wrong exactly in that video?

Nothing, because it's main branch on my machine. And I want you to record same video with your branch on KDE.

if nothing went wrong, then what's the issue, bro? Right now, I can't record cause i'm not available with my setup.

but it works, the code works fine, bro

MagellaX avatar Jul 31 '25 11:07 MagellaX

What went wrong exactly in that video?

Nothing, because it's main branch on my machine. And I want you to record same video with your branch on KDE.

if nothing went wrong, then what's the issue, bro? Right now, I can't record cause i'm not available with my setup.

but it works, the code works fine, bro

So pls just merge it

MagellaX avatar Jul 31 '25 13:07 MagellaX

Hey @SnosMe, just wanted to let you know that this is a misguided attempt to add KDE Wayland support. To implement this using a wayland protocol, you'd need to use something like wlr-foreign-toplevel-management-unstable-v1 (which doesn't work on KDE, see this KDE feature request ticket), not something like org_kde_plasma_window_management.

The code compiles, that's about it. I couldn't get it to actually do anything (even after fixing a bunch of issues on my fork), because org_kde_plasma_window_management will never be bound in the registry_handle_global function, because it can only be bound by one client, which is the built-in KDE Plasma Desktop Environment (taskbar and friends) on almost all systems.

KDE simply does not provide any wayland interfaces for non-internal components to manage windows.

AFAIK, the only way to do this on KDE is to use the Plasma Desktop scripting interface.

I have tried this in the past (see the wayland-test branch on my fork), but never quite got it working up to a decent standard.

I appreciate how you went above and beyond to try to get this contribution merged into your project, and I just wanted to chime in so you don't spend more of your time on this particular implementation.

pendo324 avatar Aug 26 '25 02:08 pendo324