如何使用 wmctrl 激活给定类的窗口?

ps-*_*aux 8 linux window-manager x-server wmctrl

的输出wmctrl -lx如下所示:

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
Run Code Online (Sandbox Code Playgroud)

我想第二列表示窗口类。

现在我想根据它的类而不是它的标题来激活窗口。假设选择的窗口是gvim.Gvim

所以我尝试了wmctrl -ax gvim.Gvim不同的组合,gvim.Gvim用引号括起来,只使用gvim然后Gvim但没有成功。

如何才能做到这一点?

cYr*_*rus 12

由于<WIN>-a选项的参数,您应该将命令运行为:

wmctrl -x -a gvim.Gvim
Run Code Online (Sandbox Code Playgroud)