You are not logged in.

#1 2009-08-26 19:42:49

clementis
Member
Registered: 2009-08-26
Posts: 37

Xmodmap audio keys not working

Hello,

this is my first post in this forum and I hope that someone can help me with my problem.

I use a Dell M4400 notebook with XFCE.

Linux doux 2.6.30-ARCH #1 SMP PREEMPT Fri Jul 31 18:10:38 UTC 2009 i686 Intel(R) Core(TM)2 Duo CPU T9550 @ 2.66GHz GenuineIntel GNU/Linux

Since a couple of weeks I try to get my multimedia keys, primary the audio keys (mute,...), to work with xmodmap.

I read the WIKI (http://wiki.archlinux.org/index.php/Extra_Keyboard_Keys, http://wiki.archlinux.org/index.php/Ext … ys_in_Xorg about getting these keys working. I also informed me on this http://cweiske.de/howto/xmodmap/allinone.html.

$xev

keycode 121 (keysym 0x1008ff12, XF86AudioMute)
keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume)
keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume)

~/.Xmodmap

xmodmap ~/.Xmodmap
keycode 121 =  XF86AudioMute
keycode 123 =  XF86AudioRaiseVolume
keycode 122 =  XF86AudioLowerVolume

.Xmodmap is loaded through ~/.xprofile

xmodmap ~/.Xmodmap

$ xmodmap -pke | grep XF86Audio

keycode 121 = XF86AudioMute
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
keycode 171 = XF86AudioNext NoSymbol XF86AudioNext NoSymbol XF86AudioNext
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
keycode 173 = XF86AudioPrev NoSymbol XF86AudioPrev NoSymbol XF86AudioPrev
keycode 174 = XF86AudioStop XF86Eject XF86AudioStop XF86Eject XF86AudioStop XF86Eject
keycode 175 = XF86AudioRecord NoSymbol XF86AudioRecord NoSymbol XF86AudioRecord
keycode 176 = XF86AudioRewind NoSymbol XF86AudioRewind NoSymbol XF86AudioRewind
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay NoSymbol XF86AudioPlay
keycode 209 = XF86AudioPause NoSymbol XF86AudioPause NoSymbol XF86AudioPause
keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay NoSymbol XF86AudioPlay
keycode 234 = XF86AudioMedia NoSymbol XF86AudioMedia NoSymbol XF86AudioMedia

What I don't understand is why showkey on e.g. TTY 5 returns completely different keycodes.

keycode 113 press
keycode 113 release
keycode 115 press
keycode 115 release
keycode 114 press
keycode 114 release

If I try
$ xmodmap -e "keycode 121=c"
and then press the mute button a "c" will be printed.

$ xmodmap -e "keycode 121=XF86AudioMute"
nothing happens on youtube, mplayer, exaile, vlc,... when I press mute.

So, I hope that maybe you can help me because the audio keys don't work with xmodmap!

I know that we can use keytouch but I'd like to do it manualy. Xbindkeys is another way to get multimedia keys working, but I don't need this app when using xmodmap. Right?

Thank you for any help!

Clementis

Offline

#2 2009-08-26 20:15:04

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Xmodmap audio keys not working

clementis wrote:

this is my first post in this forum and I hope that someone can help me with my problem.
...
What I don't understand is why showkey on e.g. TTY 5 returns completely different keycodes.

Because the key handling in the linux console is completely separate from the keyhandling in X. With xmodmap you've only made a change in X. It won't show up in the console. (It's also possible to make changes to keymappings in the console; those don't show up in X, either.)

If I try
$ xmodmap -e "keycode 121=c"
and then press the mute button a "c" will be printed.

$ xmodmap -e "keycode 121=XF86AudioMute"
nothing happens on youtube, mplayer, exaile, vlc,... when I press mute.

XF86AudioMute is just a symbolic name for a key, same as "c" is. You have to have some program listening that does something when the key with that symbolic name is pressed. You will need to use something like Xbindkeys or the like to respond to the keypress. If you use a desktop environment like Xfce or Gnome, there will be a "keyboard" preference pane in your Application menu somewhere (perhaps under settings), you should be able to configure that preference pane to run a command when you press XF86AudioMute. I don't remember offhand what the command you need is, but you should have come across this while googling or in the wiki.

EDIT: or you can go to the preferences of Exaile, VLC and so on, and see whether they let you change keybindings, and you can probably press your mute button there and they'll recognize it as a key you can assign to any of the commands they provide. (You can make it fast-forward if you want; there's no intrinsic requirement that it mutes the volume. I admit I would have expected them to have this keybinding already set up by default, though.)

Last edited by Profjim (2009-08-26 20:18:03)

Offline

#3 2009-08-26 21:59:43

clementis
Member
Registered: 2009-08-26
Posts: 37

Re: Xmodmap audio keys not working

I've now installed xbindkeys and created the .xbindkeysrc in my home directory.

"(Scheme function)"
    m:0x0 + c:121
    XF86AudioMute
"(Scheme function)"
    m:0x0 + c:123
    XF86AudioRaiseVolume
"(Scheme function)"
    m:0x0 + c:122
    XF86AudioLowerVolume

I'm not quite sure if this configuration is correct. What about the "(Scheme function)" entry?
Unfortunately I don't find helpful information quickly.

I tried also

"amixer sset PCM togugle"
    m:0x0 + c:121
    XF86AudioMute
"amixer sset PCM 2+"
    m:0x0 + c:123
    XF86AudioRaiseVolume
"amixer sset PCM 2-"
    m:0x0 + c:122
    XF86AudioLowerVolume

but without luck.

I'd like to control the audio, respectively the volume, in every possible application.
Do I have to make some changes to the config file?

Thanks!

Clementis

Last edited by clementis (2009-08-26 22:24:20)

Offline

#4 2009-08-28 13:53:03

clementis
Member
Registered: 2009-08-26
Posts: 37

Re: Xmodmap audio keys not working

Can someone please help me with the configuration issue?

Any hint, web site, ... is welcome - of course! ;o)

Thank you!

Offline

#5 2009-08-28 14:36:04

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Xmodmap audio keys not working

i used xbindkeys -k to get the keycommands, your second entry is the proper function definition, but my media keys were found as Mod2 +XF86WhatEver so maybe try that?

--/snip/--

"(mpc next)"
    m:0x10 + c:171
    Mod2 + XF86AudioNext

"(/home/patrick/.bin/ossvol -t)"
    m:0x10 + c:121
    Mod2 + XF86AudioMute

--/snip/--

/edit: also, dont forget to /start/ xbindkeys (via cli or .xinitrc) or this file is useless wink

Last edited by brisbin33 (2009-08-28 14:36:30)

Offline

#6 2009-08-28 20:13:34

clementis
Member
Registered: 2009-08-26
Posts: 37

Re: Xmodmap audio keys not working

Thank you both for your help!

I now use the following configuration and found useful information in the Gentoo Wiki (http://www.gentoo-wiki.info/HOWTO_Use_Multimedia_Keys

"amixer set Master toggle"
    m:0x0 + c:121
    XF86AudioMute
"amixer set PCM 2dB+"
    m:0x0 + c:123
    XF86AudioRaiseVolume
"amixer set PCM 2dB-"
    m:0x0 + c:122
    XF86AudioLowerVolume

Once again, thanks!

Clementis

Offline

Board footer

Powered by FluxBB