dbus beginner

Thomas Kluyver thomas at kluyver.me.uk
Sat May 18 10:36:41 UTC 2024


Hi Dave,

I don't think there's a standard API for this, so you may need to figure it out for each desktop & window manager separately.

For Gnome, it looks like most of what you want is not available by default, but there's an extension that provides extra D-Bus methods:
https://askubuntu.com/questions/1441664/how-do-i-move-maximize-activate-desktop-windows-using-dbus-in-terminal

Some bits (like the list of open windows) are present in Gnome's D-Bus API, but normally blocked by a security setting. It's possible to enable an 'unsafe mode' which allows these things, but there's no easy way to do that programatically.

Best wishes,
Thomas

On Sat, 18 May 2024, at 09:41, Dave Amies wrote:
> Hi All,
> 
> I'm new here, so perhaps it's best to explain what I'm aiming to achieve and you can tell me if I'm heading in the right direction?
> 
> I want to create a add in library for an open source test automation tool that will allow the automation of linux desktop apps, there is already a library for windows desktop apps but for linux and mac the only options are image based test which are unreliable and clumsy, so my goal is to try and fix this for linux.
> 
> I have written libraries for this test automation tool before, It uses python for these libraries and that part is quite easy.
> 
> So far my searches for how to do various desktop actions using python all led me to dbus, but then I also see comments that the examples no longer work in newer versions of gnome due to security reasons.
> 
> I've installed d-feet on my machine and had a bit of a poke around but honestly I'm a bit lost and don't really know where to start and what the best practices are
> So I guess I'm looking for a beginner's guide to dbus for automating the desktop, gnome & kde is probably a minimum I'll need, but if the code can be generic and support mre DE's that would be great.
> 
> My first steps I'd like to achieve are:
> - get a list of open windows
> - get the active/foreground window (I know it's not always the same thing)
> - bring a window to the foreground & make it active
> - get a window position & size
> - move a window
> - resize a window
> 
> Any pointers would be appreciated, I don't expect code examples, just point me in the right direction in the documentation.
> 
> Thanks,
> 
> Dave.
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20240518/0f37194e/attachment.htm>


More information about the dbus mailing list