[vox-tech] Setting foreground window from command line

Bryan Richter bryan.richter at gmail.com
Fri Nov 30 17:20:20 PST 2007


On Nov 30, 2007 2:54 PM, Chris Jenks <jenks at re...> wrote:
>
>    Hello,
>
>    I'm looking for a way to cause a specific window to move to the
> foreground when a shell script is run. My googling is returning very
> little signal to noise! I'm running pretty much stock Gutsy ubuntu. Any
> pointers?
>

First, it may help to know that while windows can ask to be moved to
the front, they are not guaranteed any benefaction on the part of the
window manager. So it might be impossible, unless you scripted the
window manager itself, and that's probably all sorts of annoying.
(Unless you're using a sweet window manager like Ion).

However, something that you may find useful are two Xterm resources:
popOnBell and bellIsUrgent. You can "man xterm" for details on them.
But basically your usage would be something like:

xterm -xrm "XTerm*popOnBell: true"
and/or -xrm "XTerm*bellIsUrgent: true"

and then in that xterm,

$ if its_time_to_run_the_script(); then
    # Ring the bell to ask to pop to front and set urgent flag
    echo -e "\a"
    run_the_script()
fi

If that works for you, there are other fun way to specify the
resources, rather than the command line, that you might find useful.

-Bryan


More information about the vox-tech mailing list