Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically switch to a specific window in compiz?

Tags:

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:

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

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

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

like image 203
FossilBit Avatar asked Jan 04 '10 15:01

FossilBit


1 Answers

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.

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 

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

like image 91
Diego Torres Milano Avatar answered Sep 28 '22 07:09

Diego Torres Milano