From: <dom...@us...> - 2013-06-06 18:37:44
|
Revision: 504 http://sourceforge.net/p/fvwm-crystal/code/504 Author: dominique_libre Date: 2013-06-06 18:37:42 +0000 (Thu, 06 Jun 2013) Log Message: ----------- functions/Mixer; bindings/Multimedia*: added toggle mute functions Modified Paths: -------------- ChangeLog fvwm/components/bindings/Multimedia_Keys fvwm/components/bindings/Multimedia_Keys_NumLock fvwm/components/functions/Mixer Modified: ChangeLog =================================================================== --- ChangeLog 2013-06-05 19:28:01 UTC (rev 503) +++ ChangeLog 2013-06-06 18:37:42 UTC (rev 504) @@ -1,5 +1,8 @@ ChangeLog for FVWM-Crystal +Jeudi 6 juin 2013 Dominique Michel + functions/Mixer; bindings/Multimedia*: added toggle mute functions + Mercredi 5 juin 2013 Dominique Michel recipes(Default with ACPI; recipes/SilentHacker: make the buttons to be aligned when the font size is changing Modified: fvwm/components/bindings/Multimedia_Keys =================================================================== --- fvwm/components/bindings/Multimedia_Keys 2013-06-05 19:28:01 UTC (rev 503) +++ fvwm/components/bindings/Multimedia_Keys 2013-06-06 18:37:42 UTC (rev 504) @@ -9,8 +9,8 @@ Key XF86AudioLowerVolume A C Music-Speed-Down Key XF86AudioRaiseVolume A C Music-Speed-Up -Key XF86AudioMute A $[Mod0] Music-VolumeUp -key XF86AudioMute A C Music-VolumeDown +Key XF86AudioMute A $[Mod0] Mixer-Volume-Toggle +key XF86AudioMute A C Mixer-Volume-Toggle key XF86AudioPlay A $[Mod0] Music-FrameStep #key XF86AudioPlay A $[Mod0] Music-PlayPause key XF86AudioPlay A $[Mod1] Music-Speed normal mplayer Modified: fvwm/components/bindings/Multimedia_Keys_NumLock =================================================================== --- fvwm/components/bindings/Multimedia_Keys_NumLock 2013-06-05 19:28:01 UTC (rev 503) +++ fvwm/components/bindings/Multimedia_Keys_NumLock 2013-06-06 18:37:42 UTC (rev 504) @@ -9,8 +9,8 @@ Key XF86AudioLowerVolume A C2 Music-Speed-Down Key XF86AudioRaiseVolume A C2 Music-Speed-Up -Key XF86AudioMute A $[Mod0]2 Music-VolumeUp -key XF86AudioMute A C2 Music-VolumeDown +Key XF86AudioMute A $[Mod0]2 Mixer-Volume-Toggle +key XF86AudioMute A C2 Music-Volume-Toggle key XF86AudioPlay A $[Mod0]2 Music-FrameStep key XF86AudioPlay A $[Mod1]2 Music-Speed normal mplayer key XF86AudioPlay A C2 Music-Pause Modified: fvwm/components/functions/Mixer =================================================================== --- fvwm/components/functions/Mixer 2013-06-05 19:28:01 UTC (rev 503) +++ fvwm/components/functions/Mixer 2013-06-06 18:37:42 UTC (rev 504) @@ -56,6 +56,16 @@ # Set VolControl: Test if MASTER mixer exist, fallback to PCM PipeRead "if [[ $[infostore.Mixer] == aumix ]] ; then NVolControl=`aumix -d /dev/mixer$[infostore.SoundCard] -q | grep master -c` ; echo InfoStoreAdd VolControl `if [[ $NVolControl == 0 ]]; then echo w; else echo v ; fi` ; fi" +# Memorize the volume +#PipeRead 'tmpval=`amixer -c $[infostore.SoundCard] get $[infostore.VolControl]`; tmpval2=`echo $tmpval|sed -e "s:\\(.*\\)\\(\\[.*dB]\\):\\2:" -e "s:\\[::" -e "s:\\]::"`; echo "InfoStoreAdd CurrentVolume $tmpval2"' + +# Mute = off +InfoStoreAdd MixerMute 0 +InfoStoreAdd MixerMuteAP 0 +InfoStoreAdd MixerMuteCdcd 0 +InfoStoreAdd MixerMuteMP 0 +InfoStoreAdd MixerMuteMP2 0 + # Basics functions {{{1 # Mixer-Volume <value> {{{2 DestroyFunc Mixer-Volume @@ -104,11 +114,43 @@ *) echo Nop ;; \\ esac' +# Mixer volume toggle mute {{{2 +# Selected player will toggle the pause. +# If alsamixer or aumix is selected, it will mute toggle too. +DestroyFunc Mixer-Volume-Toggle +AddToFunc Mixer-Volume-Toggle ++ I PipeRead 'if [[ $[infostore.Mixer] == amixer ]]; then \\ + if [[ $[infostore.MixerMute] == 0 ]]; then tmpval=`amixer -c $[infostore.SoundCard] get $[infostore.VolControl]`; tmpval2=`echo $tmpval|sed -e "s:\\(.*\\)\\(\\[.*dB]\\):\\2:" -e "s:\\[::" -e "s:\\]::"`; echo "InfoStoreAdd CurrentVolume $tmpval2"; amixer -c $[infostore.SoundCard] -- set $[infostore.VolControl] 0 > /dev/null; echo "InfoStoreAdd MixerMute 1"; else amixer -c $[infostore.Soundcard] -- set $[infostore.VolControl] $[infostore.CurrentVolume] > /dev/null; echo "InfoStoreAdd MixerMute 0"; fi; fi' ++ I PipeRead 'if [[ $[infostore.Mixer] == aumix ]]; then \\ + if [[ $[infostore.MixerMute] == 0 ]]; then echo "InfoStoreAdd MixerMute 1"; tmpval=`aumix -d /dev/mixer$[infostore.SoundCard] -'$[infostore.VolControl]'q | sed -e "s:.*, ::"`; echo "InfoStoreAdd CurrentVolume $tmpval"; exec aumix -d /dev/mixer$[infostore.SoundCard] -'$[infostore.VolControl]' 0 > /dev/null; else echo "InfoStoreAdd MixerMute 0"; exec aumix -d /dev/mixer$[infostore.SoundCard] -'$[infostore.VolControl]' $[infostore.CurrentVolume] > /dev/null; fi; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == audacious ]]; then \\ + exec audtool playback-playpause > /dev/null; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == cdcd ]]; then \\ + if [[ $[infostore.MixerMuteCdcd] == 0 ]]; then echo "InfoStoreAdd MixerMuteCdcd 1"; exec cdcd pause > /dev/null; else echo "InfoStoreAdd MixerMuteCdcd 0"; cdcd resume > /dev/null; fi; fi' ++ I PipeRead 'if [[ $[infostore.Musicplayer] == cmus ]]; then \\ + exec cmus-remote --pause > /dev/null; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == mpd ]]; then \\ + exec mpc toggle > /dev/null; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == quodlibet ]]; then \\ + exec quodlibet --play-pause > /dev/null; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == xmms2 ]]; then \\ + exec xmms2 toggle > /dev/null; fi' +# the other players ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == alsaplayer ]]; then \\ + if [[ $[infostore.MixerMuteAP] == 0 ]]; then echo "InfoStoreAdd MixerMuteAP 1"; exec alsaplayer --speed 0; else echo "InfoStoreAdd MixerMuteAP 0"; exec alsaplayer --speed $[infostore.speed]; fi; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == mocp ]]; then \\ + exec mocp --sync --toggle-pause; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == mplayer ]]; then \\ + if [[ $[infostore.MixerMuteMP] == 0 ]]; then echo "InfoStoreAdd MixerMuteMP 1"; exec echo "pause" > /home/$[infostore.USERDIR]/.mplayer/pipe; else echo "InfoStoreAdd MixerMuteMP 0"; exec echo "pause" > /home/$[infostore.USERDIR]/.mplayer/pipe; fi; fi' ++ I PipeRead 'if [[ $[infostore.MusicPlayer] == mplayer2 ]]; then \\ + if [[ $[infostore.MixerMuteMP2] == 0 ]]; then echo "InfoStoreAdd MixerMuteMP2 1"; exec echo "pause" > /home/$[infostore.USERDIR]/.mplayer/pipe; else echo "InfoStoreAdd MixerMuteMP2 0"; exec echo "pause" > /home/$[infostore.USERDIR]/.mplayer/pipe; fi; fi' + # Mixer-Volume-dB <value>dB {{{2 DestroyFunc Mixer-Volume-dB AddToFunc Mixer-Volume-dB + I Exec exec amixer -c $[infostore.SoundCard] -- set '$[infostore.VolControl]' $0 > /dev/null + I PipeRead 'tmpval=`amixer -c $[infostore.SoundCard] get $[infostore.VolControl]`; tmpval2=`echo $tmpval|sed -e "s:\\(.*\\)\\(\\[.*dB]\\):\\2:"`; echo "InfoStoreAdd CurrentVolume $tmpval2"' + # Show/Hide the GUI {{{2 DestroyFunc Mixer-GUI AddToFunc Mixer-GUI This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |