# Written by: Maciej Delmanowski <harnir@linux.net.pl>


# Variables:
SetEnv XMMS-Music-Collection "~/Music"
SetEnv XMMS-CDAudio "/cdrom"
SetEnv XMMS-Playlists "$[HOME]/.fvwm/xmms-playlists"
SetEnv XMMS-Playlist-Name "playlist-`date +%F_%H:%M`.m3u"
SetEnv Aumix-VolumeAmount-Button "10"
SetEnv Aumix-VolumeAmount-Wheel "2"



DestroyMenu /XMMS/Playlist
AddToMenu /XMMS/Playlist
+ DynamicPopupAction Function /XMMS/Playlist-generator

DestroyFunc /XMMS/Playlist-generator
AddToFunc /XMMS/Playlist-generator
+ I DestroyMenu recreate /XMMS/Playlist
+ I AddToMenu /XMMS/Playlist '$[fc-locale-Select_playlist]' Title
+ I PipeRead 'for i in $[XMMS-Playlists]/*.m3u $[XMMS-Playlists]/*.pls; do \
  name=$(basename "$i"); \
  sname=${name%%.m3u}; \
  sname=${sname%%.pls}; \
  echo \"AddToMenu /XMMS/Playlist \'$sname\' Exec exec xmms \'$i\'\"; done'
+ I AddToMenu /XMMS/Playlist "" Nop
+ I AddToMenu /XMMS/Playlist "CD Audio" Exec exec xmms $[XMMS-CDAudio]
+ I AddToMenu /XMMS/Playlist "$[XMMS-Music-Collection]" Exec exec xmms $[XMMS-Music-Collection]
+ I AddToMenu /XMMS/Playlist '$[fc-locale-Directory]' Module FvwmForm XMMS-Open


DestroyMenu /XMMS/Playlist-Add
AddToMenu /XMMS/Playlist-Add
+ DynamicPopupAction Function /XMMS/Playlist-Add-generator

DestroyFunc /XMMS/Playlist-Add-generator
AddToFunc /XMMS/Playlist-Add-generator
+ I DestroyMenu recreate /XMMS/Playlist-Add
+ I AddToMenu /XMMS/Playlist-Add '$[fc-locale-Add_to_playlist]' Title
+ I PipeRead 'for i in $[XMMS-Playlists]/*.m3u $[XMMS-Playlists]/*.pls; do \
  name=$(basename "$i"); \
  sname=${name%%.m3u}; \
  sname=${sname%%.pls}; \
  echo \"AddToMenu /XMMS/Playlist-Add \'$sname\' Exec exec xmms -e \'$i\'\"; done'

All (XMMS-Open) Close
DestroyModuleConfig XMMS-Open: *
*XMMS-Open: WarpPointer
*XMMS-Open: Title "$[fc-locale-Open_directory]"
*XMMS-Open: Text "$[fc-locale-Select_directory]"
*XMMS-Open: Line center
*XMMS-Open: Input SelectedDirectory 40 ""
*XMMS-Open: Line center
*XMMS-Open: Button quit " $[fc-locale-Cancel] " ^[
*XMMS-Open: Command Nop
*XMMS-Open: Button quit " OK " ^M
*XMMS-Open: Command Exec exec xmms $(Enqueue) $(SelectedDirectory)
*XMMS-Open: Selection Enqueue multiple
*XMMS-Open: Choice Enqueue -e on "$[fc-locale-Enqueue]"
*XMMS-Open: Line center


DestroyFunc XMMS-Playlist-Save
AddToFunc XMMS-Playlist-Save
+ I Exec exec mkdir -p $[XMMS-Playlists]
+ I Exec exec xmms-shell -e "save '$[XMMS-Playlists]/$[XMMS-Playlist-Name]'"


DestroyFunc XMMS-Song-Remove
AddToFunc XMMS-Song-Remove
+ I Exec exec xmms-shell -e "remove `xmms-shell -e currenttrack | sed -e 's/Current song: //' -e 's/\..*//'`"


DestroyFunc XMMS-Find
AddToFunc XMMS-Find
+ I Style XmmsFind* NoTitle
+ I Style XmmsFind* StaysOnTop
+ I Style XmmsFind* Sticky
+ I Style XmmsFind* StartNormal
+ I Exec pidof xmms && exec xmmsfind_remote
+ I TestRc (Match) Wait XmmsFind*
+ I All (XmmsFind*, CurrentPage) Focus

DestroyFunc Aumix
AddToFunc Aumix
+ I All (aumix) Close
+ I TestRc (False) None (aumix) A aumix

# Some menus...
DestroyMenu /XMMS
AddToMenu /XMMS
+ '$[fc-locale-Load_playlist]'		Popup /XMMS/Playlist
+ '$[fc-locale-Add_to_playlist]'	Popup /XMMS/Playlist-Add
+ '$[fc-locale-Save_current_playlist]'	XMMS-Playlist-Save
+ '$[fc-locale-Remove_current_song]'	XMMS-Song-Remove
+ "" Nop
+ '$[fc-locale-Stop_playing]'	Exec exec xmms --stop
+ '$[fc-locale-Close_player]'	Exec exec xmms-shell -e "xmmsquit"
+ '$[fc-locale-Toggle_shuffle]' Exec exec xmms-shell -e "shuffle toggle"
+ '$[fc-locale-Toggle_repeat]'	Exec exec xmms-shell -e "repeat toggle"
+ '$[fc-locale-Open_preferences]'	Exec exec xmms-shell -e "preferences"
+ '$[fc-locale-Toggle_window]'	All (XMMS_Player) Iconify toggle
+ '$[fc-locale-Play-Pause]'	Exec exec xmms --play-pause


