# Known bugs: # - you can't immediately reenter a directory you've just left (first click another one and then try again) # - some other random odness may occur... WindowTitle {Add to playlist} WindowSize 600 700 #WindowPosition 470 400 Colorset 1 Font "xft:Verdana:size=16" Init Begin #load the current playlist ChangeTitle 1 (GetOutput { mpc ls| tr '\n' '|' } 1 -1 ) End Widget 1 Property Flags NoReliefString Position 0 40 Size 300 620 Type List Title { } Main Case message of SingleClic : Begin Set $item = (GetValue 1) Set $clicks = (Add $clicks 1) If $olditem == $item Then Begin If $clicks==1 Then #change to the doubleclicked directory #figure out which directory was selected Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 1) # Do {Echo } $cmd Set $currdir=(GetOutput $cmd 1 -1) # Do {Echo } $currdir #change to that directory and list it's contents Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' | tr '\n' '|'} # Do {Echo } $cmd ChangeTitle 1 (GetOutput $cmd 1 -1) Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' 'files' | tr '\n' '|'} ChangeTitle 3 (GetOutput $cmd 1 -1) End Else Begin Set $olditem = $item Set $clicks=0 End End End Widget 3 Property Flags NoReliefString Position 300 40 Size 300 620 Type List Title { } Main Case message of SingleClic : Begin Set $item = (GetValue 3) Set $clicks = (Add $clicks 1) If $olditem == $item Then Begin If $clicks==1 Then #figure out which song was selected Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 3) # Do {Echo } $cmd Set $currfile=(GetOutput $cmd 1 -1) # Do {Echo } $currfile #add the song to the playlist Set $cmd={mpc add "} $currfile {" >/dev/null} # Do {Echo } $cmd Do {Exec } $cmd End Else Begin Set $olditem = $item Set $clicks=0 End End End Widget 4 Property Flags NoReliefString Position 0 0 Size 300 40 Type ItemDraw Title { Folders } Main Case message of SingleClic : Begin End End Widget 5 Property Flags NoReliefString Position 300 0 Size 300 40 Type ItemDraw Title { Songs } Main Case message of SingleClic : Begin End End Widget 6 Property Flags NoReliefString Position 0 660 Size 100 40 Type PushButton Title { Close } Main Case message of SingleClic : Begin Quit End End Widget 7 Property Flags NoReliefString Position 100 660 Size 95 40 Type ItemDraw Title { Dir: } Main Case message of SingleClic : Begin End End Widget 8 Property Flags NoReliefString Position 195 660 Size 85 40 Type PushButton Title { Up } Main Case message of SingleClic : Begin #return to the previous directory Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' ..} # Do {Echo } $cmd Set $currdir=(GetOutput $cmd 1 -1) # Do {Echo } $currdir #change to that directory and list it's contents Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' | tr '\n' '|'} # Do {Echo } $cmd ChangeTitle 1 (GetOutput $cmd 1 -1) Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' 'files' | tr '\n' '|'} ChangeTitle 3 (GetOutput $cmd 1 -1) End End Widget 9 Property Flags NoReliefString Position 280 660 Size 100 40 Type PushButton Title { Add dir } Main Case message of SingleClic : Begin #figure out which directory was selected Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 1) # Do {Echo } $cmd Set $seldir=(GetOutput $cmd 1 -1) # Do {Echo } $currfile Set $cmd={mpc add "} $seldir {" >/dev/null} # Do {Echo } $cmd Do {Exec } $cmd End End Widget 10 Property Flags NoReliefString Position 430 660 Size 85 40 Type ItemDraw Title { Song: } Main Case message of SingleClic : Begin End End Widget 11 Property Flags NoReliefString Position 515 660 Size 85 40 Type PushButton Title { Add } Main Case message of SingleClic : Begin #figure out which song was selected Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 3) # Do {Echo } $cmd Set $currfile=(GetOutput $cmd 1 -1) # Do {Echo } $currfile #add the song to the playlist Set $cmd={mpc add "} $currfile {" >/dev/null} # Do {Echo } $cmd Do {Exec } $cmd End End