Ubuntu – How to determine gnome-terminal window ID in Ubuntu 17.10

17.10gnome-terminal

In Ubuntu 17.04 I could use wmctrl to switch to a gnome-terminal window with given window ID:

wmctrl -ia $gnome_term_winid

The window ID of a given gnome-terminal could also be displayed from the terminal by typing:

echo $WINDOWID

After upgrading to Ubuntu 17.10, this is no longer the case. First, echo $WINDOWID gives nothing, and also wmctrl -lx does not show any gnome-terminal windows.

Best Answer

wmctrl doesn't work properly in a Wayland session as controlling windows is against Wayland's security policy.

wmctrl may work with the application windows running under the XWayland compatibility layer (for example Firefox). But gnome-terminal is an official GNOME app which doesn't run under XWayland so it fails.

You may try to switch to an Xorg session as a workaround.