-------- Original Message --------
Subject: RE: FVWM: Extracting an Environment Variable from FVWM
From: <msib...@crosswire.com>
Date: Fri, August 26, 2011 2:07 pm
To: "Thomas Adam" <tho...@fvwm.org>


<SNIP>

>
>> As I said before: I'd rather not have to wrap FvwmCommand. So if there
>> is a programatic way of getting access to FVWM's environment variables
>> without spending a week doing it, I'm all ears.
>
>At the moment there isn't -- and all FvwmCommand is doing is relaying your
>commands via its own FIFO to FVWM.
>
>
>-- Thomas Adam
>

Ok, 

Heres the wrapper if anybody is interested. It seems to work. 

Thanks in advance!
Matt
 

#####################################################################
#! /usr/bin/perl -w 

# fvwm-getenv, a handy dandy tool for extracting environment variables 
# from fvwm. 

use strict ; 

my $ev = shift @ARGV ; 
chomp $ev ; 
die ("usage: fvwm-getenv <environmentvariable> ") unless $ev =~ /\w+/ ; 

# MAKE A FIFO
my $mkfifo = '/usr/bin/mkfifo -m 700' ; # the mkfifo command 
my $tmppath = $ENV{'HOME'} . '/.fvwm/tmp' ; # you will need to create
this directory
my $rn = sprintf("%0.10d",rand(1000000000)) ; # a random number
my $fifofn = $tmppath . '/' . $rn . '.fifo' ; # becomes a filename
system("$mkfifo $fifofn") ; # and we create a temporary fifo

# FVWM PASSTHROUGH COMMAND
my $fvwmcommand = 'FvwmCommand ' . "'" . "Test \(EnvIsSet $ev\) Exec
echo \$[$ev] >> $fifofn" . "'" ; 

my $childpid ; # know thyself

if ($childpid = fork) { # Parent
 open (FIFOFN, $fifofn) ; # 
 my $line = readline(FIFOFN) ; # catch the input
 print $line ; # print it
 close(FIFOFN) ; 
 unlink $fifofn ; # delete the tmp file
 exit ;
} else { # Child
 system($fvwmcommand) ; # create the output
 exit ; 
}
##########################################################


Reply via email to