You are not logged in.
Pages: 1
here's a small script to inform you about the volume
[modified june 8th]

download link: http://ticcaso.fileave.com/volume-notify.tar.gz
what's in the .tar.gz?
the ali-vol script and the icons folder
the icons folder contains 202 images, each reflecting the current state
just replace whatever you're interested in changing in the elements list
what will you need?
- notification-daemon
- libnotify-bin
why would you need this?
well i never knew at what percentage i was when voluming up and down and i often found myself checking the mixer so i thought i'd make a small script to make my life a bit easier 
place it where ever you like just remember to change the icon variable in the script to reflect the changes
i called mine ali-vol
how to call it?
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<command>*script-name* up</command>
</action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<command>*script-name* down</command>
</action>
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute">
<command>*script-name* toggle</command>
</action>
</keybind>/*
the reason why i said you need notification-daemon is because notify-osd doesn't support notify timeout
*/
Last edited by ali (2011-06-08 12:01:06)
Offline
I really think I've seen something like that here a year ago. We should put some work and make a master list :-D
Anyway, nice work.
I'm so meta, even this acronym
Offline
thanks, also i forgot to mention, the reason why i said you need notification-daemon is because notify-osd doesn't support notify timeout, so you would have to wait 10 seconds every time you change the volume to find out what value you're at right now
Offline
You can control the timeout for notify-osd in ~/.notify-osd.
Mine is set to 5sec and it dissapears after 5 sec
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
that timeout is universal, not all notifications are equally important, volume notifications may be set for 100 ms where as normal notifications should last more than 5000 ms
Offline
I had to place this script under /usr/bin and make it executable to work, is that okay?
It toggles the volume up/down, and shows the osd but no actual value, I guess my output differs and awk isn't parsing it right, can you point out what needs to change to awk the correct value?
in terminal I get this:
kbmonkey@bitwise:~$ amixer sset PCM 10+
Simple mixer control 'PCM',0
Capabilities: pvolume penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 210 [82%] [-9.00dB]
Front Right: Playback 210 [82%] [-9.00dB]As you can see, I set the PCM device volume, Master does not seem to work. I'm happy, I just need to awk the [82%].
Thanks 
Online
As you can see, I set the PCM device volume, Master does not seem to work. I'm happy, I just need to awk the [82%].
Something like:
amixer get PCM | grep 'Front Left:' | awk '{print $5}' | sed 's/\[/Volume: /g' | sed 's/\]//g'will get the volume %
Last edited by Tunafish (2011-01-30 21:08:52)
sed 's/stress/relaxation/g'
Privacy & Security on #!
Offline
I had to place this script under /usr/bin and make it executable to work, is that okay?
It toggles the volume up/down, and shows the osd but no actual value, I guess my output differs and awk isn't parsing it right, can you point out what needs to change to awk the correct value?
in terminal I get this:
kbmonkey@bitwise:~$ amixer sset PCM 10+ Simple mixer control 'PCM',0 Capabilities: pvolume penum Playback channels: Front Left - Front Right Limits: Playback 0 - 255 Mono: Front Left: Playback 210 [82%] [-9.00dB] Front Right: Playback 210 [82%] [-9.00dB]As you can see, I set the PCM device volume, Master does not seem to work. I'm happy, I just need to awk the [82%].
Thanks
replace Master Front with PCM in the script 
Offline
replace Master Front with PCM in the script
*slaps forehead* Thanks 
Online
I had to place this script under /usr/bin and make it executable to work, is that okay?
I think that's OK as well. I prefer to put my scripts in /home/username/bin
Makes it easier to maintain them. Don't know what's best.
sed 's/stress/relaxation/g'
Privacy & Security on #!
Offline
i'd put them in ~/bin/scripts and create a symbolic link in /usr/bin
sudo ln -s ~/bin/scripts/whatever-script /usr/bin/whatever-scripti modified the initial post, made the script better using tunafish's method of getting the %
Last edited by ali (2011-01-31 09:51:39)
Offline
Trying this out now. I'd like to control my master, so I specify Master in the script. Volume changing works, but no OSD. I get the message "No summary specified". If I specify PCM instead of Master in the script, OSD works.
Any ideas?
Offline
write
amixer get Masterand see if you get a good reading
Offline
i'd put them in ~/bin/scripts and create a symbolic link in /usr/bin
sudo ln -s ~/bin/scripts/whatever-script /usr/bin/whatever-script
Or make links from ~/bin for the ones that only have to be in that user's $PATH.
Last edited by johnraff (2011-02-21 18:09:36)
John
--------------------
( a boring Japan blog , and idle twitterings )
Offline
i'd put them in ~/bin/scripts and create a symbolic link in /usr/bin
Or make links from ~/bin for the ones that only need to be in that user's $PATH.
Last edited by johnraff (2011-02-21 18:11:14)
John
--------------------
( a boring Japan blog , and idle twitterings )
Offline
write
amixer get Masterand see if you get a good reading
Yeah, the reading seems to be fine:
gustav@eeernst:~$ amixer get Master
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback 0 - 64
Mono: Playback 59 [92%] [-5.00dB] [on]But wouldn't it be possible to get this OSD (well this one is for brightness, but you get the point...) instead of the one with text your script makes?
Offline
it probably would be possible but i'm not that good
#! /bin/bash
if [[ $1 -eq 1 ]]
then
P=`amixer sset 'Master',0 2+ | grep 'Mono:' | awk '{print $4}' | sed 's/\[/Volume: /g' | sed 's/\]//g'`
notify-send -t 300 "$P"
else if [[ $1 -eq 2 ]]
then
P=`amixer sset 'Master',0 2- | grep 'Mono:' | awk '{print $4}' | sed 's/\[/Volume: /g' | sed 's/\]//g'`
notify-send -t 300 "$P"
else if [[ $1 -eq 3 ]]
then
P=`amixer sset 'Master',0 toggle | grep "Mono:" | awk '{print $6}'`
if [[ ''$P'' == '[off]' ]]
then
P="Volume is off"
else
P="Volume is on"
fi
notify-send -t 300 "$P"
fi
fi
fiOffline
Thanks ali!
That script works great!
Offline
Offline
But wouldn't it be possible to get this OSD (well this one is for brightness, but you get the point...) instead of the one with text your script makes?
i just tried that, see first post to see what i came up with
Offline
Pages: 1
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.