[RndTbl] bringing background app to front

Scott Balneaves sbalneav at legalaid.mb.ca
Thu Mar 15 13:17:07 CDT 2007

On Thu, Mar 15, 2007 at 11:58:05AM -0500, Mike Pfaiffer wrote:
> Montana Quiring wrote:
> >A friend of mine asked the question:
> >"Is there a commandline utility that can bring a running application
> >such as xmms to the foreground?"
> >I wonder if it might be WM specific.
> 	I think there was one. Maybe you could look at the fg and bg 
> 	commands. It's been a while since I've done it (around 15 years in fact). I 
> wasn't able to find a man page for it in Ubuntu so I wonder how accurate my 
> memory is.

fg and bg are for forgrounding and backgrounding jobs in the shell.

I think what you're looking for is wmctrl:

Description: control an EWMH/NetWM compatible X Window Manager
 Wmctrl is a command line tool to interact with an EWMH/NetWM compatible X
 Window Manager (examples include Enlightenment, icewm, kwin, metacity,
 and sawfish). 
 Wmctrl provides command line access to almost all the features defined in the
 EWMH specification. For example it can maximize windows, make them sticky, set
 them to be always on top. It can switch and resize desktops and perform many
 other useful operations.

For instance, on my currently running desktop:

oin$ wmctrl -l
0x00c00003 -1 oin Top Panel
0x00c0002d -1 oin Bottom Panel
0x00e00021 -1 oin Desktop
0x0280001f  0 oin root at gto: ~
0x02800f75  1 oin root at lemans: ~
0x02802735  2 oin Terminal
0x02600023  3 oin Holly Cole - I Will Wait for You
0x02a00020  2 oin linux icccm raise command - Google Search
0x028048a9  0 oin root at oin: ~

To switch my current screen to RhythmBox, and raise it to foreground:

oin$ wmctrl -a "Holly Cole - I Will Wait for You"

Hope this helps.


Scott L. Balneaves | "Eternity is a very long time,
Systems Department |  especially towards the end."
Legal Aid Manitoba |    -- Woody Allen

More information about the Roundtable mailing list