How to use wmctrl to activate window of a given class?

7

2

The output of wmctrl -lx looks like this:

0x020002f5  0 Plasma.Plasma         lnx plasma-desktop
0x02a00015  0 okular.Okular         lnx TCP/IP Protocol Suite – Okular
0x032000fe  1 amarok.Amarok         lnx Billy Talent - This Suffering  ::  Amarok
0x03e00001  0 Google-chrome.Google-chrome  lnx wmctrl based on class - Google Search - Google Chrome
0x04400001  1 Chromium.Chromium     lnx openSUSE - Chromium
0x05400050  0 gvim.Gvim             lnx activate_or_run.sh (~/bin/repo) - GVIM
0x04a0001a  0 konsole.Konsole       lnx user@lnx:/home – Konsole

I would imagine that 2nd column denotes class of window.

Now I would like to activate the window based on its class rather than its title. Let's say the chosen window is gvim.Gvim.

So I tried wmctrl -ax gvim.Gvim or different combinations, surrounding gvim.Gvim in quotation marks, using only gvim then Gvim but to no success.

How can this be done?

ps-aux

Posted 2014-12-08T21:22:23.573

Reputation: 3 397

Actually @Arkonix was in the correct track. This works just like the answer: wmctrl -xa gvim.Gvim – Daniel Alfredo Sottile – 2018-09-14T14:45:27.920

Answers

10

Since <WIN> is a parameter of the -a option you should run the command as:

wmctrl -x -a gvim.Gvim

cYrus

Posted 2014-12-08T21:22:23.573

Reputation: 18 102