I am a nob with fvwm and I have done my own music player menu based on the ones in fvwm crystal. It work almost very well. but sometime the submenus are in the right order, other time the submenu order is wrong.
As exemple, I get the start options with the Seek menu and the seek options with the start options. The order in the main menu is always the same, it is just at the submenu are shifting.
Here is what I wrote:
Music-alsaplayer
[code]# Support for Alsaplayer music player
Where are stored Alsaplayer playlists
SetEnv Alsaplayer-Playlists “$[HOME]/Alsaplayer-playlists”
If there is no selected mixer, load the default
CheckPreferences DefaultMixer “Include components/functions/Mixer-alsaplayer”
Main functions and menus
DestroyMenu /Music
AddToMenu /Music
- DynamicPopupAction Function /Music-generator
DestroyFunc /Music-generator
AddToFunc /Music-generator
- I DestroyMenu recreate /Music
- I AddToMenu /Music ‘$[gt.Start player]’ Popup /Start
- I AddToMenu /Music “” Nop
- I AddToMenu /Music ‘$[gt.Load playlist]’ Popup /Music/LoadPlaylist
- I AddToMenu /Music ‘$[gt.Clear playlist]’ Music-ClearPlaylist
- I AddToMenu /Music ‘$[gt.Remove playlist]’ Popup /Music/RemovePlaylist
- I AddToMenu /Music “” Nop
Test (EnvMatch LANG fr_) + I AddToMenu /Music ‘$[gt.Volume]’ Popup /VolumeFr
Test (!EnvMatch LANG fr_) + I AddToMenu /Music ‘$[gt.Volume]’ Popup /VolumeEn
Test (EnvMatch LANG fr_) + I AddToMenu /Music ‘$[gt.Speed]’ Popup /SpeedFr
Test (!EnvMatch LANG fr_) + I AddToMenu /Music ‘$[gt.Speed]’ Popup /SpeedEn - I AddToMenu /Music “” Nop
- I AddToMenu /Music ‘$[gt.Show/hide player]’ Music-GUI
- I AddToMenu /Music ‘$[gt.Stop playback]’ Music-Stop
- I AddToMenu /Music ‘$[gt.Play]’ Music-Play
- I AddToMenu /Music ‘$[gt.Pause]’ Music-Pause
- I AddToMenu /Music ‘$[gt.Play/Pause]’ Music-PlayPause
- I AddToMenu /Music “” Nop
- I AddToMenu /Music ‘$[gt.Next]’ Music-Next
- I AddToMenu /Music ‘$[gt.Prev]’ Music-Prev
- I AddToMenu /Music ‘$[gt.Jump]’ Popup /Jump
- I AddToMenu /Music ‘$[gt.Seek]’ Popup /Seek
- I AddToMenu /Music ‘$[gt.Seek relative]’ Popup /Rel
---------------------------------------------------------------------------
Basic control functions
DestroyFunc Music-GUI
AddToFunc Music-GUI
- I All (alsaplayer) Iconify toggle
DestroyFunc Music-Stop
AddToFunc Music-Stop
- I Exec exec $[A_Player] --stop
DestroyFunc Music-Play
AddToFunc Music-Play
- I Exec exec $[A_Player] --start
DestroyFunc Music-Pause
AddToFunc Music-Pause
- I Exec exec $[A_Player] --speed 0
DestroyFunc Music-PlayPause
AddToFunc Music-PlayPause
- I Exec exec $[A_Player] --speed 1
DestroyFunc Music-Next
AddToFunc Music-Next
- I Exec exec $[A_Player] --next
DestroyFunc Music-Prev
AddToFunc Music-Prev
- I Exec exec $[A_Player] --prev
---------------------------------------------------------------------------
Playlist functions
DestroyMenu /Music/LoadPlaylist
AddToMenu /Music/LoadPlaylist
- DynamicPopupAction Function /Music/LoadPlaylist-generator
DestroyFunc /Music/LoadPlaylist-generator
AddToFunc /Music/LoadPlaylist-generator
- I DestroyMenu recreate /Music/LoadPlaylist
- I AddToMenu /Music/LoadPlaylist
- I PipeRead ‘for i in $[Alsaplayer-Playlists]/.m3u $[Alsaplayer-Playlists]/.pls; do
name=$(basename “$i”);
sname=${name%%.m3u};
sname=${sname%%.pls};
echo “AddToMenu /Music/LoadPlaylist ‘$sname’ Exec exec alsaplayer -e ‘$i’”; done’
DestroyFunc Music-ClearPlaylist
AddToFunc Music-ClearPlaylist
- I Exec exec $[A_Player] --clear
DestroyMenu /Music/RemovePlaylist
AddToMenu /Music/RemovePlaylist
- DynamicPopupAction Function /Music/RemovePlaylist-generator
DestroyFunc /Music/RemovePlaylist-generator
AddToFunc /Music/RemovePlaylist-generator
- I DestroyMenu recreate /Music/RemovePlaylist
- I AddToMenu /Music/RemovePlaylist
- I PipeRead ‘for i in $[Alsaplayer-Playlists]/.m3u $[Alsaplayer-Playlists]/.pls; do
name=$(basename “$i”);
sname=${name%%.m3u};
sname=${sname%%.pls};
echo “AddToMenu /Music/RemovePlaylist ‘$sname’ Exec rm -f ‘$i’”; done’
[/code]
Mixer-alsaplayer
[code]# Support for Alsaplayer music player - mixer and speed control
DestroyFunc Mixer-Start
AddToFunc Mixer-Start
- I SetEnv A_Player “$0”
- I Exec exec killall alsaplayer
- I Exec exec $[A_Player]
DestroyFunc Mixer-VolumeFr
AddToFunc Mixer-VolumeFr
- I Exec exec $[A_Player] --volume $0
DestroyFunc Mixer-VolumeEn
AddToFunc Mixer-VolumeEn
- I Exec exec $[A_Player] --volume $0
#DestroyFunc Mixer-GUI
#AddToFunc Mixer-GUI
#+ I Nop
DestroyFunc Mixer-SpeedFr
AddToFunc Mixer-SpeedFr
- I Exec exec $[A_Player] --speed $0
DestroyFunc Mixer-SpeedEn
AddToFunc Mixer-SpeedEn
- I Exec exec $[A_Player] --speed $0
DestroyFunc Mixer-Jump
AddToFunc Mixer-Jump
- I Exec exec $[A_Player] --jump $0
DestroyFunc Mixer-Seek
AddToFunc Mixer-Seek
- I Exec exec $[A_Player] --seek $0
DestroyFunc Mixer-Rel
AddToFunc Mixer-Rel
- I Exec exec $[A_Player] --relative $0
DestroyMenu /Start
AddToMenu /Start
- “Alsa%” Mixer-Start “alsaplayer -o alsa”
- “Jack%” Mixer-Start “alsaplayer -o jack -F 48000”
DestroyMenu /VolumeFr
AddToMenu /VolumeFr
- " 0 db%" Mixer-VolumeFr ‘1,0’
- “-3 db%” Mixer-VolumeFr ‘0,707’
- “-6 db%” Mixer-VolumeFr ‘0,5’
- “-12 dB%” Mixer-VolumeFr ‘0,25’
- “-18 db%” Mixer-VolumeFr ‘0,125’
- “-24 db%” Mixer-VolumeFr ‘0,0625’
- “-30 db%” Mixer-VolumeFr ‘0,03125’
- “-36 db%” Mixer-VolumeFr ‘0,015625’
- " 0" Mixer-VolumeFr ‘0,0’
DestroyMenu /VolumeEn
AddToMenu /VolumeEn
- " 0 db%" Mixer-VolumeEn ‘1.0’
- “-3 db%” Mixer-VolumeEn ‘0.707’
- “-6 db%” Mixer-VolumeEn ‘0.5’
- “-12 dB%” Mixer-VolumeEn ‘0.25’
- “-18 db%” Mixer-VolumeEn ‘0.125’
- “-24 db%” Mixer-VolumeEn ‘0.0625’
- “-30 db%” Mixer-VolumeEn ‘0.03125’
- “-36 db%” Mixer-VolumeEn ‘0.015625’
- " 0" Mixer-VolumeEn ‘0.0’
DestroyMenu /SpeedFr
AddToMenu /SpeedFr
- “Max%” Mixer-SpeedFr ‘10’
- “+ 3 octaves%” Mixer-SpeedFr ‘8’
- “+ 2 octaves%” Mixer-SpeedFr ‘4’
- “+ 1 octave 1/2%” Mixer-SpeedFr ‘2,9966’
- “+ 1 octave%” Mixer-SpeedFr ‘2’
- “+ 1 septieme%” Mixer-SpeedFr ‘1,8877’
- “+ 5 tons%” Mixer-SpeedFr ‘1,7818’
- “+ 1 sixte%” Mixer-SpeedFr ‘1,6818’
- “+ 4 tons%” Mixer-SpeedFr ‘1,5874’
- “+ 1 quinte%” Mixer-SpeedFr ‘1,4983’
- “+ 3 tons%” Mixer-SpeedFr ‘1,4142’
- “+ 1 quarte%” Mixer-SpeedFr ‘1,3348’
- “+ 1 tierce%” Mixer-SpeedFr ‘1,2599’
- “+ 1 ton 1/2%” Mixer-SpeedFr ‘1,1892’
- “+ 1 seconde%” Mixer-SpeedFr ‘1,1225’
- “+ 1/2 ton%” Mixer-SpeedFr ‘1,0595’
- “+ 3 commas%” Mixer-SpeedFr ‘1,0414’
- “+ 2 commas%” Mixer-SpeedFr ‘1,0275’
- “+ 1 comma%” Mixer-SpeedFr ‘1,0136’
- “Normal%” Mixer-SpeedFr ‘1,0’
- “-1 comma%” Mixer-SpeedFr ‘0,9865’
- “-2 commas%” Mixer-SpeedFr ‘0,9733’
- “-3 commas%” Mixer-SpeedFr ‘0,9602’
- “-1 1/2 ton%” Mixer-SpeedFr ‘0,9439’
- “-1 seconde%” Mixer-SpeedFr ‘0,8909’
- “-1 ton 1/2%” Mixer-SpeedFr ‘0,8409’
- “-1 tierce%” Mixer-SpeedFr ‘0,7937’
- “-1 quarte%” Mixer-SpeedFr ‘0,7492’
- “-3 tons %” Mixer-SpeedFr ‘0,7071’
- “-1 quinte%” Mixer-SpeedFr ‘0,6674’
- “-4 tons%” Mixer-SpeedFr ‘0,623’
- “-1 sixte%” Mixer-SpeedFr ‘0,5946’
- “-5 tons%” Mixer-SpeedFr ‘0,561’
- “-1 septieme%” Mixer-SpeedFr ‘0,5297’
- “-1 octave%” Mixer-SpeedFr ‘0,5’
- “-1 octave 1/2%” Mixer-SpeedFr ‘0,3337’
- “-2 octaves%” Mixer-SpeedFr ‘0,25’
- “-3 octaves%” Mixer-SpeedFr ‘0,125’
- “-4 octaves%” Mixer-SpeedFr ‘0,0625’
- “Pause%” Mixer-SpeedFr ‘0’
- “-4 octaves back%” Mixer-SpeedFr ‘-0,0625’
- “-3 octave back%” Mixer-SpeedFr ‘-0,125’
- “-2 octaves back%” Mixer-SpeedFr ‘-0,25’
- “-1 octave 1/2 back%” Mixer-SpeedFr ‘-0,3337’
- “-1 octave back%” Mixer-SpeedFr ‘-0,5’
- “-1 quinte back%” Mixer-SpeedFr ‘-0,6674’
- “-1 tierce back%” Mixer-SpeedFr ‘-0,7937’
- “-1 seconde back%” Mixer-SpeedFr ‘-0,8909’
- “-1 1/2 ton% back” Mixer-SpeedFr ‘-0,9439’
- “Normal backward speed%” Mixer-SpeedFr ‘-1,0’
- “+ 1/2 ton back%” Mixer-SpeedFr ‘-1,0595’
- “+ 1 seconde back%” Mixer-SpeedFr ‘-1,1225’
- “+ 1 tierce back%” Mixer-SpeedFr ‘-1,2599’
- “+ 1 quinte back%” Mixer-SpeedFr ‘-1,4983’
- “+ 1 octave back%” Mixer-SpeedFr ‘-2’
- “+ 1 octave 1/2 back%” Mixer-SpeedFr ‘-2,9966’
- “+ 2 octavesback%” Mixer-SpeedFr ‘-4’
- “+ 3 octaves back%” Mixer-SpeedFr ‘-8’
- “Max back%” Mixer-SpeedFr ‘-10’
DestroyMenu /SpeedEn
AddToMenu /SpeedEn
- “Max%” Mixer-SpeedEn ‘10’
- “+ 3 octaves%” Mixer-SpeedEn ‘8’
- “+ 2 octaves%” Mixer-SpeedEn ‘4’
- “+ 1 octave 1/2%” Mixer-SpeedEn ‘2.9966’
- “+ 1 octave%” Mixer-SpeedEn ‘2’
- “+ 1 septieme%” Mixer-SpeedEn ‘1.8877’
- “+ 5 tons%” Mixer-SpeedEn ‘1.7818’
- “+ 1 sixte%” Mixer-SpeedEn ‘1.6818’
- “+ 4 tons%” Mixer-SpeedEn ‘1.5874’
- “+ 1 quinte%” Mixer-SpeedEn ‘1.4983’
- “+ 3 tons%” Mixer-SpeedEn ‘1.4142’
- “+ 1 quarte%” Mixer-SpeedEn ‘1.3348’
- “+ 1 tierce%” Mixer-SpeedEn ‘1.2599’
- “+ 1 ton 1/2%” Mixer-SpeedEn ‘1.1892’
- “+ 1 seconde%” Mixer-SpeedEn ‘1.1225’
- “+ 1/2 ton%” Mixer-SpeedEn ‘1.0595’
- “+ 3 commas%” Mixer-SpeedEn ‘1.0414’
- “+ 2 commas%” Mixer-SpeedEn ‘1.0275’
- “+ 1 comma%” Mixer-SpeedEn ‘1.0136’
- “Normal%” Mixer-SpeedEn ‘1.0’
- “-1 comma%” Mixer-SpeedEn ‘0.9865’
- “-2 commas%” Mixer-SpeedEn ‘0.9733’
- “-3 commas%” Mixer-SpeedEn ‘0.9602’
- “-1 1/2 ton%” Mixer-SpeedEn ‘0.9439’
- “-1 seconde%” Mixer-SpeedEn ‘0.8909’
- “-1 ton 1/2%” Mixer-SpeedEn ‘0.8409’
- “-1 tierce%” Mixer-SpeedEn ‘0.7937’
- “-1 quarte%” Mixer-SpeedEn ‘0.7492’
- “-3 tons %” Mixer-SpeedEn ‘0.7071’
- “-1 quinte%” Mixer-SpeedEn ‘0.6674’
- “-4 tons%” Mixer-SpeedEn ‘0.623’
- “-1 sixte%” Mixer-SpeedEn ‘0.5946’
- “-5 tons%” Mixer-SpeedEn ‘0.561’
- “-1 septieme%” Mixer-SpeedEn ‘0.5297’
- “-1 octave%” Mixer-SpeedEn ‘0.5’
- “-1 octave 1/2%” Mixer-SpeedEn ‘0.3337’
- “-2 octaves%” Mixer-SpeedEn ‘0.25’
- “-3 octaves%” Mixer-SpeedEn ‘0.125’
- “-4 octaves%” Mixer-SpeedEn ‘0.0625’
- “Pause%” Mixer-SpeedEn ‘0’
- “-4 octaves back%” Mixer-SpeedEn ‘-0.0625’
- “-3 octave back%” Mixer-SpeedEn ‘-0.125’
- “-2 octaves back%” Mixer-SpeedEn ‘-0.25’
- “-1 octave 1/2 back%” Mixer-SpeedEn ‘-0.3337’
- “-1 octave back%” Mixer-SpeedEn ‘-0.5’
- “-1 quinte back%” Mixer-SpeedEn ‘-0.6674’
- “-1 tierce back%” Mixer-SpeedEn ‘-0.7937’
- “-1 seconde back%” Mixer-SpeedEn ‘-0.8909’
- “-1 1/2 ton% back” Mixer-SpeedEn ‘-0.9439’
- “Normal backward speed%” Mixer-SpeedEn ‘-1.0’
- “+ 1/2 ton back%” Mixer-SpeedEn ‘-1.0595’
- “+ 1 seconde back%” Mixer-SpeedEn ‘-1.1225’
- “+ 1 tierce back%” Mixer-SpeedEn ‘-1.2599’
- “+ 1 quinte back%” Mixer-SpeedEn ‘-1.4983’
- “+ 1 octave back%” Mixer-SpeedEn ‘-2’
- “+ 1 octave 1/2 back%” Mixer-SpeedEn ‘-2.9966’
- “+ 2 octavesback%” Mixer-SpeedEn ‘-4’
- “+ 3 octaves back%” Mixer-SpeedEn ‘-8’
- “Max back%” Mixer-SpeedEn ‘-10’
DestroyMenu /Jump
AddToMenu /Jump
- " 1%" Mixer-Jump ‘1’
- " 2%" Mixer-Jump ‘2’
- " 3%" Mixer-Jump ‘3’
- " 5%" Mixer-Jump ‘5’
- " 6%" Mixer-Jump ‘6’
- " 7%" Mixer-Jump ‘7’
- " 8%" Mixer-Jump ‘8’
- " 9%" Mixer-Jump ‘9’
- “10%” Mixer-Jump ‘10’
- “11%” Mixer-Jump ‘11’
- “12%” Mixer-Jump ‘12’
- “13%” Mixer-Jump ‘13’
- “14%” Mixer-Jump ‘14’
- “15%” Mixer-Jump ‘15’
- “16%” Mixer-Jump ‘16’
- “17%” Mixer-Jump ‘17’
- “18%” Mixer-Jump ‘18’
- “19%” Mixer-Jump ‘19’
- “20%” Mixer-Jump ‘20’
DestroyMenu /Seek
AddToMenu /Seek
- " 15 min" Mixer-Seek ‘900’
- " 10 min" Mixer-Seek ‘600’
- " 5 min" Mixer-Seek ‘300’
- " 3 min" Mixer-Seek ‘180’
- " 2 min" Mixer-Seek ‘120’
- “1 min 30” Mixer-Seek ‘90’
- " 1 min" Mixer-Seek ‘60’
- " 30 sec" Mixer-Seek ‘30’
DestroyMenu /Rel
AddToMenu /Rel
- " 10 min" Mixer-Rel ‘600’
- " 5 min" Mixer-Rel ‘300’
- " 3 min" Mixer-Rel ‘180’
- " 2 min" Mixer-Rel ‘120’
- “1 min 30” Mixer-Rel ‘90’
- " 1 min" Mixer-Rel ‘60’
- " 45 sec" Mixer-Rel ‘45’
- " 30 sec" Mixer-Rel ‘30’
- " 20 sec" Mixer-Rel ‘20’
- " 10 sec" Mixer-Rel ‘10’
- “-10 sec” Mixer-Rel ‘-10’
- “-20 sec” Mixer-Rel ‘-20’
- “-30 sec” Mixer-Rel ‘-30’
- “-45 sec” Mixer-Rel ‘-45’
- " -1 min" Mixer-Rel ‘-60’
- “-1 min 30” Mixer-Rel ‘-90’
- " -2 min" Mixer-Rel ‘-120’
- " -3 min" Mixer-Rel ‘-180’
- " -5 min" Mixer-Rel ‘-300’
- “-10 min” Mixer-Rel ‘-600’
[/code]
In Preferences-Menu
[code]# Music player
DestroyMenu /Preferences/MusicPlayer
AddToMenu /Preferences/MusicPlayer
Test (x alsaplayer) + ‘%22x22/apps/alsaplayer.png%Alsaplayer’ SelectMusicPlayer alsaplayer
It is more players here
DestroyFunc SelectMusicPlayer
AddToFunc SelectMusicPlayer
- I FindCommand MusicPlayer $0 alsaplayer mpd quodlibet xmms xmm2 cmus cdcd
- I Include components/functions/Music-$[MusicPlayer]
- I SavePreferences DefaultMusicPlayer “Include components/functions/Music-$[MusicPlayer]”
Audio mixer
DestroyMenu /Preferences/Mixer
AddToMenu /Preferences/Mixer
Test (x aumix) + ‘%22x22/apps/aumix.png%Aumix’ SelectMixer aumix
+ “” Nop
Test (x alsaplayer) + ‘%22x22/apps/alsaplayer.png%Alsaplayer’ SelectMixer alsaplayer
More plaers here too.
DestroyFunc SelectMixer
AddToFunc SelectMixer
- I FindCommand DefaultMixer $0 aumix alsaplayer mpd quodlibet xmms xmms2 cmus cdcd
- I Include components/functions/Mixer-$[DefaultMixer]
- I SavePreferences DefaultMixer “Include components/functions/Mixer-$[DefaultMixer]”
[/code]
The alsaplayer is the only linux audio player that have both a speed control and a simple API.
I get a problem with the , and the . in the decimal numbers with fvwm and my locales. It is strange because when I run the alsaplayer from a console and issue the command from another console, it doesn’t matter if I send 0.5 or 0,5 to the player, but it doesn’t work with this menu, so I done a locale test to select the volume and the speed control.
I don’t know if I want to keep all the values in the speed control because I use mostly only a few of them, the small values around the normal speed. It is very useful when playing guitar at the same time I am listening to some music, and with the slider in the alsaplayer GUI, it is almost impossible to get so small changes.
Another good thing is at the volume control is in db. The last value, -36 db, = ~ to 1 % of the 0 db volume.
But my first concern is the order of the submenus. I cannot figure out what is going out.