Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to find a way to raise all the windows that have one, specific title.

For example, I have two windows named superconky (yes, you guessed it, I'm trying to get conky running in lubuntu).

I have a command I got from the LXDE forums: sh -c 'wmctrl -k on; wmctrl -a superconky;'

I use it to show the desktop, except conky. It works perfectly, but only if you have one conky. If you have two or more, you get left with one and all the others minimized.

So, what should I do to raise all the windows?

Thanks in advance.

share|improve this question
up vote 3 down vote accepted

"So, what should I do to raise all the windows?"

Presumably you mean all the conky windows?

Since wmctrl is not doing what you want by specifying the window name, you should use the more exact method of speciying the window id.

To get the list of window ids one does

wmctrl -l

So assuming your windows have superconky in the title, to extract just the window ids from that list

windowid_list="`wmctrl -l | sed -ne 's|^\([^ ]*\).*superconky.*|\1|p'`"

Then process the list

if [ -n "${windowid_list}" ]
     for windowid in ${windowid_list}
         wmctrl -i -a "${windowid}"

Take note that the "-i" flag to denote a numeric windowid must be specified before the action flag ("-a", "-R", or whatever) or nothing happens.

Also take note that "-a" raises and focuses the window and that only one window can be focused at a time.

Also, if the second superconky window is directly underneath the first one, when the second one is raised, it will obscure the first.

share|improve this answer
Thank you! Worked like a charm! Just one little thing: for the ease of use, could this be converted into a one-liner? If yes, it would be absolutely perfect. – Juraj Fiala Jul 9 '14 at 19:29
@DoctorJellyface to shorten this you can create your own function and add it to the ~/.bashrc file. – TuKsn Jul 9 '14 at 21:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.