Discussion:
FVWM: FvwmScript and environment variables
Dominique Michel
2013-05-03 12:39:23 UTC
Permalink
Hi,

I am writing a font selector for fvwm-crystal with FvwmScript.
Most of it work, but I didn't succeeded to use environment variables.

In the config:
SetEnv panel_font "Bitstream Cyberbit"

In the script:
Set $SelectorFont = {"xft:$[panel_font]:size=16"}

but it doesn't work. I try everything I could think about, but nothing
worked.

Also thing like
Set $PanelFont = (GetOutput {echo $[panel_font]} 1 -1)

didn't work. This is with the last fvwm cvs.

I will change those variables to infostore, but I am waiting the next
fvwm release for that. (which will have EnvMatch that work with the
infostore)

Dominique
--
"We have the heroes we deserve."
Dan Espen
2013-05-04 19:49:42 UTC
Permalink
Post by Dominique Michel
Hi,
I am writing a font selector for fvwm-crystal with FvwmScript.
Most of it work, but I didn't succeeded to use environment variables.
SetEnv panel_font "Bitstream Cyberbit"
Set $SelectorFont = {"xft:$[panel_font]:size=16"}
but it doesn't work. I try everything I could think about, but nothing
worked.
Also thing like
Set $PanelFont = (GetOutput {echo $[panel_font]} 1 -1)
didn't work. This is with the last fvwm cvs.
I will change those variables to infostore, but I am waiting the next
fvwm release for that. (which will have EnvMatch that work with the
infostore)
Sorry, I really don't know much about FvwmScript, but a quick read
of the man page doesn't say anything about environment variables or
infostore.

Do you know if this is supposed to work?

Hmm, just checked:

grep -nH -e getenv *
FvwmScript.c:225: sprintf(path,"%s/%s",getenv("FVWM_USERDIR"),filename);
Instructions.c:73: home_dir = getenv("HOME");
Instructions.c:85: FvwmUserDir = getenv("FVWM_USERDIR");
Instructions.c:1719: home = getenv("HOME");

Doesn't look like there's any support.

A patch would be considered.
--
Dan Espen
Jaimos Skriletz
2013-05-04 20:41:35 UTC
Permalink
Post by Dominique Michel
Hi,
I am writing a font selector for fvwm-crystal with FvwmScript.
Most of it work, but I didn't succeeded to use environment variables.
Also thing like
Set $PanelFont = (GetOutput {echo $[panel_font]} 1 -1)
I belive you could do something hackish like this if you don't want to patch for actual support. But you need to be a little more creative.

First I belive GetOutput is excuting a shell command, so you may just need (GetOutput {echo $PANEL_FONT} 1 -1)

this should work for the enviorment variables but not infostore (I'm hoping a new shell isn't spawned with a new enviorment). If this doesn't work my next thought is

Use FvwmCommand with Echo (from fvwm) which can echo a string to your stderr ($HOME/.xsession-errors is common for this). Then parse the value from $HOME/.xsession-errors with grep/regex tools. This should work with either EnvVars or InfoStore since you can echo their values as well. The only issue I see with this portability as not everyone may have stderr of their Xserver redirected to $HOME/.xsession-errors

jaimos

Loading...