identifying active application/window under wayland

Marius Vlad marius.vlad at collabora.com
Tue Mar 19 09:04:22 UTC 2024


On Fri, Mar 15, 2024 at 05:07:24AM +0000, Dan Kortschak wrote:
> Hello,
Hi,
> 
> Apologies if this is not the correct forum for this. If this is the
> case, please direct me to a more appropriate place.
> 
> I have searched the archive and cannot find any topic that appears to
> cover this.
> 
> I am the author of a program that in part needs to be able to obtain
> the identity of the active application and window (including its title)
If the program is a client you won't be find this information, as that's
inherent part of the Wayland architecture (avoid one client 
snooping on another's client data).  The program needs to be part of 
the compositor to be able to have that information. As an example,
with Weston's kiosk shell, you can move/map windows on different outputs
based on their appid: 
https://wayland.pages.freedesktop.org/weston/toc/kiosk-shell.html

Depending on the compositor some of the give you the option to use
plug-ins, or use their libraries to add additional code.
> being used by a user. This is required for context-dependent
> configuration of an external device and also, if configured by the
> user, logging of user activity for time tracking.
> 
> This is readily achievable on the platforms that are currently
> supported (X11 and MacOS), but as far as I can see there does not
> appear to be a unified approach to achieving this under Wayland.
> 
> Is it the case that there is no way to achieve this, or am I just
> missing things that are possible? Is it the case that I may need to
> only cover a subset of DEs and special-case code for each that is
> supported? Are there plans to support this kind of use?
The Wayland architecture incorporates the display server, window manager
and compositor into one, there's no DE similarly to what you have with X.

I'm not aware of a unified way of doing this, but maybe use-reusing 
XDG portals (https://flatpak.github.io/xdg-desktop-portal/docs/) to
achieve the same functionality could be a way of doing that?
> 
> thanks
> Dan
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20240319/1295fe2d/attachment-0001.sig>


More information about the wayland-devel mailing list