Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: [pulseaudio] volume control with multimedia keys ?

  1. #11
    Join Date
    Nov 2009
    Beans
    2

    Re: [pulseaudio] volume control with multimedia keys ?

    Quote Originally Posted by alwayslurking View Post
    Code:
    #!/bin/bash
    [[ $0 == pa_vol_down ]] && _down=true 
    [[ $1 ]] && let _vol_increment=$1*655 || _vol_increment=655
    _full_line=`pacmd dump|grep "set-sink-volume"`
    _sink_cmd=`echo $_full_line|cut -d" " -f1`
    _sink_id=`echo $_full_line|cut -d" " -f2`
    _sink_vol=`echo $_full_line|cut -d" " -f3`
    [[ $_down ]] && let _vol=$_sink_vol-$_vol_increment || let _vol=$_sink_vol+$_vol_increment
    [[ $_vol -lt 0 ]] && _vol=0
    [[ $_vol -gt 65536 ]] && _vol=65536
    pacmd $_sink_cmd $_sink_id $_vol > /dev/null
    Code:
     [[ $0 == pa_vol_down ]] && _down=true
    should be
    Code:
     [[ ${0##*/} == pa_vol_down ]] && _down=true
    to avoid problems where the full path is used.

    Other than that great script. I like how bash handles the conversion from hex to decimal on its own.

  2. #12
    Join Date
    Oct 2010
    Location
    Dayton, Ohio
    Beans
    75
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [pulseaudio] volume control with multimedia keys ?

    I'm using a ruby script that actually changes all sinks at the same time - which comes in handy when you've suddenly started using an external USB speaker and all your keybound scripts work with only one sink.

    I can't take credit for most of it - I forked and tweaked it a tiny bit. The original script is here: https://gist.github.com/814634; I couldn't get it to run because of something in the muting code, so I fixed that and added in some output in case someone wants to send it to notify-osd or somesuch. Mine's at: https://gist.github.com/1791270.
    I inject people with radioactive stuff for a living. But only to serve the forces of good.
    webpage | blog

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •