You are not logged in.

#1 2009-01-23 09:01:17

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Binding XF86 volume controls to keys in Awesome [SOLVED]

Hey there!

I tried doing a keybinding by Xmodmap, but it disabled my keybindings set for Awesome. How can I add volume control to Fn+F7-F9 within Awesome as to not disable other stuf?

Thanks in advance.

Last edited by Thoht (2009-01-24 21:03:31)


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

#2 2009-01-23 09:38:21

u_no_hu
Member
Registered: 2008-06-15
Posts: 453

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Try xbindkeys.


Don't be a HELP VAMPIRE. Please search before you ask.

Subscribe to The Arch Daily News.

Offline

#3 2009-01-23 10:32:00

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

No need for xbindkeys. You can use xmodmap. See the wiki for details. There are some examples there. If they dont work use xev to found out the keycodes you have to use.

Last edited by dolby (2009-01-23 10:34:38)


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#4 2009-01-23 14:41:49

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Haven't tried xbindkeys yet, but xmodmap disabled my Awesome (wm) keybindings. Is there a way around that? I used showkey to find the keycodes.


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

#5 2009-01-23 15:28:54

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

You should provide examples of what you are trying to do. Xmodmap does merely assign a X11 code to a keycode. If you work on keys which have not yet a X11 code this can not interphere with awesome keybindings. If there is an interpherence, then you are remapping an already mapped key.
Xbindkeys is different because it can directly map keycodes to actions, without the need of a X11 code.


Mortuus in anima, curam gero cutis

Offline

#6 2009-01-24 07:21:54

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

What I did was at first using showkeys in console to find my keycodes which gave me the codes 113, 114 and 115. I created a file in my home directory containing the following:

keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
keycode 121 = XF86AudioMute

I then ran this command as instructed by the wiki article:

> xmodmap .Xmodmap

After that all my Awesome keybindings were blocked and I had to exit X in order to remove that file and then restart X again.The second time I tried xev, more specifically:

> xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'

Which gave me this response:

122 XF86AudioLowerVolume
123 XF86AudioRaiseVolume
121 XF86AudioMute

Now I tried creating a .Xmodmap file just like the other time but with these codes instead. This time though nothing happens at all.

Any ideas?


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

#7 2009-01-24 07:43:11

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Skip the showkey part at all, enter X without any xmodmap command and use plain xev to detect the keycodes and the eventual keysymname of the keys. If - as I suspect - the keys already have a keysymname, there is no need to use xmodmap for those keys. In the latest xorg release many keys previously unmapped got a keysymname.


Mortuus in anima, curam gero cutis

Offline

#8 2009-01-24 07:50:20

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Well yes, it would seem that they already had a keysymname according to xev, but pressing the key combination does nothing. Perhaps I need another program in order to control the volume at all?


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

#9 2009-01-24 07:51:55

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

The Brightness adjustment keys work though. Perhaps this has something to do with ALSA? I tried using the keys in ncmpc but only the left and right arrow keys work there.


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

#10 2009-01-24 10:41:16

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

The keysymnames do nothing (they are just names), you have to bind the keysymnames to the commands which change the volume (e.g. 'amixer set Master 3%+' to raise it, but check 'man amixer').
This can be done through your WM or through xbindkeys.
The brightness keys perhaps are controlled by the BIOS, so they work out of the box smile
In order to exclude problems with alsa itself, just use alsamixer from a terminal window and see if that works. If it works, alsa is innocent.


Mortuus in anima, curam gero cutis

Offline

#11 2009-01-24 16:24:56

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Some programs, such as sonata, also automatically grab keys with certain names in order to provide functionality, and you can bind most keys with xbindkeys. Merely naming them, however, should have no effect.

Edit: By effect, I mean effect on what they do when pressed.

Last edited by SamC (2009-01-24 16:25:25)

Offline

#12 2009-01-24 19:51:27

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Thoht wrote:

How can I add volume control to Fn+F7-F9 within Awesome as to not disable other stuf?

How do you manage to use awesome without even knowing to add the simplest form of keybindings? You can bind keys in awesome either by their keycode or by their X binding.

Awesome 3

keybinding({}, "#122", function () awful.util.spawn("amixer -q sset PCM 2dB-") end):add()
keybinding({}, "#123", function () awful.util.spawn("amixer -q sset PCM 2dB+") end):add()
keybinding({}, "XF86AudioMute", function () awful.util.spawn("amixer -q sset Master toggle") end):add()

Awesome 2

key { modkey = {} key = "#122"  command = "spawn" arg = "amixer -q sset PCM 2dB-" }
key { modkey = {} key = "#123"  command = "spawn" arg = "amixer -q sset PCM 2dB+" }
key { modkey = {} key = "XF86AudioMute"  command = "spawn" arg = "amixer -q sset Master toggle" }

You need to install an RTFM interface.

Offline

#13 2009-01-24 21:00:50

Thoht
Member
From: Sweden
Registered: 2008-02-02
Posts: 75

Re: Binding XF86 volume controls to keys in Awesome [SOLVED]

Thanks to all three of you, I think I got it now. I thought the keysymname was the function... roll The code provided worked like a charm. smile


Credit to KiwiesRuleXD @ DeviantArt for the avatar.

Offline

Board footer

Powered by FluxBB