Talk:HOWTO Use Multimedia Keys

From Gentoo Linux Wiki

Jump to: navigation, search

Contents

[edit] Lineakd

Maybe lineakd would be an option? I am using it right now, and it works nicely.

  • I'm gonna add this as a optional way for the "lazy" :) Thanks for the tip!

[edit] ReMoot

I know of a program called ReMoot that can control xmms, Rhythmbox, Amarok, Quod Libet, xine, kaffeine and some more. Its command based (eg 'remoote play' etc have the ability to control the active multimedia app) so it works best with Lineak or xbindkeys. This might be worth to mention in the article somewere!

[edit] amixer

[edit] amixer -q set Master toggle

amixer -q set Master toggle does not work. A google search informs that many also make the same claim. Even ALSA claims it should work so what gives? Correct me if I'm wrong..
Ateo 01:43, 5 December 2005 (GMT)

[edit] Re: amixer -q set Master toggle

You should first run amixer scontrols to see which Simple mixer controls are available. For example, amixer set Front toggle may work. Mimosinnet 13:18, 14 June 2008 (UTC)

[edit] amixer toggle

Not all cards have a mute toggle, though it can be solved with a script like this, saving the previous volume and setting volume to 0:

File: /usr/local/bin/muteVolume
#!/bin/bash
# simple script to mute by changing volume
filename="$HOME/.lastVolume"
numid="28"   #find apropriate number with: amixer controls
volume=$(amixer cget numid=$numid | grep :)
volume=${volume: -2}
if [[ $volume = '=0' ]]
then
	echo "volue is 0 ,restoring"
	volume=$(cat $filename)
	amixer cset numid=$numid $volume &> /dev/null
else
 	echo "volue is $volume ,muting"
 	echo $volume > $filename
	amixer cset numid=$numid 0 &> /dev/null
fi


  • Fixed and added to the article. My version was tested with amixer 1.0.13.

Prof1337 04:20, 14 July 2007 (GMT)


[edit] xev

Added a note that you need to emerge xev if using modular x server 7.0

[edit] xmodmap

xmodmap in not necessary (at least with xorg 7.0) as xbindkey understands keycodes directly, such as:

File: ~/.xbindkeysrc
"mpc toggle"
  m:0x0 + c:162
"mpc stop"
  m:0x0 + c:164
"mpc prev"
  m:0x0 + c:144
"mpc next"
  m:0x0 + c:153
"amixer set PCM,0 5%+"
  m:0x0 + c:176
"amixer set PCM,0 10%-"
  m:0x0 + c:174
"amixer set PCM,0 5%+"
  m:0x0 + c:137
"amixer set PCM,0 10%-"
  m:0x0 + c:138

and "m:0x0 +" is overkill too, but I just leave it.

[edit] Re: xmodmap

But if you do it with xmodmap, you can set extra keys in applications' guis (for example kde apps or e17 keybindings)

[edit] Mozilla/Firefox/Seamonkey

Does anyone know how to get forward/back working using xbindkeys? With lineakd I used:

seamonkey -remote 'openURL(javascript:history.back())'

But with xbindkeys it just opens a new tab.


[edit] Debian?

What does mean "If you use debian[...]" and why does it take place on gentoo wiki?

[edit] Re:Debian?

I am using Debian, and I read Gentoo Wiki 'cause it's a very comprehensive help, should I leave right now ?

besides, here is what I use on my Etch box :

File: /usr/local/bin/amixer_toggle.sh
#!/bin/sh

#===========================#
# amixer_toggle.sh          #
# mute/unmute hack          #
# for amixer version 1.0.13 #
#===========================#

[ -z "$1" ] && cat << EOL && exit
usage: $0 <control numid>
run 'amixer controls' to find your own numid !
EOL

numid="$1"
last="$HOME/.lastVolume"
vol=$(amixer cget numid=$numid|perl -ne 'print if s/.*: values=(\d+),\d+.*/$1/')

if test "#$vol#" == "#0#"
then
    vol=$(cat $last)
    amixer cset numid=$numid $vol &> /dev/null
else
    echo $vol > $last
    amixer cset numid=$numid 0 &> /dev/null
fi
Personal tools