SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-03-06 20:42:51

hardran3
#! Junkie
From: forest town, lake land
Registered: 2011-02-26
Posts: 360

Openbox rc.xml and Pulseaudio Volume Control [SOLVED]

Nevermind. Rather than trying to make this so difficult I found an easy way. Like this:

    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer set Master 5%+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer set Master 5%-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>amixer set Master toggle</command>
      </action>
    </keybind>

volumeicon also works fine. just change your external mixer in the preferences to pavucontrol and you are good to go.


Original Post

I have successfully installed Pulseaudio, I have a working volume control in my notification area. Now I just need to get my laptop volume keys working. I have found a way to change the volume and control muting [1], and it works fine from the terminal, but not from rc.xml.

Volume up command

pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3+3277)}'

Volume down command

pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3-3277)}'

Mute/unmute command

pacmd dump|awk --non-decimal-data '$1~/set-sink-mute/{system ("pacmd "$1" "$2" "($3=="yes"?"no":"yes"))}'

My section of rc.xml looks like this now.

    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>"pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3+3277)}'"</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>"pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3-3277)}'"</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>pacmd dump|awk --non-decimal-data '$1~/set-sink-mute/{system ("pacmd "$1" "$2" "($3=="yes"?"no":"yes"))}'</command>
      </action>
    </keybind>

These commands run as intended from a terminal, but nothing happens when I try the buttons. Am I just failing to understand rc.xml?

Last edited by hardran3 (2011-03-06 22:37:17)

Offline

Be excellent to each other!

#2 2011-03-06 22:26:34

chaanakya
#! Die Hard
Registered: 2010-12-30
Posts: 940

Re: Openbox rc.xml and Pulseaudio Volume Control [SOLVED]

Can you try my scripts from here?


Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1

Offline

#3 2011-03-06 22:31:37

chaanakya
#! Die Hard
Registered: 2010-12-30
Posts: 940

Re: Openbox rc.xml and Pulseaudio Volume Control [SOLVED]

Another thing you have to keep in mind is that those scripts were meant for zsh (and they apparently also work for bash).  However, I am not sure which interpreter Openbox is using.  Maybe it's using sh, which might not work with this script?


Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1

Offline

#4 2011-03-06 22:36:55

hardran3
#! Junkie
From: forest town, lake land
Registered: 2011-02-26
Posts: 360

Re: Openbox rc.xml and Pulseaudio Volume Control [SOLVED]

chaanakya wrote:

Another thing you have to keep in mind is that those scripts were meant for zsh (and they apparently also work for bash).  However, I am not sure which interpreter Openbox is using.  Maybe it's using sh, which might not work with this script?

The other scripts on that page were for zsh, these were universal. Doesn't matter anyways, I got it working in a much simpler way.

Last edited by hardran3 (2011-03-06 23:17:47)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo