You are not logged in.

#1 2008-01-02 11:07:24

bionnaki
Member
Registered: 2006-09-05
Posts: 289

mute/volume buttons in openbox

hello. I am new to archlinux & fluxbox as well. I have 99% of everything setup except for a few keyboard buttons. how can I enable my mute/volume up/volume down keyboard buttons? I have a simple 105-us keyboard - nothing fancy.

Last edited by bionnaki (2008-01-07 07:17:34)

Offline

#2 2008-01-02 12:02:52

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: mute/volume buttons in openbox

I suggest using xbindkeys, though there are numerous other options. Check out the wiki pages http://wiki.archlinux.org/index.php/Hotkeys and http://wiki.archlinux.org/index.php/Extra_Keyboard_Keys. Also read upon http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys if you like.

Offline

#3 2008-01-03 02:21:25

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: mute/volume buttons in openbox

thanks.
I was able to get the volume up / down to work, but not the mute button. what worked was placing

keycode 160 = XF86AudioMute
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

in ~/.Xmodmap and then running "xmodmap ~/.Xmodmap"
and then placing "xmodmap ~/.Xmodmap &" in ~/.xinitrc

but the mute doesnt work. perhaps the keycode for mute is incorrect, but when I run xev or xbindkeys -mk to find the correct keycode, I get no output when I press either of those three buttons. not exactly sure what that means.

Last edited by bionnaki (2008-01-03 02:23:21)

Offline

#4 2008-01-03 09:35:58

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: mute/volume buttons in openbox

try to find the correct keycode by using

showkey -k

from console. You probably need to kill your X session first for it to work.

Offline

#5 2008-01-05 12:42:31

Stoffi
Member
Registered: 2007-03-15
Posts: 107

Re: mute/volume buttons in openbox

why not do it thoug fluxbox?
add this to ~/.fluxbox/keys:
None XF86AudioLowerVolume :ExecCommand amixer -q set Master 2- unmute
None XF86AudioMute :ExecCommand amixer -q set Master toggle
None XF86AudioRaiseVolume :ExecCommand amixer -q set Master 2+ unmute

I am a total newbie at both linux and arch, so I can't guantee it will work.

adding .Xmodmap to xinitrc sholdn't be necesary if I have understood things right.

about your mute key, maybe the keycode isn't 160?
I used xev (from aterm) to find the right keycode, but it doesn't seem to work anymore for those 3 keys I set up hmm

Offline

#6 2008-01-07 07:28:34

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: mute/volume buttons in openbox

ok. I am thoroughly confused. I am using openbox now, by the way - not that it makes much difference. I did a fresh install and I'm trying this again and not having any luck. maybe someone can make sense of this...

I ran showkey -k and the codes were shown:

mute: 113
up: 115
down: 114

I did the xmodmap method with these different key codes, but it didnt work. the other codes (160, 176, 174 respectively) do produce up/down volume but the mute button doesnt work.

I installed xbindkeys following the wiki: http://wiki.archlinux.org/index.php/Hot … tions_in_X

I received these codes using xbindkeys -mk

mute: m:0x10 + c:160
up: m:0x10 + c:176
down: m:0x10 + c:174

I put this into my .xbinkdekysrc

# vol mute
"amixer set Master mute"
  m:0x10 + c:160
# vol up
"amixer set Master 2dB+ unmute"
  m:0x10 + c:176
# vol dn
"amixer set Master 2dB- unmute"
  m:0x10 + c:174

restarted x and I can bring the volume up and down (still no mute, though) but when the volume levels are brought to 0% (silence) they cannot be raised. this also happens when I change .xbindkeysrc to PCM rather than Master.

what am I doing wrong? I'm tired of going into alsamixer to turn music down/up smile

Offline

#7 2008-01-08 07:36:54

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: mute/volume buttons in openbox

ok. I figured out the issue where if I lowered the volume to 0% it would remained muted. I edited .xbinkdekysrc to read

# vol mute
"amixer set Master mute"
  m:0x10 + c:160
# vol up
"amixer set Master 2dB+"
  m:0x10 + c:176
# vol dn
"amixer set Master 2dB-"
  m:0x10 + c:174

...just had to get rid of unmute.

but the mute button still does not work. total mystery at this point.

edit:

figured a quick hack to "mute" alsa:

I changed "amixer set Master mute" to "amixer set Master 100%-"

basically that just drops the volume to 0% and I can raise the volume back up with the volume-up button. kinda dirty, but it works. I wish I could just toggle the sound on/off rather than doing this though...

I think mute and toggle are not proper commands for amixer..and I'm not sure what the actual command is...

Last edited by bionnaki (2008-01-08 08:00:43)

