SEARCH

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

You are not logged in.

#1 2009-06-18 18:48:37

manic111
New Member
Registered: 2009-06-14
Posts: 8

HowTo: Configure your multimedia keys for Exaile

Not being able to use my keyboard's multimedia keys in Crunchbang has been a real bugbear of mine, so I decided, with some help from  becatlibra's post in the CrunchEee support thread, to sort it out myself. This config will only work with Exaile, although I expect that if you change the commands in the rc.xml slightly it should work with other media players as well.

1/ Create a ".Xmodmap" text file in /home/username

This should contain:

keycode 121 = XF86AudioMute
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
keycode 171 = XF86AudioNext
Keycode 172 = XF86AudioPlay
Keycode 173 = XF86AudioPrev
Keycode 174 = XF86AudioStop

Save the file.

2/ sudo gedit ~/.config/openbox/rc.xml

Add the following into the "keyboard" section of the text file (between the lines " </keyboard>" and " </keybind>")

   <keybind key="XF86AudioLowerVolume">
     <action name="Execute">
       <command>amixer sset PCM,0 5%-</command>
     </action>
   </keybind>
   <keybind key="XF86AudioMute">
     <action name="Execute">
       <command>amixer sset iSpeaker,0 toggle</command>
     </action>
   </keybind>
   <keybind key="XF86AudioNext">
   <action name="Execute">
   <command>exaile -n</command>
   </action>
   </keybind>
      <keybind key="XF86AudioPlay">
   <action name="Execute">
   <command>exaile -t</command>
   </action>
   </keybind>
      <keybind key="XF86AudioPrev">
   <action name="Execute">
   <command>exaile -p</command>
   </action>
   </keybind>
      <keybind key="XF86AudioStop">
   <action name="Execute">
   <command>exaile -s</command>
   </action>
   </keybind>

Save the file.

3/ Right click on your desktop, navigate through Preferences and Openbox Config to your autostart.sh file. Add this line to it:

xmodmap /home/username/.Xmodmap

Save the file and restart Openbox.

Hope it works as well for you as it has for me big_smile

Offline

Help fund CrunchBang, donate to the project!

#2 2009-06-19 01:59:56

jackbang
#! CrunchBanger
Registered: 2009-05-28
Posts: 244

Re: HowTo: Configure your multimedia keys for Exaile

Excellent info, thanks.  Where did you get the keycodes from, is there a utility to scan for them?
My volume keys aren working, and I also don get any errors in dmesg, so I have no idea what their keycodes are, or if they are even generating any event.

Also wheres the best place to change keyboard - I can put xetxkbmap in xinitrc or somewhere, but that doesnt seem right - surely setxkbmap is executed per session, or at server startup  anyway, and must read a configuration variable from somewhere?  I think it used to be in xorg.conf, but not sure that works anymore.
EDIT:  Doh.  You change keyboard layout in the openbox autostart.sh script too.

Now, to define pound and euro on my US intl keyboard, ideally using right-alt-$ and right-alt3-e ....

Last edited by jackbang (2009-06-19 02:40:25)

Offline

#3 2009-06-19 02:36:11

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 8,904

Re: HowTo: Configure your multimedia keys for Exaile

You use xev to get the keycodes. You can find some info about using it in this thread:

http://crunchbanglinux.org/forums/topic … e-buttons/


Note: ** Please read before posting **

BTW if you wish to contact me, send me an e-mail instead of a PM.

Offline

#4 2009-06-19 03:13:12

jackbang
#! CrunchBanger
Registered: 2009-05-28
Posts: 244

Re: HowTo: Configure your multimedia keys for Exaile

Thanks, very useful thread.  The amixer commands above might need changing for some people, I have

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

Unfortunately the lxpanel volume control doesn't update itself with the current state.  oh well, physical buttons are easier anyway.

Offline

#5 2009-06-19 04:31:12

jackbang
#! CrunchBanger
Registered: 2009-05-28
Posts: 244

Re: HowTo: Configure your multimedia keys for Exaile

Sorry to hijack the thread into general xmodmap discussion.
I just added euro, pound, yen, as right-alt-e, right-alt-#, right-alt-y, on my keyboard.
I had to map the right-alt key to generate Mode_switch instead of ISO_Level3_Shift.  I don't know if this will have other bad effects, I don't know what ISO_Level3_Shift is used for.

If I do xmodmap -pke I get lines like

keycode  26 = e E e E e E

AFAIK the keysyms are supposed to be in order, "e", "shift e", "Mode-switch e", "Mode_switch + shift e", "ISO_Level3_Shift e", "ISO_Level3_Shift + shift e".
My right-alt key generated ISO_Level3_Shift under xev, so it should just be a case of changing the 5th and or 6th columns to be EuroSign.  Unfortunately this just didn't work, so I changed the right-alt key to generate Mode_switch.

.Xmodmap:

keycode 108 = Mode_switch
keycode 26 = e E EuroSign EuroSign
keycode 29 = y Y yen yen
keycode 12 = 3 numbersign sterling sterling

This seems a hit hackish to me, is there a better way?

Last edited by jackbang (2009-06-19 04:45:19)

Offline

#6 2009-06-20 13:13:53

manic111
New Member
Registered: 2009-06-14
Posts: 8

Re: HowTo: Configure your multimedia keys for Exaile

