You are not logged in.

#1 2013-05-12 14:47:49

madsravn
Member
Registered: 2013-05-12
Posts: 22

[Lenovo Thinkpad T510] Multimedia key help

Hi,

I'm pretty new to this arch linux. So far it rocks. I love that I need to do a lot myself compared to Ubuntu. It really feels like the next logical step on my linux journey.

However, with my Lenovo Thinkpad T510 the multimedia keys (volume up/down and mute especially) worked just fine under Debian Gnome3. I wasn't expecting them to work out of the box, especially not with awesome wm. But I don't know how to fix them - I don't really know what to search for. Can anyone help me - point me to some information on the subject.

I have a shot of the buttons in case you don't know which I'm talking about.
http://i.imgur.com/0hDWBFH.png

best regards,
Mads Ravn


moderator edit:  Changed image tags to url tags on oversized picture

Last edited by ewaller (2013-05-12 15:04:38)

Offline

#2 2013-05-12 14:59:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Lenovo Thinkpad T510] Multimedia key help

Offline

#3 2013-05-12 15:07:07

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,671

Re: [Lenovo Thinkpad T510] Multimedia key help

Madsravn,
Welcome to Arch Linux.  Please watch the size of pictures you post in line. See our policy
Thanks.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2013-05-12 15:12:31

madsravn
Member
Registered: 2013-05-12
Posts: 22

Re: [Lenovo Thinkpad T510] Multimedia key help

Thanks a lot smile Will look into that.

ewaller wrote:

Madsravn,
Welcome to Arch Linux.  Please watch the size of pictures you post in line. See our policy
Thanks.

I'm sorry. I'll remember to resize it beforehand the next time.

Offline

#5 2013-05-12 15:14:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,671

Re: [Lenovo Thinkpad T510] Multimedia key help

What Desktop Environment are you using?
After you identify the key codes that are generated (as provided by Karol's link) , you can use a tool such as xbindkeys to tie those key codes to simple scripts.  I use Pulseaudio, so I wrote and use the following to change my volume settings:

ewaller$@$odin /etc/systemd 1008 %cat /usr/local/bin/pavolume 
#!/bin/bash
oldvolume=$(pacmd dump|grep set-sink-volume|grep alsa |cut -f3 -d' ')
pacmd dump | grep set-sink-mute | grep alsa | grep yes > /dev/null
oldmute=$?
case $1 in

increase)
    newvolume=$(($oldvolume + 0x400))
    if (($newvolume >0x10000)) ; then
        newvolume=$((0x10000))
    fi
    pacmd set-sink-volume 0 $(printf '0x%x' $((newvolume)) ) 
    ;;

decrease)
    newvolume=$(($oldvolume - 0x400))
    if (($newvolume < 0 )) ; then
        newvolume=$((0x0000))
    fi
    pacmd set-sink-volume 0 $(printf '0x%x' $((newvolume)) ) 
    ;;

mute)
    if [[(($oldmute == 0))]] ; then
       pacmd set-sink-mute 0 0
    else
       pacmd set-sink-mute 0 1
    fi
    ;;
*)
    echo "usage pavolume increase | decrease | mute"
esac

and I bind the keys with xbindkey with this configuration:

ewaller$@$odin ~ 1013 %cat .xbindkeysrc 

"xfce4-screenshooter" 
  Print

"mpc toggle"
  XF86AudioPlay

"mpc stop"
  XF86AudioStop

"mpc prev"
  XF86AudioPrev

"mpc next"
  XF86AudioNext

#"/usr/local/bin/pavolume toggle"
"amixer set Master toggle"
  XF86AudioMute

#"/usr/local/bin/pavolume increase"
"amixer set Master 1%+"
  XF86AudioRaiseVolume

#"/usr/local/bin/pavolume decrease"
"amixer set Master 1%-"
  XF86AudioLowerVolume

#"urxvt -depth 32 -fg white -bg rgba:0000/0000/0000/bbbb -g 150x50"
"terminal"
  Mod4 + t

"emacs"
  Mod4 + e

"chromium"
  XF86HomePage

"gmrun"
  XF86Save

"thunar"
  Mod4 + f

Edit:  Okay, I lied.  I really am not using the script I posted, but I have no recollection as to why hmm  Anyway, you can see that I am driving amixer directly.

Last edited by ewaller (2013-05-12 15:17:12)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2013-05-12 15:19:34

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,671

Re: [Lenovo Thinkpad T510] Multimedia key help

madsravn wrote:

'm sorry. I'll remember to resize it beforehand the next time.

No worries.  The best way to do it is to set up a click through tumbnail.   Do it like this:  [ url=/path/to/thumbnail/picture][ img=/path/to/big/picture][ /url].


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2013-05-13 12:24:42

madsravn
Member
Registered: 2013-05-12
Posts: 22

Re: [Lenovo Thinkpad T510] Multimedia key help

ewaller wrote:

What Desktop Environment are you using?
After you identify the key codes that are generated (as provided by Karol's link) , you can use a tool such as xbindkeys to tie those key codes to simple scripts.  I use Pulseaudio, so I wrote and use the following to change my volume settings:

ewaller$@$odin /etc/systemd 1008 %cat /usr/local/bin/pavolume 
#!/bin/bash
oldvolume=$(pacmd dump|grep set-sink-volume|grep alsa |cut -f3 -d' ')
pacmd dump | grep set-sink-mute | grep alsa | grep yes > /dev/null
oldmute=$?
case $1 in

increase)
    newvolume=$(($oldvolume + 0x400))
    if (($newvolume >0x10000)) ; then
        newvolume=$((0x10000))
    fi
    pacmd set-sink-volume 0 $(printf '0x%x' $((newvolume)) ) 
    ;;

decrease)
    newvolume=$(($oldvolume - 0x400))
    if (($newvolume < 0 )) ; then
        newvolume=$((0x0000))
    fi
    pacmd set-sink-volume 0 $(printf '0x%x' $((newvolume)) ) 
    ;;

mute)
    if [[(($oldmute == 0))]] ; then
       pacmd set-sink-mute 0 0
    else
       pacmd set-sink-mute 0 1
    fi
    ;;
*)
    echo "usage pavolume increase | decrease | mute"
esac

and I bind the keys with xbindkey with this configuration:

ewaller$@$odin ~ 1013 %cat .xbindkeysrc 

"xfce4-screenshooter" 
  Print

"mpc toggle"
  XF86AudioPlay

"mpc stop"
  XF86AudioStop

"mpc prev"
  XF86AudioPrev

"mpc next"
  XF86AudioNext

#"/usr/local/bin/pavolume toggle"
"amixer set Master toggle"
  XF86AudioMute

#"/usr/local/bin/pavolume increase"
"amixer set Master 1%+"
  XF86AudioRaiseVolume

#"/usr/local/bin/pavolume decrease"
"amixer set Master 1%-"
  XF86AudioLowerVolume

#"urxvt -depth 32 -fg white -bg rgba:0000/0000/0000/bbbb -g 150x50"
"terminal"
  Mod4 + t

"emacs"
  Mod4 + e

"chromium"
  XF86HomePage

"gmrun"
  XF86Save

"thunar"
  Mod4 + f

Edit:  Okay, I lied.  I really am not using the script I posted, but I have no recollection as to why hmm  Anyway, you can see that I am driving amixer directly.

Looks cool. I guess I'm using normal X with my awesome wm. I'm actualy not sure, but I haven't installed anything in particular. Also, I don't actually know what other Desktop Environments are out there.

But thanks for the scripts. Looks like something I can use also. I just need the turn up/down and mute, so that should cover it smile

Offline

Board footer

Powered by FluxBB