# FvwmScript-Volume
# This script is used to show a button on the FvwmButtons panel with changing
# image reflecting the amount of volume on the 'Master' channel. You need to
# have aumix installed for this script to work.
#
# Usage: Module FvwmScript path/to/FvwmScript-Volume <images>
#
# <images> - how many images do you use to display volume
#
# LiNiO <linio@wonder.pl> - 2005.01.16
#

WindowTitle {FvwmScript-Volume}
WindowSize 48 24
Colorset 1

Init
 Begin
	Set $volume_prev=-1
	Set $images = (GetScriptArgument 1)
 End

PeriodicTasks
  Begin 
    Set $volume=(GetOutput {aumix -vq} 1 2)
    Set $temp=(StrCopy $volume 1 3)

    If $volume>99 Then
      Set $volume=(StrCopy $volume 1 3)
    Else
    Begin
      If $volume>=10 Then
        Set $volume=(StrCopy $volume 1 2)
      Else
        Set $volume=(StrCopy $volume 1 1)
    End
	  
    #ChangeTitle 1 $volume

    If $volume==$volume_prev Then
    Begin
      #	do nothing
    End	
    Else
    Begin
      Set $volume_prev=$volume
      Set $scale=(Mult $volume $images)
      Set $scale=(Div $scale 100)
      Set $icon= volume/ $scale .png
      #ChangeTitle 1 $icon
      ChangeIcon 1 $icon
    End
  End

Widget 1
Property
 Position 0 0
 Size 48 24
 Type ItemDraw
 Flags NoReliefString Center
Main
 Case message of
  SingleClic :
  Begin
  End
End
