Hi all,
I want to make a mount button which shows an icon for each state.
I have taken the script from Bricem13’s tar.gz (see viewtopic.php?t=527) and modified it a little bit.
I can mount and unmount, but no icon will show. Only a grey 32x32 pixel field What’s wrong?
Here’s my code:
In my fvwmbutton module I create this:
*FvwmMount: (3x8+1+0, \
Action (Mouse 1) ToggleMount /floppy, \
Swallow (Respawn) "FvwmScript-Mount-Check" \
'Module FvwmScript $[fvwm_script]/FvwmScript-Mount-Check')
The field is on the correct position but no icon …
The script looks like this:[code]# Usage: Module FvwmScript path/to/FvwmScript-Mount-xxxxx
state=0: unmounted, =1: mounted
WindowTitle {FvwmScript-Mount-Check}
WindowSize 32 32
Init
Begin
Set $floppy_state_prev=-1
End
PeriodicTasks
Begin
Set $floppy_state=(GetOutput {grep -c floppy</etc/mtab} 1 -1)
#ChangeTitle 1 $state
If $floppy_state==$floppy_state_prev Then
Begin
# do nothing
End
Else
Begin
Set $floppy_state_prev=$floppy_state
Set $scale=(Add $state 4)
Set $icon=mount/$scale .png
#ChangeTitle 1 $icon
ChangeIcon 1 $icon
End
End
Widget 1
Property
Position 0 0
Size 32 32
Type ItemDraw
Flags NoReliefString Center
Main
Case message of
SingleClic :
Begin
End
End[/code]
What I don’t understand is where the script found the icon :?
I have create in my $[fvwm_img] path a mount folder with the needed icons (4.png and 5.png - both 32x32 pixel). Also the image directory is present in the ImagePath …
WithSet $icon=$[fvwm_img]/mount/$scale .png
it won’t work too …
Please help
Regards,
TF