[ale] X window to foreground

Michael H. Warfield mhw at WittsEnd.com
Sat Dec 29 21:23:11 EST 2007


On Sat, 2007-12-29 at 05:01 -0500, Brian Pitts wrote:
> Jim Popovitch wrote:
> > One thing that bugs the fsck out of me is that Evolution can be launched
> > multiple times from a menu or panel icon.   This may seem trivial to
> > some ;-) but I wind up launching a second instance of Evo more times
> > than I care to. :-)   To that end....
> > 
> > I am looking for a cheap way to take the pid of a running process and
> > bring it to the foreground of the current display window.  Ideas?
> > 
> 
> ACTIVEWINDOWID=$(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}')
> 
> should get the active window
> 
> ACTIVEWINDOWPID=$(xprop -id $ACTIVEWINDOWID _NET_WM_PID | awk '{print $3}')
> 
> should get the pid associated with the window.
> 
> ACTIVEWINDOWCLASS=$(xprop -id $ACTIVEWINDOWID WM_CLASS | awk '{print $3}')
> 
> should get the name of the binary associated with the window.
> 
> I'm afraid this doesn't get you much closer to an answer. I don't know 
> how to programmatically change which window is active.

	Check out wmctrl:

	http://www.sweb.cz/tripie/utils/wmctrl/

	General purpose window manager Swiss Army Knife.

> The wmctrl program is a UNIX/Linux command line tool to interact with
> an EWMH/NetWM compatible X Window Manager. 
> 
> The tool provides command line access to almost all the features
> defined in the EWMH specification. It can be used, for example, to
> obtain information about the window manager, to get a detailed list of
> desktops and managed windows, to switch and resize desktops, to make
> windows full-screen, always-above or sticky, and to activate, close,
> move, resize, maximize and minimize them. 

	The list of supported window managers is pretty nice, including
sawfish, metacity, evolution (yeah!), even fluxbox and blackbox.

	You can manipulate windows and desktops to your hearts content.  Move
windows between desktops or move locations within desktops and
viewports.  Changed desktops and viewports.  Raise, lower, shade,
iconify, maximize, restore windows.

	Many of the features in wmctrl will exceed what your window manager
will do.  If it doesn't support multiple desktops, changing the number
of desktops won't do much.  Changing the desktop size to expanding it
for multiple viewports won't do much if it will only do desktops.  It
will even push enlightenment to the limit.

	It's available in Fedora right from the yum repositories.  I'm sure
other distros have it available as well.

> -Brian

	Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part




More information about the Ale mailing list