FVWM: Function to conditionally popup a window

From: stu <swl_at_ucs.co.za>
Date: Wed, 26 May 2004 14:24:19 +0200

Hi everyone

I have an app - multi-gnome-terminal - that can be started up in two
modes - 'factory' or 'client'. I want the first instance started of this
app to always be the 'factory', and all other instances to be the
'clients' ( doing it this way reduces memory usage ).

Unfortunately, this app is not intuitive enough to start a 'factory' if
one doesn't exist, and to connect to one if it does, with the same
command. Therefore I need to write a function to invoke this app that
checks if the 'factory' is running, and invokes it if it is not, and
invokes the 'client' if the factory is running ie

if (an instance of multi-gnome-terminal is running)
   # Start client
   Exec exec multi-gnome-terminal --use-factory
else
   # Start factory
   Exec exec multi-gnome-terminal --start-factory-server
fi

xwininfo gives the following :

xwininfo: Window id: 0x1e00011 "MGT - [ 1-Shell ]"

so, in an attempt to begin solving this, I created the following
function :

DestroyFunc FuncStartMGT
AddToFunc FuncStartMGT
+ I WindowId $0 ("MGT*") Exec exec multi-gnome-terminal --use-factory

I use the * above because the name of this window changes, but always
begins with MGT. This would hopefully start my 'client' if an instance
of multi-gnome-terminal was already started. Unfortunately this does not
work.

I also tried this line in the function above to start the 'factory' if
no instance of multi-gnome-terminal was running :

+ I WindowId $0 ("MGT") (!CurrentGlobalPageAnyDesk) Exec exec
multi-gnome-terminal --start-factory-server

This doesn't work either.

I'm considering using PipeRead to call a script that does a ps to check
for an instance of multi-gnome-terminal, and that returns the applicable
parameters, but I was wondering if there was a native fvwm solution to
replicate the pseudo-code 'if' statement above?

BTW I'm running fvwm 2.5.8.

Thanks
-- 
Stuart Logie
Programmer
UNIVERSAL COMPUTER SERVICES (PTY) LTD
   
Powered by Debian GNU/Linux - testing/unstable
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Wed May 26 2004 - 07:28:44 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST