Hi, I am on gentoo and I have done a menu script to have an alsaplayer control
in the panel. I modified some fvwm-crystal scripts for that.

The problem is at I use french locales:
LANG="fr_CH.UTF-8"
LANGUAGE="fr_CH.UTF-8"
LC_ALL="fr_CH.UTF-8"

and when I change to English locales, the volume and the speed control stop to
work correctly.

I have the following code:

In Mixer-alsaplayer:

DestroyMenu /Volume
AddToMenu /Volume
+ " 0 db%" Mixer-Volume '1,0'
+ "-3 db%" Mixer-Volume '0,707'
+ "-6 db%" Mixer-Volume '0,5'
+ "-12 dB%" Mixer-Volume '0,25'
+ "-18 db%" Mixer-Volume '0,125'
+ "-24 db%" Mixer-Volume '0,0625'
+ " 0" Mixer-Volume '0,0'

DestroyFunc Mixer-Volume
AddToFunc Mixer-Volume
+ I Exec exec alsaplayer --volume $0

In Music-alsaplayer:

DestroyFunc /Music-generator
AddToFunc /Music-generator
+ I DestroyMenu recreate /Music
+ I AddToMenu /Music '$[gt.Volume]'             Popup /Volume

The problem is at when I change to English locales, alsaplayer want to get "."
as decimal character, not a ","

I try to change the code as follow:

DestroyFunc Mixer-Volume
AddToFunc Mixer-Volume
+ I SetEnv x "$0"
+ I PipeRead "echo SetEnv y $(( $[x]/1000000 ))"
+ I Exec exec xmessage x: $[x]
+ I Exec exec xmessage y: $[y]
+ I Exec exec $[A_Player] --volume $[y]

DestroyMenu /Volume
AddToMenu /Volume
+ " 0 db%" Mixer-Volume '1000000'
+ "-3 db%" Mixer-Volume '707000'
+ "-6 db%" Mixer-Volume '500000'
+ "-12 dB%" Mixer-Volume '250000'
+ "-18 db%" Mixer-Volume '125000'
+ "-24 db%" Mixer-Volume '62500'
+ "-30 db%" Mixer-Volume '31250'
+ "-36 db%" Mixer-Volume '15625'
+ " 0" Mixer-Volume '0'

But the shell output integer number in y, it mean only 1 or 0.

I try this too:

+ I PipeRead "echo SetEnv y $(( $[x]/1000000|bc-l ))"

but it work the same, I get only 1 or 0 in y.

And it is even worse, because when I run 

$ echo 500000/1000000|bc -l

the shell output is always

.50000000000000000000

and that even when I use the french locales.

Is it possible to get this script to work in any locale case?

Dominique

Reply via email to