
Hi, I use a Lenovo T61 with Arch Linux and Xmonad. The Laptop has this blue "ThinkVantage" Button in the upper left corner. I'd like to use this key for toggling my CPU-Frequency. I've written a little function in Haskell being inspired by a blog entry by Don Stewart (http://cgi.cse.unsw.edu.au/~dons/blog/2007/03). A) The reference to the key The function works as it should and now I'd like to bind it in my xmonad.hs. However, I just cannot figure out how to refer to this "ThinkVantage"-Button in my xmonad.hs. I had a look at http://www.haskell.org/haskellwiki/Xmonad/Frequently_asked_questions#What_is... which tells me to have a look at: $ xev | sed -ne '/^KeyPress/,/^$/p' KeyPress event, serial 28, synthetic NO, window 0x2c00001, root 0x102, subw 0x0, time 31601784, (329,154), root:(855,155), state 0x0, keycode 156 (keysym 0x1008ff41, XF86Launch1), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False so I know now the keysym and I know its bind to XF86Launch1. But how do I find out how I can refer to this key within Xmonad? I looked into the file /usr/include/X11/keysymdef.h and searched for "ff41", "XF", "launch", etc. but no luck. Does anyone know, where to look for the right place? B) Nicer binding At the moment, I have the following: A file CpuToggle.hs, which is --- --- --- module CpuToggle (toggle) where import Text.Printf import System.Process toggle = do s <- readProcess "cpufreq-info" [] [] case (clean s) of True -> do system "sudo cpufreq-set -c 0 -f 2500000" system "sudo cpufreq-set -c 1 -f 2500000" printf "CPU is toggled up.\n" False -> do system "sudo cpufreq-set -c 0 -f 1200000" system "sudo cpufreq-set -c 1 -f 1200000" printf "CPU is toggled down.\n" clean :: String -> Bool clean cs = let a = read $ (!! 4) . words . (!! 11) . lines $ cs b = read $ (!! 4) . words . (!! 21) . lines $ cs in (a < 2.5 || b < 2.5) --- --- --- and a file toggle.hs, which is: --- --- --- import CpuToggle main = toggle --- --- --- the latter I compile and put something like , ((modm, xK_F11), spawn "/home/thomas/toggle") into my xmonad.hs. Works just fine!! Now, well, I just *really* would like to write someting like import CupToggle ... , ((modm, xK_F11), toggle) instead. How would I need to change the toggle-function in the CpuToggle-Module in order to achieve this? Thanks so much!! Cheers, Thomas