#!/bin/bash# ## simple script to make amarok to work with some of my media buttons on the mouse.# this script i wrote to work with xbindkeys # # Needed stuff:# xbindkeys # evdev module compiled for Xorg "already bult in kubuntu's xorg server"# kernel usbstuff- "evdev" module## cat /proc/bus/input/devices# looks something like:## I: Bus=0003 Vendor=046d Product=c50e Version=0111# N: Name="Logitech USB RECEIVER"# P: Phys=usb-0000:00:0b.0-4/input0# S: Sysfs=/class/input/input4# U: Uniq=# H: Handlers=mouse0 event1 ts0# B: EV=20007# B: KEY=ffff0000 0 0 0 0 0 0 0 0# B: REL=143# B: LED=ff00## Find your mouse event. usaly event0 or event1# Now edit /etc/X11/xorg.conf and replace ## Driver "mouse" # with # Driver "evdev"# and# Option "Device" "/dev/psaux" #mice or whatever whats written there..# with# Option "Device" "/dev/input/event1"## Now use "xev" to find the button numbers.# then make a new file called ".xbindkeysrc" in your home dir, # # the file may look something like.# # ############# .XBINDKEYSRC ############# ## "/usr/bin/mediamouse start"# b:17 + Release## "/usr/bin/mediamouse stop"# b:10 + Release## "/usr/bin/mediamouse next"# b:15 + Release## "/usr/bin/mediamouse prev"# b:16 + Release## "/usr/bin/mediamouse up"# b:13 + Release## "/usr/bin/mediamouse down"# b:14 + Release# # ########################################### copy the script to /usr/bin or change the path in .xbindkeysrc where the script it located. # also run "sudo chmod 755 mediamouse"# this script is GPL and made by Stian Mikalsen, alias nuxil. lumax@operamail.com#ARG=$1function start() { if [[ ! -n `pgrep amarokapp` ]] then exec amarokapp & sleep 3 exec dcop amarok player play else exec dcop amarok player play fi}function stop(){ if [[ -n `pgrep amarokapp` ]] then exec dcop amarok player stop fi}function next(){ if [[ -n `pgrep amarokapp` ]] then exec dcop amarok player next fi}function prev(){ if [[ -n `pgrep amarokapp` ]] then exec dcop amarok player prev fi}function up(){ if [[ -n `pgrep amarokapp` ]] then exec dcop amarok player volumeUp fi}function down(){ if [[ -n `pgrep amarokapp` ]] then exec dcop amarok player volumeDown fi}case $ARG in start) start ;; stop) stop ;; next) next ;; prev) prev ;; up) up ;; down) down ;; *) exit 0 ;;esac