如何以编程方式切换到compiz中的特定窗口? [英] How to programmatically switch to a specific window in compiz?

查看:74
本文介绍了如何以编程方式切换到compiz中的特定窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个命令告诉compiz我们要放在最前面并将焦点设置到特定窗口? 我们应该如何在该命令中识别窗口?

Is there a command to tell compiz that we want to bring in front and set focus to a specific window? How should we identify the window in that command?

这个问题背后的原因是以下用例:

The reason behind this question is the following use-case:

假设我们有一个Wiki,以记录我们发现的任何有趣的事情.使用键盘快捷键将浏览器窗口置于我们的Wiki页面的最前面,然后立即开始键入,然后使用另一个组合键切换到我们之前使用的应用程序,将会非常方便

Suppose we have a wiki to keep notes of anything interesting we find out. It would be very convenient to have a keyboard shortcut to bring the browser window with our Wiki page in front and start typing immediately then with another key combination switch to the application we were working before

我知道 ALT + TAB 在最后两个使用的窗口之间切换,但是不能支持更复杂的应用程序组合.例如Browser + Eclipse + Wiki

I know that ALT + TAB switches between the last two used windows but cannot support more complex combinations of applications. E.g Browser+Eclipse+ Wiki

如果有上述命令,可以很容易地从KDE或GNOME界面向其中添加快捷方式

If there is a command like the one described, it is easy to add a shortcut to it from KDE or GNOME interface

推荐答案

您正在寻找的是 wmctrl . 例如,添加键盘快捷方式以调用类似

What you are looking for is wmctrl. For example, add a keyboard shortcut to invoke a command like

wmctrl -Fa 'Wiki - Google Chrome'

引发并激活带有该标题的窗口.

to raise and activate the window with that title.

通过标题,ID等选择窗口的方式有多种.请参见 man wmctrl . 可以通过运行获取窗口列表

There are different ways of selecting a window by title, id, etc. See man wmctrl. The list of windows can be obtained running

$ wmctrl -l

我还没有在compiz上尝试过,但是 wmctrl 应该适用于任何符合EWMH的窗口管理器.

I haven't tried it with compiz but wmctrl should work for any EWMH compliant window manager.

这篇关于如何以编程方式切换到compiz中的特定窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