Tiny Core Extensions > TCE Tips & Tricks
nifty volume control for jwm
tobiaus:
put these lines in ~/.jwmrc-tray
--- Code: --- <TrayButton label="v">exec:/usr/local/bin/vola -down 10</TrayButton>
<TrayButton label="^">exec:/usr/local/bin/vola -up 10</TrayButton>
--- End code ---
i like to put that code before the pager. you don't need the "10" - that's from when i intended to get real numbers from the script and use math, that would take parsing more than tokens.
save this script (you'll need sudo) as /usr/local/bin/vola (this is probably against all tinycore's conventions, the reason for choosing /usr/local/bin is that's where the leafpad tcz puts the symlink to leafpad.) i like to think this betrays what a noob i am at coding scripts, but i'm proud of it, even if i shouldn't be. you may want to change it to suit your own needs. it seems to be reasonably fast. no idea what happens if you're using alsa or alsa-oss, but i've changed the volume using ossmix vol number since the first time i ran youtube in tc.
--- Code: ---#!/bin/sh
for u in `ossmix vol` ; do
v=$u
done
if [ "$1" == "-up" ]; then
case "$v" in
"0:0" ) ossmix vol 10 ;;
"10:10" ) ossmix vol 20 ;;
"20:20" ) ossmix vol 30 ;;
"30:30" ) ossmix vol 40 ;;
"40:40" ) ossmix vol 50 ;;
"50:50" ) ossmix vol 60 ;;
"60:60" ) ossmix vol 70 ;;
"70:70" ) ossmix vol 80 ;;
"80:80" ) ossmix vol 90 ;;
"90:90" ) ossmix vol 100 ;;
"100:100" ) ossmix vol ;;
* ) ossmix vol 50 ;;
esac
fi
if [ "$1" == "-down" ]; then
case "$v" in
"0:0" ) ossmix vol ;;
"10:10" ) ossmix vol 0 ;;
"20:20" ) ossmix vol 10 ;;
"30:30" ) ossmix vol 20 ;;
"40:40" ) ossmix vol 30 ;;
"50:50" ) ossmix vol 40 ;;
"60:60" ) ossmix vol 50 ;;
"70:70" ) ossmix vol 60 ;;
"80:80" ) ossmix vol 70 ;;
"90:90" ) ossmix vol 80 ;;
"100:100" ) ossmix vol 90 ;;
* ) ossmix vol 50 ;;
esac
fi
--- End code ---
mikshaw:
I don't know anything about ossmix, but it seems like your script could be much more compact. Perosnally I use a script that calls rexima (not in TC base or extensions...yet).
--- Code: ---case $1 in
down|dn|-) exec rexima vol - ;;
up|+) exec rexima vol + ;;
esac
--- End code ---
Of course this has only one argument, so it might not be as flexible as you'd need for your purposes...I just have "volume up" and "volume dn" linked to hotkeys.
If ossmix doesn't accept relative settings (+ and -, for example) I guess it wouldn't apply.
Also I guess I could have used rexima directly in the hotkeys, but I opted for a script so it could be applied to multiple window managers and be easily changed in one place if I changed the mixer application.
curaga:
Actually ossmix does accept relative settings, for example "ossmix vol +10"
tobiaus:
ohhh, yes if ossmix lets you do -10 + 10 you don't need the script at all, just the buttons.
typical! other things worth nothing is that i looked for tcb tips and tricks ("no, not tce!") because it "only" uses jwm, but since there's no sound in tc without an extension, i should have used tce tips. (it was late.) i like using .jwmrc-keys, i should should put ca "u" and ca "d" for ossmix +10, -10 also. or maybe i'll use 5 this time. thanks, as usual to you both.
Onyarian:
Thanks tobiaus, your trick is very useful.
I don't now if this helps someone but I have made some modifications to this trick because it doesn't work to me, the output of my ossmix is different and it doesn't accept the +10 or -10 form.
First my notebook is an Aspire One. I load at boot OSS.tcem and have in bootlocal.sh the soundon command.
my ossmix command is:
--- Quote ---Selected mixer 0/High Definition Audio ALC268
Known controls are:
jack.int-speaker.mode <mix|input> (currently mix)
jack.int-speaker.mute ON|OFF (currently OFF)
jack.int-speaker.speaker <both/leftvol>[:<rightvol>] (currently 57.9:57.9 dB)
jack.int-speaker.speaker-mute ON|OFF (currently OFF)
jack.green.mode <mix|input> (currently mix)
jack.green.mute ON|OFF (currently OFF)
jack.green.headphone <both/leftvol>[:<rightvol>] (currently 57.9:57.9 dB)
jack.green.mute.headphone ON|OFF (currently OFF)
jack.green.mute.speaker ON|OFF (currently OFF)
jack.pink.mode <speaker|input> (currently speaker)
jack.pink <both/leftvol>[:<rightvol>] (currently 39.9:39.9 dB)
jack.pink.mute ON|OFF (currently OFF)
record.select.select1 <both/leftvol>[:<rightvol>] (currently 43.4:43.4 dB)
record.select.select2 <both/leftvol>[:<rightvol>] (currently 43.4:43.4 dB)
record.select.select3 <speaker|dmic> (currently dmic)
vmix0-channels <Stereo|Multich> (currently Stereo)
vmix0-src <Fast|Low|Medium|High|High+|Production|OFF> (currently Fast)
vmix0-vol <monovol> (currently 25.0 dB)
vmix0-out1 <leftVU>:<rightVU>] (currently 105:104)
vmix0-in <leftVU>:<rightVU>] (currently 0:0)
vmix0-out.pcm4 <both/leftvol>[:<rightvol>] (currently 25.0:25.0 dB)
vmix0-out2 <leftVU>:<rightVU>] (currently 112:111)
vmix0-out.pcm5 <both/leftvol>[:<rightvol>] (currently 25.0:25.0 dB)
vmix0-out3 <leftVU>:<rightVU>] (currently 0:0)
vmix0-out.pcm6 <both/leftvol>[:<rightvol>] (currently 25.0:25.0 dB)
vmix0-out4 <leftVU>:<rightVU>] (currently 0:0)
vmix0-out.pcm7 <both/leftvol>[:<rightvol>] (currently 25.0:25.0 dB)
vmix0-out5 <leftVU>:<rightVU>] (currently 0:0)
--- End quote ---
so the sound goes from 0 to 25, and not from 0 to 100
the .jwmrc-tray:
--- Quote --- <TrayButton label="v">exec:/usr/local/bin/vola -down</TrayButton>
<TrayButton label="^">exec:/usr/local/bin/vola -up</TrayButton>
--- End quote ---
the output to ossmix vmix0-vol:
--- Quote ---tc@box:~$ ossmix vmix0-vol
Value of mixer control vmix0-vol is currently set to 25.0 (dB)
--- End quote ---
and the vola with this modification:
--- Quote ---#!/bin/sh
u=`ossmix vmix0-vol`
#for u in `ossmix vmix0-vol` ; do
v=$u
#done
if [ "$1" == "-up" ]; then
case "$v" in
"Value of mixer control vmix0-vol is currently set to 0.0 (dB)" ) ossmix vmix0-vol 5 ;;
"Value of mixer control vmix0-vol is currently set to 5.0 (dB)" ) ossmix vmix0-vol 10 ;;
"Value of mixer control vmix0-vol is currently set to 10.0 (dB)" ) ossmix vmix0-vol 15 ;;
"Value of mixer control vmix0-vol is currently set to 15.0 (dB)" ) ossmix vmix0-vol 20 ;;
"Value of mixer control vmix0-vol is currently set to 20.0 (dB)" ) ossmix vmix0-vol 25 ;;
"Value of mixer control vmix0-vol is currently set to 25.0 (dB)" ) ossmix vmix0-vol ;;
esac
fi
if [ "$1" == "-down" ]; then
case "$v" in
"Value of mixer control vmix0-vol is currently set to 0.0 (dB)" ) ossmix vmix0-vol ;;
"Value of mixer control vmix0-vol is currently set to 5.0 (dB)" ) ossmix vmix0-vol 0 ;;
"Value of mixer control vmix0-vol is currently set to 10.0 (dB)" ) ossmix vmix0-vol 5 ;;
"Value of mixer control vmix0-vol is currently set to 15.0 (dB)" ) ossmix vmix0-vol 10 ;;
"Value of mixer control vmix0-vol is currently set to 20.0 (dB)" ) ossmix vmix0-vol 15 ;;
"Value of mixer control vmix0-vol is currently set to 25.0 (dB)" ) ossmix vmix0-vol 20 ;;
esac
fi
--- End quote ---
This is the only form that works correctly for me.
Perhaps the next that I will do is to divide vola in more fraccions as from 5 to 5
Navigation
[0] Message Index
[#] Next page
Go to full version