wayland-x11-compat-protocols icon indicating copy to clipboard operation
wayland-x11-compat-protocols copied to clipboard

xdotool replacement using wayland protocols

Open lnee94 opened this issue 1 year ago • 16 comments

The remote desktop protocol should be able to do a lot of heavy lifting

lnee94 avatar Dec 21 '23 18:12 lnee94

Not sure I understand your point, can you elaborate? Thanks!

probonopd avatar Dec 21 '23 18:12 probonopd

Not sure I understand your point, can you elaborate? Thanks!

Make A script that mimics xdotools interface but does all of the things using way protocals

lnee94 avatar Dec 21 '23 19:12 lnee94

Yes. That'd be a good way to do it, but that would require that everything that can be done with xdotools can be done with Wayland protocols. Is that the case?

probonopd avatar Dec 21 '23 19:12 probonopd

https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.impl.portal.RemoteDesktop.html Supports absolute mouse movement and keyboard.

lnee94 avatar Dec 21 '23 19:12 lnee94

https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.impl.portal.RemoteDesktop.html Supports absolute mouse movement and keyboard.

This is not enough for an xdotool equivalent. Window query and modification functions (maximize, close, resize, move, you know) don't exist.

tildearrow avatar Dec 21 '23 23:12 tildearrow

With windows on kde you could make a kwin script

lnee94 avatar Dec 22 '23 23:12 lnee94

With windows on kde you could make a kwin script

Thanks for the idea, but we need solutions that are not tied to any particular desktop environment.

probonopd avatar Dec 30 '23 16:12 probonopd

Good example of KWin script method, kdotool: https://github.com/jinliu/kdotool

ernzo avatar Sep 25 '24 19:09 ernzo

Yes, but we need something that works on every Wayland based system, not only KDE.

probonopd avatar Sep 28 '24 05:09 probonopd

Yes, I mentioned it cause kdotool seems the best implementation of this type I've seen so far.. (noob here)

There's other guys going the Xwayland rootful way: https://ofourdan.blogspot.com/2023/11/xwayland-rootful-part-2.html

But yeah, in the end this needs to break away from Xwayland and X11 too..

ernzo avatar Sep 28 '24 11:09 ernzo

Frankly, their description of how it works makes me wonder what the KWin devs are thinking.

If something can script the installation and running of a temporary KWin Script, what's the point in requiring those APIs to only be used within one? It provides no security benefit.

ssokolow avatar Sep 28 '24 13:09 ssokolow

How the hell is it reasonable to generate a script, load it, run it then delete it for a simple task? What if someone wants to do it every frame? This is just unbelievably inefficient...

Pannoniae avatar Sep 28 '24 16:09 Pannoniae

Because that's not how the KDE interfaces are meant to be used, just like how you're not supposed to fork a new instance of xdotool every frame.

ssokolow avatar Sep 28 '24 16:09 ssokolow

Sure, they are not meant to be used that way.... but it's not like there are proper APIs to do that sort of thing, either.

Pannoniae avatar Sep 28 '24 17:09 Pannoniae

My point is that, if you're already writing a KDE-specific tool, the proper solution for attempting to do stuff that quickly is to write a persistent script that just gets installed along with the command-line utility, stays loaded, and waits for commands through some avenue like the creation of a minimized-by-default, skip-taskbar, always-below window containing the relevant control data in its properties.

...plus, this would all make sense as a security measure if they hadn't left the combination to their heavy-duty vault on a post-it note on the door. I can only assume the security model is "Flatpak apps will only have been granted access to the relevant D-Bus APIs in exceptional circumstances and traditionally installed applications aren't part of what's being mitigated against".

ssokolow avatar Sep 28 '24 18:09 ssokolow

Well, kdotool is basically using KWin via DBus as an interface to communicate with the system.. KWin also goes via DBus to interact with the rest of the system/kernel..

This provides a higher level of abstraction making it easier to interact with the kernel, while also adding basic security, although it can be easily bypassed..

I guess if we wanted stronger security we will need to operate on a lower level.

What we need then is something like kdotool that interacts directly with the system/kernel, bypassing in effect KWin.. But that will add a lot of complexity and add its own security risks.. (maybe via wlroots or libwayland?)

Another option could be going through a compositor like Sway, it might bring security of its own, but we'll be limited to its actual capabilities.. (plus not everyone uses Sway)

ernzo avatar Sep 28 '24 20:09 ernzo