[SOLVED]ImagePath in Scripts?

I want to write a FvwmScript to manage mpc. (I know it’s already done, but I want do it by myself).

I use the following code:

# Heading
WindowTitle 	{soundPanel}
WindowSize	200 40
#Colorset	4

#Initalisation
Init
	Begin
		#ShowWidget 1;
		#ShowWidget 2;
		#ShowWidget 3;
		#ShowWidget 4;
		#ShowWidget 5;
		#ShowWidget 6;
	End

#Periodic Task
Periodic Task
	Begin
		ShowWidget 1;
	End

#Mainpart

Widget 1
Property
	Type		ItemDraw
	Size		32 32
	Position	0 0	
	Icon		$[fvwm_icons]/32x32/player_start.png
Main

	Case message of:
		SingleClic:
		Begin

		End
End
[...]	

I use 6 Widget, all the same syntax, only the image is an other. But I don’t see any image, just an light grey background. I’ve also tried to use the full pathname to the image, but this want work too.

Anybody an idea what’s wrong? Thanks in avad

Sorry for the late reply on this.

FvwmScript doesn’t know how to directly interpolate environment variables in this way. Your best bet is to place your icons in a location specified in your ImagePath, and then to do:

Icon some_icon_name.png

– Thomas Adam

No probleme, I was busy, too.

I’ve tried as you suggested, but I still see no Icons!
They are in my ImagePath. I use them in my rootmenu so I think the path is correct.

Have you any other idea?

Then your ImagePath must be wrong, it’s working fine here.

– Thomas Adam

My ImagePath is:


SetEnv fvwm_icons $[fvwm_home]/icons

ImagePath $[fvwm_icons]:$[fvwm_icons];.png:+

#in my menu

+ "%32x32_player_start.png%Start"	NOP

The icon is visible in the menu. But not in the script


[...]

Widget 1
Property
   Type
      ItemDraw
   Size      32 32
   Position   0 0   
   Icon     32x32_player_start.png
Main

   Case message of:
      SingleClic:
      Begin

      End
End

[...]

I never quite understood why people do this, and indeed I realise it probably doesn’t mean a thing to do, and why should it? There’s nothing wrong with those two lines above, right?

Well, there is. It’s wasted effort (see: edulinux.homeunix.org/fvwm/fvwmchanfaq.html#cf5).

Again, I’ll reiterate that it does work, providing said icon is in your ImagePath. Still, since there seems to be some discrepency here, let’s go through the motions, shall we?

  1. What version of FVWM are you running?
  2. Does anything log to $HOME/.xsession-errors when you load the said FvwmScript?

And again for the record, here’s an example that works for me:

WindowTitle    {soundPanel}
WindowSize   200 40

Init
   Begin
   End

Widget 1
Property
   Type      ItemDraw
   Size      32 32
   Position   0 0   
   Icon     Mosaic.xpm
Main

   Case message of:
      SingleClic:
      Begin
      End
End 

– Thomas Adam

if only the icon is different for each widget, isn’t there a problem with the positions? or are these different too?

I don’t know. You could of course test this yourself. In fact, that’s what I suggest you do.

– Thomas Adam

1.) I use fvwm 2.5.12
2.) There are 3 Errors, they belong to Style options:2x “Bad style option: !Border”. 1x somewhat with animate. (I will try to solve them today or tomorrow.) But there are no errors that belongs to the script or something I don’t know…

I use 32x32 Icons. The position of each widget, is the position of the previous widget plus 3 pixel space. First at 0 0, second at 35 0, and so on. (First I hat the different between the positions just 32 pix, but i thought that this could be the problem, so I changed it…)
I’m sorry that the explanation in my first post wasn’t clear.

I will try your example today evening, Thomas.
I see you use an xpm file. Is it possible that my FvwmScript doesn’t support png? Fvwm itself is compiled with png support. (And works fine.)

Thanks for this interesting site. I will cleanup my environment in the future.

It’s !Borders (pluralisation).

.pngs are fine.

Pleasure.

– Thomas Adam

HA!

It now works! What I’ve done:


Periodic Task
   Begin
      ShowWidget 1;
   End 

I’ve just removed this part of the script. Than it shows all Icons…don’t know why…
With an empty Periodic Task Part you will also don’t see any images.

Thanks for help!

Greetings
Arvodan

Well, for starters, that is invalid syntax. Semicolons don’t go on the end of lines. And it’s “PeriodicTasks”, not “Periodic Task”. And finally, is that really what you want to do? You want to show (re-show?) the widget every second?

No, that’s not what I want to do. It was just for testing. I wasn’t sure if I have to write an PeriodicTasks so I 've simply added one.

Wrong Syntax? That’s what “man FvwmScript” says:

PERIODIC TASKS
       This part of the script contains instructions that are  executed  every
       second.  For example:

            Periodic Task
             Begin
              If (RemainderOfDiv (GetTime) 10)==0 Then
               Do {Exec xcalc}
             End

But thanks for the hint! I didn’t ever noticed the semicolon…too much C and Java those days…

I don’t know what version of FVWM you are using but the latest manpages say:

Cheers

Bert

From the man page:

But that’s only for “information”, it doesn’t work if I write “Periodic Task”. So the manpage seem to be wrong in this case.

I’m now working on the main part of the script (I should say, I will work on it, if I have time, this weekend.).

That’s an old FVWM version, the error in the manpage was no doubt fixed recently. It’s always worth it to stay current on FVWM releases, if only for this sort of fixes.

Cheers

Bert