[vox-tech] Setting foreground window from command line

Chris Jenks jenks at resonance.org
Fri Nov 30 17:56:17 PST 2007


On Fri, 30 Nov 2007, Bryan Richter wrote:

> 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

   Dear Bryan,

   It looks like this might be harder than I thought. The application I had 
in mind is something like this: use the motion package to look for changes 
in a video stream from a camera; when it sees some, it launches a script 
that moves a video display window to the foreground. The alert method you 
gave may be the best I can do, but it isn't ideal because other 
applications also ring the bell.

   Yours,

     Chris


More information about the vox-tech mailing list