jackbang wrote:

Unfortunately the lxpanel volume control doesn't update itself with the current state.  oh well, physical buttons are easier anyway.

No, bit of a shame but I have no idea how to do that! If anyone's got any suggestions that would be awesome big_smile

Offline

#7 2009-08-23 15:27:54

jinnstar
#! CrunchBanger
From: Gurnee, IL
Registered: 2009-07-19
Posts: 194

Re: HowTo: Configure your multimedia keys for Exaile

Here are the keybindings for MOC, Audacious, Banshee and Exaile. These are aimed at those of us with multimedia led keys on laptops.

Banshee

<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>amixer sset Master,0 toggle</command>
      </action>
    </keybind>
    <keybind key="XF86AudioNext">
      <action name="Execute">
        <command>banshee --next</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPlay">
      <action name="Execute">
        <command>banshee --toggle-playing</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPrev">
      <action name="Execute">
        <command>banshee --previous</command>
      </action>
    </keybind>
    <keybind key="XF86AudioStop">
      <action name="Execute">
        <command>banshee --stop</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPause">
      <action name="Execute">
        <command>banshee --toggle-playing</command>
      </action>
    </keybind>

Exaile

<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>amixer sset Master,0 toggle</command>
      </action>
    </keybind>
    <keybind key="XF86AudioNext">
      <action name="Execute">
        <command>exaile -n</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPlay">
      <action name="Execute">
        <command>exaile -t</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPrev">
      <action name="Execute">
        <command>exaile -p</command>
      </action>
    </keybind>
    <keybind key="XF86AudioStop">
      <action name="Execute">
        <command>exaile -s</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPause">
      <action name="Execute">
        <command>exaile -t</command>
      </action>
    </keybind>

MOC

<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>amixer sset Master,0 toggle</command>
      </action>
    </keybind>
    <keybind key="XF86AudioNext">
      <action name="Execute">
        <command>mocp -f</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPlay">
      <action name="Execute">
        <command>mocp -G</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPrev">
      <action name="Execute">
        <command>mocp -r</command>
      </action>
    </keybind>
    <keybind key="XF86AudioStop">
      <action name="Execute">
        <command>mocp --stop</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPause">
      <action name="Execute">
        <command>mocp -G</command>
      </action>
    </keybind>

Audacious

<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer sset Master,0 3%-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>amixer sset Master,0 toggle</command>
      </action>
    </keybind>
    <keybind key="XF86AudioNext">
      <action name="Execute">
        <command>audacious -f</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPlay">
      <action name="Execute">
        <command>audacious -p</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPrev">
      <action name="Execute">
        <command>audacious -r</command>
      </action>
    </keybind>
    <keybind key="XF86AudioStop">
      <action name="Execute">
        <command>audacious -s</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPause">
      <action name="Execute">
        <command>audacious -t</command>
      </action>
    </keybind>

Last edited by jinnstar (2009-08-23 15:31:14)

Offline

#8 2009-09-03 12:47:59

SyntaXmasteR
New Member
From: B&H
Registered: 2009-09-02
Posts: 4

Re: HowTo: Configure your multimedia keys for Exaile

I can confirm that multimedia led keys also work with Sonata, with adding keybinding in  rc.xml.

    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <execute>amixer -c 0 set Master 5%- unmute</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <execute>amixer -c 0 set Master 5%+ unmute</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <execute>amixer -c 0 set Master mute</execute>
      </action>
      <action name="Execute">
        <execute>amixer -c 0 set Master unmute</execute>
      </action>
    </keybind>

Offline

#9 2009-10-26 19:24:34

brummbaer
Member
From: portland, or
Registered: 2009-10-16
Posts: 47
Website

Re: HowTo: Configure your multimedia keys for Exaile

easiest solution i've found for this is to use xbindkeys and the gui editor xbindkeys-config, which makes managing custom keys a breeze.


Hell, there are no rules here - we're trying to accomplish something.  - T. A. Edison
http://www.grendelchen.com/  | brummbaer456 at gmail dot com

Offline

#10 2009-11-13 11:09:35

nanomagnetic
Member
From: cascadia
Registered: 2009-10-26
Posts: 15

Re: HowTo: Configure your multimedia keys for Exaile

brummbaer wrote:

easiest solution i've found for this is to use xbindkeys and the gui editor xbindkeys-config, which makes managing custom keys a breeze.

For some reason the XML doesn't seem to process the XF86 signals for me; I can't get any XF86 key to send commands to the command line. However, xbindkeys works, though the GUI is kinda ugly. Not that looks count with such easy functionality.

For now I'm stuck with a laggy command "volwheel -*" but now I can zap those damn ads on Hulu every time they jump up with their extra loud volume!

Offline

#11 2010-12-28 13:14:44

achristoffersen
#! Junkie
Registered: 2009-03-23
Posts: 354

Re: HowTo: Configure your multimedia keys for Exaile

SyntaXmasteR wrote:

I can confirm that multimedia led keys also work with Sonata, with adding keybinding in  rc.xml.

Excellent. Thanks a bunch.

I just changed "Master" to "PCM" as amixer don't recognise master in my system. Also - some people like to unmute the sound when the change the volume. If so one can just add the "unmute" command, like so.

amixer sset PCM,0 3%+ unmute

Again - thanks a lot!

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.

Debian Logo