Script that reads resolution on startup??

I use FvwmButtons. But since you have to manually code which width you resolution are using with the ‘geometry’ option it does not look good if I change resolution (it is also necessary to make the sum of the buttons pixels fit for each resolution ).

Therefore I have made 3 different versions of the .fvwm2rc file for the following 3 resolutions:

1280x1024
1400x1050
1600x1200

When I start fvwm I would like to have a script that checks which resolution that I am using and the load the correct .fvwm2rc file.

Is that possible or is there some other way around making FvwmButtons look correct for different resolutions?

Read this:

edulinux.homeunix.org/fvwm/fvwmchanfaq.html#cf3

Again, the channel FAQ I have written is pretty comprehensive [1].

– Thomas Adam

[1] Not that I like blowing my own trumpet, but it’s true. :P

How do you store the result in $[vp.width] and $[vp.height]?

From a shell I can make this command:

mos@ubuntu:~$ xdpyinfo | grep dimensions
dimensions: 1400x1050 pixels (474x356 millimeters)
mos@ubuntu:~$

then I would like to just type (in my .fvwm2rc file):

PipeRead ‘echo SetEnv width $(($[vp.width]))’

and then use this new variable:

*FvwmButtons: Geometry $[width]x25+0-0

but I cannot seem to get ‘1400’ stored in $[vp.width]

You don’t. FVWM defines this for you,

No – and why would you want to do this? The syntax above denotes some form of arithmetic operation performed on $[vp.width] – I suspect you meant:

SentEnv width $[vp.width]

Although that raises two points:

  1. Why would you want to store the already stored number defined in $[vp.width] in a separate variable (given that it’s unlikely to change). and then:

  2. Given your example above, what makes you think you need to use PipeRead?

If you’re going to be using that, then use $[vp.width] directly. Again, please re-read that FAQ entry. You have not demonstrated any form of arithemtic manipuation that warrants the use of $[width]. Note that depending on the order of precedence, you might need to double expand $[vp.width] as in:

$$[vp.width]

I can’t say for sure, since all of your code fragments are out of context, but it’s unlikely in this case.

– Thomas Adam.

Ok I have now done:

SetEnv width $[vp.width]
SetEnv iconman $(($[width] - 573))

width in this case it 1400. 573 is the total number of pixels for all my buttons excluding the swallowing of the IconMan. This should leave 827 pixels for the IconMan when I use 1400x1050 as resolution.

In FvwmButtons I then do:

*FvwmDock: Geometry $[width]x25+0-0
...
...
...
*FvwmDock: ($[iconman]x5  Swallow FvwmIconMan)
...
...

Setting the ‘Geometry’ with ‘$[width]’ works fine. But using ‘$[iconman]’ when swallowing FvwmIconMan gives a messy result.

why does $[iconman] not equal 827?

Is there someway to print the output of my variables in a shell?

You need to use PipeRead:

PipeRead `echo SetEnv iconman $(($[width] - 573))`

Read this:

edulinux.homeunix.org/~n6tadam/f … fhobia.txt

Use the “Echo” command in FVWM – that gets logged to ~/.xsession-errors, or you can do:

Exec exec xmessage "myvar: $[FVWM_VAR]"

– Thomas Adam

Thank you!

Like Thomas already said, you don’t need to do that, since

*FvwmDock: Geometry $[vp.width]x25+0-0

is exactly the same thing. You’re just making another variable holding the same thing. This is a good thing to realize, and to see the rest of the fvwm variables, search the fvwm manual page for “COMMAND EXPANSION”. (‘man fvwm’, ‘/COMMAND EXPANSION’)