I recently installed Ubuntu 17.10 which uses Wayland instead of (or in some sort of combination?) X11. Before I could use xprop -root|grep ^_NET_CLIENT_LIST
or wmctrl (wmctrl -lpGxu
) to get a list of all active windows. This doesn't work any more with all gnome applications like the terminal and some others like nautlius. Is there any way to list those?
How to get a list of active windows when using wayland
gnomewayland
Best Answer
Yeah, on Wayland, sadly Xorg utilities like
wmctrl
andxdotool
do not function. Instead we can talk to the window manager.For Gnome, we can run
gdbus
to send a DBUS message to execute some GJS (JavaScript bindings for the GNOME C APIs).To get a list of windows, with their class and title (using
sed
andjq
to prettify):Example output:
To get the class of the currently focused window:
You can play around with what's possible in GJS using Gnome's 'Looking Glass' debugger: Alt+F2, and run
lg