You are not logged in.

#26 2008-02-03 22:13:55

bruenig
Member
Registered: 2007-05-20
Posts: 175

Re: changevol - volume management (good for binding multimedia keys)

ruinevil wrote:
    if (BACKLIGHT == "YES"): 
      self.label = "Backlight " + self.endlabel
    else:
      self.label = "Volume " + self.endlabel

I added that where you had

self.label = "Volume " + self.endlabel

and it worked...

What do you mean it worked, all that should do is change the label in the gtk bar, which is cool if you want that but the backlight should change the same regardless of that.

Offline

#27 2008-02-05 06:40:09

ruinevil
Member
Registered: 2008-01-15
Posts: 11

Re: changevol - volume management (good for binding multimedia keys)

Changing the brightness with mute on has hilarious consequences... basically muted backlight.

Offline

#28 2008-02-06 21:48:48

mfolnovic
Member
From: Zagreb, Croatia
Registered: 2008-01-03
Posts: 104

Re: changevol - volume management (good for binding multimedia keys)

http://pastebin.com/d3d640fe2
I've modified your script so it decreases backlight at start, and increases back at end, but when I run it, it just decreases, and when I comment that line where he's decreasing, run xbacklight -set 50, and then run script, it increases back to 100... So I guess problem is I can't run xbacklight twice, why ?

Offline

#29 2008-02-07 13:14:32

Ibex
Member
Registered: 2006-03-02
Posts: 127

Re: changevol - volume management (good for binding multimedia keys)

I'd like to set the "window" in the right-bottom-corner of my screen and probably change the size a bit. I already found out how to change the width, but I cannot change the position. I guess it's something with the set_position, but maybe you can make the X and Y coordinates settable by parameters?

./changevol -c Front -i 5 -x 1400 -y 880

Offline

#30 2008-02-21 04:59:12

Reasons
Member
From: Washington
Registered: 2007-11-04
Posts: 572

Re: changevol - volume management (good for binding multimedia keys)

I'm not too understanding with this so if you could explain or help me with this, I'd be grateful. I have a script I use to change the brightness with my fn keys on my vaio. Really, it is the only way and it is run in a similar manner which is /etc/acpi/actions/sonybright.sh up/down. The script is

#!/bin/bash

BRIGHTNESS=$(cat /sys/class/backlight/sony/actual_brightness)

if [ "$BRIGHTNESS" -gt 7 ]; then
    BRIGHTNESS=1
fi

if [ "x$1" = "xdown" ]; then
   if [ "x$BRIGHTNESS" != "x1" ]; then
      BRIGHTNESS=$(( $BRIGHTNESS - 1 ))
      echo $BRIGHTNESS > /sys/class/backlight/sony/brightness
   else
      [ -x /usr/bin/spicctrl ] && /usr/bin/spicctrl -b 0   
   fi
   # Recent nvidia Sonys have ACPI methods that do nothing. Thanks, Sony.
   [ -x /usr/bin/smartdimmer ] && smartdimmer -d 2>/dev/null
elif [ "x$1" = "xup" ]; then
   if [ "x$BRIGHTNESS" != "x8" ]; then
      BRIGHTNESS=$(( $BRIGHTNESS + 1 ))
      echo $BRIGHTNESS > /sys/class/backlight/sony/brightness
   fi
   [ -x /usr/bin/smartdimmer ] && smartdimmer -i 2>/dev/null
else
   echo >&2 Unknown argument $1
fi

How would I get a similar OSD for it?

Offline

#31 2008-12-15 20:42:48

weasel8
Member
Registered: 2008-12-15
Posts: 149

Re: changevol - volume management (good for binding multimedia keys)

This is really sweet; I've got my extra volume up/down/mute keys properly mapped to actually do their jobs at last. Question: is there any way to make it change both Master and PCM simultaneously? I like to have them both synced for the best sound. Thanks again for the awesome script.

Offline

#32 2008-12-16 01:04:20

bruenig
Member
Registered: 2007-05-20
Posts: 175

Re: changevol - volume management (good for binding multimedia keys)

weasel8 wrote:

This is really sweet; I've got my extra volume up/down/mute keys properly mapped to actually do their jobs at last. Question: is there any way to make it change both Master and PCM simultaneously? I like to have them both synced for the best sound. Thanks again for the awesome script.

The script is actually hysterically hackish, this was back in my completely and I mean completely ignorant python days. But to change both you would just need to edit the script at the bottom I imagine.

command = "amixer set " + CONTROL + " " + AMIXEROPTION 

#Execution 
volume = GetVolInfo(command) 

#Executing againi for PCM
command = "amixer set " + "PCM" + " " + AMIXEROPTION
volume = GetVolInfo(command) 

if (QUIET == "NO"): 
  ProgressBar(volume.percent, volume.label) 
  gtk.main() 

if (BACKLIGHT == "YES"):
  os.execv('/usr/bin/xbacklight', ['placeholder', '-set', volume.realvol])

Last edited by bruenig (2008-12-16 01:05:38)

Offline

#33 2008-12-16 07:32:58

weasel8
Member
Registered: 2008-12-15
Posts: 149

Re: changevol - volume management (good for binding multimedia keys)

Works perfectly. Please collect 1 (one) Internets at the prize table.

Offline

#34 2008-12-16 11:48:59

Shapeshifter
Member
Registered: 2008-03-11
Posts: 219

Re: changevol - volume management (good for binding multimedia keys)

Well that's nice. But it is unbelievably slow! Takes a second or so to exit. Not suited for pressing and holding the media button.  It lags behind by a lot. (Maybe backgrounding/killing the displayed bar if another instance of the script is called would solve this?)

Here's what I use - extremely basic, no bar, nothing. Does what it should:

amixer-control {up|down|mute}

#!/bin/bash
# amixer control script

case $1 in
        up)
            volume=$(amixer sget Master | grep Left: | awk '{print $4}')
            amixer sset Master $((volume+2)) >/dev/null 2>&1
        ;;
        down)
            volume=$(amixer sget Master | grep Left: | awk '{print $4}')
            if [[ $((volume-2)) < 0 ]]; then
            volume=0
            else
            volume=$((volume-2))
            fi
            amixer sset Master $volume >/dev/null 2>&1
        ;;
        mute)
            state=$(amixer sget Master | grep Left: | awk '{print $7}')
            [[ $state == '[on]' ]] && amixer sset Master mute  >/dev/null 2>&1 && exit
            [[ $state == '[off]' ]] && amixer sset Master unmute  >/dev/null 2>&1 && exit
        ;;
esac

Last edited by Shapeshifter (2008-12-16 11:49:47)

Offline

#35 2008-12-16 17:26:30

bruenig
Member
Registered: 2007-05-20
Posts: 175

Re: changevol - volume management (good for binding multimedia keys)

Shapeshifter, stop trolling, but yes it is not suitable for holding down (by the way, it doesn't actually change the window that pops up, it just draws windows on top of the other one creating the illusion that it is changing the bar). So if you hold it down, you could reasonably expect to pull up 10-15 pop up windows one on top of the other. Look at dvol for a technically good bar. It uses named pipes and such to prevent multiple instances and is just a really short bash script that calls dzen.

Scroll down to the bottom for some cool modifications: http://bbs.archlinux.org/viewtopic.php?id=46608

Last edited by bruenig (2008-12-16 17:27:38)

Offline

Board footer

Powered by FluxBB