[mythtv-users] [mythtv] Minimizing and restoring an external application by pressing a mythtv menu button?

Michael T. Dean mtdean at thirdcontact.com
Fri Jun 1 15:42:09 UTC 2007


On 06/01/2007 10:28 AM, Joseph Caputo wrote:
> On 6/1/07, Michael T. Dean <mtdean at thirdcontact.com> wrote:
>   
>> On 06/01/2007 03:54 AM, florin baiduc wrote:
>>     
>>> I plan to launch an external application from a MythTV menu (in the
>>> background by using exec &). This starts then minimized Has anyone
>>> have any clue on how can one restore this already running application
>>> by pressing the same MythTV button? I presume there should be some
>>> call to the windowmanager, but my search returned no good results
>>> (still looking around). This would be really useful for example for
>>> skype and other "always on" applications..
>>>       
>> Please ask on the -users list.  When you do, you should specify which WM
>> you're using, too, as it's purely a WM issue (not a Myth thing).
>>     
> [Transferred thread from -dev list]
>
> It depends on what the application is... some applications have either
> command-line based remote control, or a simple network control
> protocol.  Probably the most universal solution would be to find the
> window ID of the window you want to restore and send it an X protocol
> message to re-map/un-iconify itself.  That *should* be window-manager
> independent, since it works at the Xlib level, though I suppose a
> window manager could choose to be obnoxious about it

Or a user (i.e. me) may set his WM to completely ignore those
requests... :)  There's nothing I hate more than an obnoxious app's
popping up and grabbing the keyboard just as I'm starting to type my
password into a shell, and--because I've finished typing my password and
hit Enter before the window is drawn/before I realize that some window
on the other side of the screen grabbed focus--sends that password off
into the 'net.  (I'd bet if DNS server admins were to check their
requests carefully they'd see a /lot/ of passwords being checked as
hostnames thanks to, i.e. most browsers' auto-search capabilities.  And,
now, with browsers like Mozilla/Firefox/IE just submitting a search to
Google/MSN/whatever, I have to wonder how many passwords Larry and
Sergey are sitting on...)  You wouldn't believe how often I used to have
to change my password because of this.

>  (obviously this
> solution wouldn't work if you're using Qt/Embedded & no X11).  We use
> this mechanism in the software that we develop at work, and it is also
> basically how the Mozilla/Netscape/Firefox remote control works.  The
> trickiest part might be finding the window ID; Mozilla works by
> setting a custom X window property that the remote control app can
> look for (making it slow over a slow X connection, since it has to
> query the X server for all of its windows, but ).  You might have to
> look for something else, like a window title, widget or class name.  I
> think there may be some example code on the Mozilla site; if not, just
> Google "X protocol iconify".

But, the general idea is that the user will have to use some script (or
app) that checks to see if the app is currently running and if so
submits the proper request/command/whatever to restore that app or if
not, starts the app.  This is especially true for things like Skype's
proprietary binary-only POS (piece of software, of course) that can't be
modified by the user.  This is the only way that the same button (=same
command) can work to both start an app when it's not running and restore
an app's window when it is.  This idea could be extended to LIRC
buttons, too.

Mike


More information about the mythtv-users mailing list