You are not logged in.

#1 2010-06-13 10:41:06

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

Multimedia Keys in Awesome Window Manager [SOLVED]

Hey,

I've googled, searched, grepped and scanned about this for weeks, and I think I can't get it working on my own, although I'm sure the right answer is just out there waiting to be found, and one of you brighter minds might just know it already. Right, here's what happens.

I was using openbox, and the keybindings were working just fine. This should probably discard missing symbols or scancodes for the keys, IMHO. Then I switch over to Awesome, and fall in love. The awesome (pun intended) config files by anrxc made it even better, and these days I can't live without my awesome. But I also wanted my volume keys to work. Not like I mind opening a terminal and popping alsamixer... I got 15 of them open all the time anyway. But I still wanted to use the fancy buttons.

The strange thing is, the keys seem to "disappear" as soon as I map them somewhere. I've tried binding them in rc.lua:

awful.key({}, "#121",  function () exec("pvol.py -m", false) end),
awful.key({}, "#122",  function () exec("pvol.py -c -2", false) end),
awful.key({}, "#123",  function () exec("pvol.py -c 2", false) end),

pvol.py is a script (made by anrxc too) that does stuff to the volume and displays a cute gtk progress bar to indicate current volume level. Invoking it from the terminal works fine.

I also tried using xbindkeys:

"pvol.py -m"
    XF86AudioMute

"pvol.py -c -2"
    XF86AudioLowerVolume

"pvol.py -c 2"
    XF86AudioRaiseVolume

But the result was the same. Here's the output of xev with the keys unbound:

KeyPress event, serial 25, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4706773, (74,267), root:(796,288),
    state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4706853, (74,267), root:(796,288),
    state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4712422, (74,267), root:(796,288),
    state 0x10, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4712534, (74,267), root:(796,288),
    state 0x10, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4713862, (74,267), root:(796,288),
    state 0x10, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1600001,
    root 0x15a, subw 0x0, time 4713878, (74,267), root:(796,288),
    state 0x10, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

As you can see, they respond to the key codes 121. 122, and 123. Going to a console and running showkey, however, gives me the key codes 113, 114, and 115. I've tried mapping both, and the X11 symbols, with the same result. Below, a sample of xev's output when I bind the keys somewhere (out put for a single key, all result in the same output):

FocusOut event, serial 29, synthetic NO, window 0x1600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 29, synthetic NO, window 0x1600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 29, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

And of course, nothing happens. The same happens whether I bind the keys in awesome or through xbindkeys. I have to admit, I'm pretty much out of ideas. Anyone seen this before?

Last edited by mkaito (2010-06-16 15:06:06)


Fear me! I have root! Sometimes...

Offline

#2 2010-06-13 11:07:22

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

Is pvol.py in /usr/bin or somesuch?

Here's what I use, in globalkeys:

awful.key({}, "#122", function () awful.util.spawn("vol down 10") end),
    awful.key({}, "#123", function () awful.util.spawn("vol up 10") end),
    awful.key({}, "#121", function () awful.util.spawn("vol mute") end),

Offline

#3 2010-06-13 13:00:07

d2ogch3n
Member
Registered: 2010-01-20
Posts: 42

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

Here's what I have

    -- Multimedia keys
    awful.key({ }, "XF86AudioRaiseVolume",    function () awful.util.spawn("amixer set Master 2+") end),
    awful.key({ }, "XF86AudioLowerVolume",    function () awful.util.spawn("amixer set Master 2-") end)

Offline

#4 2010-06-13 15:14:16

Mic92
Member
From: Germany
Registered: 2009-07-05
Posts: 21
Website

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

You can use the volume widget from vicious (which is maintained by anrxc) to visualize the state. I can control my volume with keybindings and mouse too. Here is my config: http://github.com/Mic92/awesome-dotfile … wesome.lua
Search for volumewidget and volumebar.

Offline

#5 2010-06-13 19:08:39

tum
Member
Registered: 2010-05-18
Posts: 40

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

Have you tried "xbindkeys -k" for multimedia key  ? It gives two lines , for example for "g" :

    m:0x0 + c:42
    g

Try both lines in your .xbindkeysrc :

"pvol.py -m"
    XF86AudioMute
    your second line

Offline

#6 2010-06-16 15:05:13

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

Turns out, it had little to do with AWM at all, but rather me being a little stupid. pvol.py was in ~/src/bin, which was added to the $PATH in my zshrc file. Obviously, AWM had no clue about this and couldn't find pvol. Calling it with the full path made it work.


Fear me! I have root! Sometimes...

Offline

#7 2013-12-16 01:36:52

BleuCadet
Member
From: Texas
Registered: 2013-12-16
Posts: 3

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

d2ogch3n wrote:

Here's what I have

    -- Multimedia keys
    awful.key({ }, "XF86AudioRaiseVolume",    function () awful.util.spawn("amixer set Master 2+") end),
    awful.key({ }, "XF86AudioLowerVolume",    function () awful.util.spawn("amixer set Master 2-") end)

Just to clarify for anyone who comes across this, "%" is needed after the number. It should be:

awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+") end),
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-") end)

You should also be able to add Mute functionality:

awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") end)

Also, to get rid of the loading cursor, pass false as a second argument to all three of these:

awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+", false) end),
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-", false) end)
awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle", false) end)


The AWM wiki is the source for this:
http://awesome.naquadah.org/wiki/Volume … nd_display

Offline

#8 2013-12-16 14:10:22

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Multimedia Keys in Awesome Window Manager [SOLVED]

Thank you BleuCadet, I am sure that will help others who come across this thread. I am closing this thread to prevent replies in here. Further discussion should be in its own thread. Please see, Forum Etiquette: Old Threads / Necro-Bumping.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

Board footer

Powered by FluxBB