solved - mount script won't show icon

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 :frowning: 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 .pngit won’t work too …

Please help :exclamation: :exclamation:

Regards,

TF

Hi,

after many tests,reading FVWMScript manpage and other scripts I have found the problem:

two things I’ve made wrong - first I haven’t changed the name ofSet $scale=(Add $state 4)intoSet $scale=(Add $floppy_state 4)
Second there must be blanks in the icon pathSet $icon=mount/<blank>$scale<blank>.png
That’s it. Now the icon appears and will change if the mount state will change too.

Best Regards,

TF

what is the key to have a script really swallowed and not displayed in its own window???
thanks in advance

You could swallow it in an FvwmButtons instance, if you mean that. Or do you mean you want to use it like some kind of gdesklet like thingy? Then you probably use a style line to make it stay on bottom and remove all decorations.

Style MyFvwmScript Sticky, StaysOnBottom, !Borders

Or something like that, it’s off the top of my head so I probably forgot some important ones, but you get the idea :slight_smile: