Getting pid of focus window

Dave Airlie airlied at gmail.com
Thu Jan 20 17:59:42 PST 2011


>
> this weekend i wrote a plugin for ulatencyd which tries to get the pid
> of the window in focus so the program can get scheduled with more cpu
> slots then other programs. I don't want to flame on X11, but it is
> 1. Terrible to do. Even with root permissions you need workarounds just
> to connect.
> 2. The window manager needs to set a property on the root window which
> window has focus (not everyone does), and complete transversal is just
> stupid. Gnome and KDE do at least.
> 3. The toolkit needs to set the pid and hostname on the window property.
> QT and GTK do at least.
>
> I have only looked roughly at wayland, but haven't seen an API for this.
> If not, could you add an API for getting such information please.
>

Its called doing it wrong, the way something like this should work is
you plug something into the desktop env which runs as the user, and
uses some method to talk to the local latencyd.

You don't run apps as root and force them to connect to the running X
server, that is a hack and is just laziness on the part of the
programmer.

Dave.


More information about the wayland-devel mailing list