You are not logged in.

#1 2008-05-21 08:50:44

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Hotkeys in KDE

Hello,

I'm having trouble setting up my extra keyboard keys in KDE.
I have made an .Xmodmap file:

keycode 129 = XF86AudioMedia
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 160 = XF86AudioMute
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume

Yesterday this all worked good. However, today (after an reboot) it doesn't. Even if i do 'xmodmap .Xmodmap'.
Any clue why this isn't working?

Thanks in advance,
Kevin

Offline

#2 2008-05-21 09:32:55

signor_rossi
Member
Registered: 2007-08-24
Posts: 257

Re: Hotkeys in KDE

Is Kmilo installed and running? Check in the Control Center under something like KDE Components -> Services (german language here).

Bye, signor_rossi.

Offline

#3 2008-05-21 09:55:32

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Re: Hotkeys in KDE

Kmilo is running yeah.

By the way, my volume up & down and mute keys do work. However, the play,stop,next and previous won't work.

Offline

#4 2008-05-21 10:11:53

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Re: Hotkeys in KDE

If you want to have an easier life with your hotkeys, use acpi_listen command instead of other methods, and make yourself a shellscript.

I will put my /etc/acpi/handler.sh file, keys adapted to an ASUS laptop. Execute acpi_listen, push your multimedia keys and you will get the keycode of the key and use it:

#!/bin/sh
# Default acpi script that takes an entry for all actions
# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

GOVERNOR="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
set $*

case "$1" in
    hotkey)
        case "$3" in
            0000006b)
            #SHMConfig must be enabled in xorg.conf
          PadOn=`synclient -l | grep -c "TouchpadOff.*0"`
          if [ "${PadOn}" = "1" ] ; then
              synclient TouchpadOff=1
                  #echo 1 > /proc/acpi/asus/mled
                  :#Enable Touchpad
            else
                synclient TouchpadOff=0
                #echo 0 > /proc/acpi/asus/mled
                :#Disable Touchpad
            fi
        ;;
            0000005f)
        #    LED=$(cat /proc/acpi/asus/wled)
                killall dhcpcd 
                echo 0 > /proc/acpi/asus/wled
            ;;
            0000005e)
                /home/david/bin/conectar
                echo 1 > /proc/acpi/asus/wled
                ;;
#            00000051)
#                       #echo "Kazehakase pressed!">/dev/tty5    
#                su davigetto -c "export DISPLAY=:0.0;konqueror &"
#            ;;
#            00000050)
#                       su davigetto -c "export DISPLAY=:0.0;kmail &" 
#            ;;
#            00000045)
#                       su davigetto -c "export DISPLAY=:0.0;amarok -t &" 
#            ;;
#            00000041)
#                       su davigetto -c "export DISPLAY=:0.0;amarok -f &"
#            ;;
#            00000040)
#                       su davigetto -c "export DISPLAY=:0.0;amarok -r &"
#            ;;
#            00000043)
#                su davigetto -c "export DISPLAY=:0.0;amarok -s &"
#                #mplayer /home/davigetto/Musica/*.mp3 &
#            ;;
            00000032) amixer set Master toggle;;
            00000031) amixer set Master 1-;;
            00000030) amixer set Master 1+;;
            0000005c)
                case "$GOVERNOR" in
                    ondemand)
                     echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                    ;;
                    powersave)
                     echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                    ;;
                    performance)
                     echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

                     echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

                esac
                ;;
        esac
        ;;
    button/power)
        #echo "PowerButton pressed!">/dev/tty5
        case "$2" in
            PWRF)    logger "PowerButton pressed: $2" 
                pm-hibernate
                ;;
            *)    logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB) pm-suspend ;;
            *)    logger "ACPI action undefined: $2" ;;
        esac
        ;;
    
    ac_adapter)
        case "$2" in
            AC0)
                case "$4" in
                    00000000)
                    #entrando en modo bateria
                     echo "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo "powersave" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                        #/etc/laptop-mode/laptop-mode start
                    ;;
                    00000001)
                    #entrando en modo AC
                     echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                        #/etc/laptop-mode/laptop-mode stop
                    ;;
                esac
                ;;
            *) logger "ACPI action undefined: $2" ;;
        esac
        ;;
    battery)
        case "$2" in
            BAT0)
                case "$4" in
                    00000000)    
                    #bateria no presente
                    #echo "offline" >/dev/tty5
                    ;;
                    00000001)    
                    #bateria presente
                    #echo "online"  >/dev/tty5
                    ;;
                esac
                ;;
            *) logger "ACPI action undefined: $2" ;;
        esac
        ;;

    button/lid)
        #echo "LID switched!">/dev/tty5
        ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

This is for root commands. For user commands (like executing apps) i have a key handler in .kde/Autostart:

if ps -e | grep acpi_listen &> /dev/null
then
    exit
else
    
    while true;
    do
    OUTACPI=`acpi_listen -c 1`
    VAL=`echo $OUTACPI | cut -f3 -d " "`
    LOGOUT=`echo $OUTACPI | cut -f2 -d " "`
    case "$VAL" in
    00000050)
                #echo "PREVIOUS"
            firefox http://www.gmail.com &
                ;;
    00000051)
                #echo "NEXT"
            firefox &
                ;;
    00000040)
                #if ps -e | grep sonata &> /dev/null
                #then
                #    echo "sonata abierto"
                #else
                #    sonata --hidden &
                #fi
                #exaile -p &
        amarok -r &
                #audacious -r &
                ;;
    00000045)
                #exaile -t &
                amarok -t &
                #echo "STOP"
                #audacious -t &
                ;;
    00000041)
                #exaile -n &
           amarok -f &    
        #audacious -f &
                ;;
    00000043)
                #exaile -s &
            amarok -s &  
        #audacious -s & 
                ;;
    #00000080)
        #if [ $LOGOUT = "PWRF" ]
        #then
                #cerrar sesion
                #xfce4-session-logout
            #fi
                #;;
        *)
                #echo "ELSE: $i"
                ;;
        esac
    done
fi

In arch wiki you have a page for setting up multimedia keys


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#5 2008-05-21 10:17:31

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Re: Hotkeys in KDE

@ Davigetto: I get a command not found on 'acpi_listen'. Thanks for your input smile

Offline

#6 2008-05-21 12:25:11

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Re: Hotkeys in KDE

pacman -S acpid

Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#7 2008-05-22 16:53:13

synorgy
Member
From: $HOME
Registered: 2005-07-11
Posts: 272
Website

Re: Hotkeys in KDE

I just use xbindkeys.

It's transparent once set up, easy to modify, works across all WMs and is extremely simple.

You can see some of it's configuration here:
http://www.deelab.org/wordpress/2007/12 … archlinux/
and
http://hocwp.free.fr/xbindkeys/xbindkeys.html

Although Davigetto's solution would work fine - seems that it's replicating features found in xbindkeys. If you need any help with it (that is, if you decide to take this road) lemme know.


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity." (Dennis Ritchie)

Offline

Board footer

Powered by FluxBB