[SOLVED] FvwmScript and Icon

Hi,

I’m trying to make a FvwmScript, but I’m facing a weird problem with the icon lookup.

For example I try to make a gadget which displays a shutdown button :

[code]Widget 10
Property
Type PushButton
Size 45 45
Position 250 236

Title {Shutdown}

Flags NoReliefString Center
Icon /home/user/.fvwm/fvwmrc/scripts/system.rsc/shutdown.png
Main
Case message of
SingleClic :
Begin
Do {FvwmScript $[fvwm_fvwmscripts]/confirmBox.src “Shutdown” “sudo poweroff”}
Quit
End
End[/code]

With “Icon”, it only works when I type the full path. With a variable in the path, like $[fvwm_scripts]/system.rsc, or when using a ‘~’ instead of “/home/user”, it doesn’t work. Actually if there is a “$” in the path, the next widgets are not displayed. So how can I specifie a path without using a absolute one ?

Thanks

Nobody has an idea ?

I am no expert on FvwmScript. But in general, fvwm looks for icons in the ImagePath. So does your shutdown.png exist within the ImagePath? What is your ImagePath set to plz?

That’s a very good question. How can I define an ImagePath in FVWM ?

An ImagePath command typically appears in your config, and specifies a list of folders in which fvwm should look for images, icons etc. Such that when you specify images in your module configs and menus etc, a full path isn’t needed - FVWM is smart enough to look in those folders instead. But the ImagePath command has its own special syntax, which you should read about in the manpage.

First looking at your FvwmScript, we see Icon /home/user/.fvwm/fvwmrc/scripts/system.rsc/shutdown.png If we imagine that shutdown.png is stored instead in ~/.fvwm/images/icons, a folder that is dedicated to storing images, then your ImagePath commands might be…ImagePath $[FVWM_USERDIR]/images ImagePath +:$[FVWM_USERDIR]/images/icons ImagePath +:/usr/share/pixmapsSo that puts just three folders into your ImagePath. Now, replace the “Icon” line in your FvwmScript with

Icon shutdown.png

and then see if it all works as it should.

Please note than whenever you add new images/icons to those ImagePath folders, those ImagePath commands need to be run again.

Nice ! Very usefull, thank you for your help !