On 19 Jan 2004 09:25:49 -0600, Shay Hill wrote:
>
> version 2.5.8
>
> I have written a working perl script to read colors from my .fvwm2rc
> file and build appropriately colored icons. The script *works* from the
> command line, but fails when called from .fvwm2rc. with
> FvwmPerl load create-icons.fpl
The correct syntax is:
FvwmPerl --load create-icons.fpl
But why do you need FvwmPerl at all here? It seems that your script does
not use any FvwmPerl features and does not send any fvwm commands back,
so you may just do:
Exec create-icons
Or if you need syncronization, then:
PipeRead create-icons
> Here is a minimal version of my perl script. There are some lines
> commented out. The script works, but is of course useless, without these
> lines. With these lines, the output file fails to open when called from
> .fvwm2rc.
>
> #!/usr/bin/perl
> open(FVWM, "/home/shay/.fvwm/.fvwm2rc");
> undef $/;
> $_ = <FVWM>;
> close FVWM;
> # /SetEnv FGColor "(.*[^"])"\n/g;
> # $FGC = $1;
> open(OUT, ">/home/shay/.fvwm/iconify.xpm");
> print OUT "\". c $FGC\",\n";
> close OUT;
>
> Any help appreciated. I have worked on this a lot and have become very
> frustrated.
Sorry, it is impossible to determine why your script fails. Maybe because
you don't use the correct FvwmPerl syntax (--load). Or maybe because the
files can't be open, or there is some perl error (but then FvwmPerl
should catch it and report on the X standard error file).
You may use some sane programming techniques to make programs more solid
and less buggy. For example, ask Perl to help you with such goal by
starting the script with:
#!/usr/bin/perl -w
use strict;
Never write:
open(...);
If you want to catch problems, write something like:
open(...) or die "Can't open file $fileName: $!\n";
Never write:
/..(..)../;
$color = $1;
$1 will contain random garbage if there is no match. Write something like:
if (/..(..)../) {
$color = $1;
}
or:
/..(..)../ and $color = $1;
or:
/..(..)../ || die "Expected string not found";
$color = $1;
There are several ways to preprocess XPM with symbolic colors to final
XPM. Which one is better depends on your goals and setup. You may just
call a shell/perl script when you start fvwm to create all final XPMs.
Or use one of these to do this:
ModuleSynchronous FvwmCpp -debug -lock -noread -outfile processed.xpm unprocessed.xpm
ModuleSynchronous FvwmPerl --preprocess --nosend --noremove unprocessed.xpm
(and not "FvwmPerl --load").
Another solution is to preprocess your whole configuration (and not just
icons) using "FvwmPerl -p .fvwm2rc.ppp" and create the needed icons in
the embeded perl of this .fvwm2rc.ppp file.
Finally, you may write your own fvwm module if you want so and listen to
colorset info from fvwm.
But if you don't want to do a lot of programming, then I think the
easiest solution for you is to prepare the final XPM sets statically and
just use one or another ImagePath depending on your color scheme:
ImagePath $[FVWM_USERDIR]/images/red-color-scheme:+
Then prepare ~/.fvwm/images/red-color-scheme/iconify.xpm and so on.
Regards,
Mikhael.
--
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 Mon Jan 19 2004 - 15:06:37 GMT