Offline

#8 2008-01-08 08:19:17

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,899
Website

Re: mute/volume buttons in openbox

http://bbs.archlinux.org/viewtopic.php?id=9165 just to confuse matters more....

http://linux.seindal.dk/2004/08/30/sawf … launchers/ check mute function [had to load aumix-gtk but you may have that already!]

Yeah I should say add it to .bashrc :-)

keep with it some things just take a little more effort but they are worth it :-)

Last edited by Mr Green (2008-01-08 09:26:32)


Mr Green

Offline

#9 2008-02-09 17:09:20

Bob-Hur
Member
Registered: 2007-12-09
Posts: 43

Re: mute/volume buttons in openbox

I don't know how much this will carry over from Fluxbox to Openbox, but I finally got keyboard control of volume down, volume up, and mute on/off by using this in my .fluxbox/keys file

none  78 :MacroCmd { ExecCommand amixer sset 'Analog Front' 2+ }
none 111 :MacroCmd { ExecCommand amixer sset 'Analog Front' 2- }
none 110 :MacroCmd { ExecCommand amixer sset 'Analog Front' toggle }

Note: These codes are for the PrintScreen, ScrollLock and Pause keys on an IBM Model M keyboard, but the alsamixer commands should work with other keys - the command syntax was the part that was causing me difficulties.

Offline

#10 2008-12-18 22:02:47

dhave
Arch Linux f@h Team Member
From: Outside the matrix.
Registered: 2005-05-15
Posts: 1,112

Re: mute/volume buttons in openbox

(reviving an old thread)

Since the subject mentions setting the mute/volume buttons in openbox, I thought I'd put the openbox config info needed for a Thinkpad, or at least for my T61p setup:

Put this in ~/.config/openbox/rc.xml:

    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
    <execute>amixer sset PCM 1+</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
    <execute>amixer sset PCM 1-</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
    <execute>amixer sset PCM 0</execute>
      </action>
    </keybind>

Two comments:

(1) Don't put quotes around the command string for amixer.

(2) I'm using the PCM control; other controls options which may work for your setup or your sound card or driver.

Last edited by dhave (2008-12-18 22:08:50)


Donate to Arch!

Tired? There's a nap for that. --anonymous

Offline

#11 2008-12-19 05:03:29

bslagowski
Member
Registered: 2008-02-23
Posts: 102

Re: mute/volume buttons in openbox

amixer set Master toggle

Where master is your volume. That works for me, at least. smile

Offline

#12 2009-05-05 22:39:12

madnerves
Member
Registered: 2008-03-13
Posts: 20

Re: mute/volume buttons in openbox

Hi there,  Sorry to bring this topic back, since it has not been updated for a couple of months but i think it's good for newbie to know this.

I had a problem with the mute buttons. In fact, when you put it at 0, there was still some music.
So here is my solution :
<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
    <execute>amixer sset Master 1+</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
    <execute>amixer sset Master 1-</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
    <execute>amixer sset Master toggle</execute>
      </action>
    </keybind>

I simply replaced the last "execute" with toggle instead of 0, because this simply "toggle" from mute to unmute as its name tells it.
More, i changed PCM to Master because on my laptop, when I put PCM upper than 81, 83%, there are some noise and it produces bad sounds. So I did this changes.

Hope it would help people, and hope i will be understood.

Offline

#13 2009-05-06 03:12:12

soupcan
Member
From: ?
Registered: 2008-10-25
Posts: 268

Re: mute/volume buttons in openbox

madnerves wrote:

Hi there,  Sorry to bring this topic back, since it has not been updated for a couple of months but i think it's good for newbie to know this.

I had a problem with the mute buttons. In fact, when you put it at 0, there was still some music.
So here is my solution :
<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
    <execute>amixer sset Master 1+</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
    <execute>amixer sset Master 1-</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
    <execute>amixer sset Master toggle</execute>
      </action>
    </keybind>

I simply replaced the last "execute" with toggle instead of 0, because this simply "toggle" from mute to unmute as its name tells it.
More, i changed PCM to Master because on my laptop, when I put PCM upper than 81, 83%, there are some noise and it produces bad sounds. So I did this changes.

Hope it would help people, and hope i will be understood.

Ooops. I didn't read carefully enough. Sorry. Disregard this post.

Last edited by soupcan (2009-05-06 03:13:12)

Offline

#14 2009-05-06 08:42:52

madnerves
Member
Registered: 2008-03-13
Posts: 20

Re: mute/volume buttons in openbox

???
Something is wrong with my solution? roll

Last edited by madnerves (2009-05-06 08:43:09)

Offline

Board footer

Powered by FluxBB