FvwmScript Update

I have an FvwmScript that displays a speaker icon and next to that the volume level. Right know i have it set up so that every 5 seconds it runs a script and dsplays the correct volume. I was wondering if there was a way to send a command to the script adn have it update that way. Like i have F2-4 to increase, decrease and mute the volume. I would like to beable to have the FvwmScript update only when i press a volume button. I cant think of any other way of doing this other than writing a new module, which i just might do. Any suggestions before i start working on write a module?

VoiDeR

I often cheat for things like this, and use FvwmButtons to display the icon, making use of FvwmButtons “id” option. That way, I then just define whatever mouse actions happen on mouse click to invoke/toggle, etc, an FvwmScript. There’s an example in the FvwmButtons manpage, IIRC. Essentially, you just use:

SendToModule <myModuleAlias> ChangeButton id "foo" .....

HTH,

– Thomas Adam

I read the man pages for FvwmButtons and FvwmScripts and i just dont understand what how what you mean by

SendToModule <myModuleAlias> ChangeButton id "foo" .....

Ill post my FvwmScript and maybe you can help me.

[code]WindowTitle {Volume}
WindowSize 35 26
Colorset 9

Init
Begin
Set $vol_icon = (GetOutput {exec /home/voider/.fvwm/scripts/volume.sh} 1 1)
Set $vol = (GetOutput {exec echo “aumix -wq | sed -e 's/.*, //'%”} 1 -1)
ChangeIcon 1 $vol_icon
ChangeTitle 2 $vol
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2)==0 Then
Begin
Set $vol_icon = (GetOutput {exec /home/voider/.fvwm/scripts/volume.sh} 1 1)
Set $vol = (GetOutput {exec echo “aumix -wq | sed -e 's/.*, //'%”} 1 1)
ChangeIcon 1 $vol_icon
ChangeTitle 2 $vol
End
End
Widget 1
Property
Size 18 26
Position 0 0
Colorset 12
Type ItemDraw
Flags NoReliefString
End

Widget 2
Property
Size 17 26
Position 18 0
Colorset 12
Type ItemDraw
Flags NoReliefString
End
[/code]

Volume icon script

pcm=`aumix -wq | sed -e 's/.*, //'` if [ $pcm -gt 0 ] then echo "/home/voider/.fvwm/icons/bar/volume.png" else echo "/home/voider/.fvwm/icons/bar/mute.png" fi

The relavent part of my FvwmButtons

*Topbar: (35x26+510+0, Swallow "Volume" `Module FvwmScript $[scripts]FvwmScript-Volume`)

I cant figure out how to have the volume part update only when i push F2-4.

Ok, I see what you mean now. You can still use “SendToModule” with FvwmScript – have you read the section under “COMMANDS” in ‘man fvwmscript?’ You’d have to abstract it, but you could (at a push) have two dummy widgets on your form that are sent a command via “SendToModule” which would then update things?

– Thomas Adam