For example, a button on the top or side of the keyboard with an envelope icon usually means "E-Mail" and a similarly-shaped button nearby with a speaker icon and an "X" across it means "Mute".
By default, these keyboards work usually without any drivers in Microsoft Windows. However, for Linux, they usually don't work automatically "out-of-the-box".
The keyboard I use is a Logitech Elite LE model with a matching mouse which I purchased at Wal-Mart. I'm curious as to whether this is a custom model manufactured solely for Wal-Mart (A lot of gadgets are exclusively made for sale at Wal-Mart in this fashion) since I can't find this EXACT model on Logitech's Web site. Here is a very similar model (hyperlink):
http://www.logitech.com/index.cfm/products/details/US/EN,CRID=2166,CONTENTID=5013
CAVEAT: I know this works with KDE. I do not know how to do this with Gnome, but surely the process is similar.
REQUIREMENTS:
http://tldp.org/HOWTO/Fedora-Multimedia-Installation-HOWTO/
The easiest way to add ~/bin to the ${PATH} is to add the following line to the ~/.bash_profile script:
PATH="${HOME}/bin:${PATH}"
#!/bin/bash ########################################### # Copyright (C) 2005 Patrick A. Read # # louder - this shell script increases # the volume of the Master playback control # in alsamixer. Usage: louder [number] # where (optional) number is the number of # "clicks" you wish to increase the volume. # Example: louder 4 cranks up the volume # four steps. If you do not specify a # number, then louder will raise the # volume one step. NOTE: Alsamixer uses # 32 steps (0-31) in its volume controls. ########################################### if [ "$1" != "" ] then VOLADJ=${1}+ else VOLADJ="1+" fi amixer set Master ${VOLADJ} exit 0 ########################################### # end of louder script ###########################################softer
#!/bin/bash ########################################### # Copyright (C) 2005 Patrick A. Read # # softer - this shell script decreases # the volume of the Master playback control # in alsamixer. Usage: softer [number] # where (optional) number is the number of # "clicks" you wish to decrease the volume. # Example: softer 3 softens the volume # three steps. If you do not specify a # number, then softer will lower the # volume one step. NOTE: Alsamixer uses # 32 steps (0-31) in its volume controls. ########################################### if [ "$1" != "" ] then VOLADJ=${1}- else VOLADJ="1-" fi amixer set Master ${VOLADJ} exit 0 ########################################### # end of softer script ###########################################mute
#!/bin/bash ########################################### # Copyright (C) 2005 Patrick A. Read # # This script toggles muting the playback # of the Master volume device in alsamixer. # Usage: mute (no arguments) - the mute # state is TOGGLED by successively running # this script. The volume level of the # Master control is saved to a temp file # (see script for details) so that when mute # is run again, the prior volume level is # restored. If this temp file does not exist # when the user unmutes using this script, # then I found a default value of 22 (on a # 0-31 scale) to be a comfortable level. # Feel free to vary this to your liking. ########################################### declare -r TEMPVOLFILE="/tmp/kde-${USER}/volume.tmp" declare -r CURRENTVOLUME=$(amixer get Master | grep \ 'Front Left:' | cut -d' ' -f6) declare -i NEWVOLUME if [ "${CURRENTVOLUME}" == "0" ] then if [ -f ${TEMPVOLFILE} ] then NEWVOLUME=$(cat ${TEMPVOLFILE}) else NEWVOLUME=22 fi amixer set Master ${NEWVOLUME} else echo ${CURRENTVOLUME} > ${TEMPVOLFILE} amixer set Master 0 fi exit 0 ########################################### # end of mute script ###########################################
patrick@pr01:~$ cd ~/bin patrick@pr01:~/bin$ chmod 755 ./softer ./louder ./mute
At this point, you can test the scripts by running them with the optional numeric arguments for louder and softer. You will notice that alsamixer returns some console text with regards to the state of the Master control after each script is run.
NOTE: For this example, we will set up the "Volume Up" key, but the procedure is similar for all hotkeys.
NOTE: BE SURE TO USE A COMMAND SHELL WINDOW (CONSOLE) WITH A LARGE SCROLL BUFFER (like 500 lines or more).
NOTE: xev is the command shell tool for monitoring X events, such as mouse clicks, mouse pointer movement, window movement/ resizing/opening/closing, and keyboard events.
NOTE: You may see and identical keycode parameter for a "KeyPress event" in addition to the KeyRelease event.
NOTE: If you see a TWO digit number, you're probably looking at a keycode belonging to a more commonly-used key like a letter or number. BE ABSOLUTELY SURE THAT YOU ARE LOOKING AT THE KEYCODE ASSOCIATED WITH THE HOTKEY YOU'RE PRESSING.
NOTE: xev returns a KeyPress and KeyRelease event message each time a key is pressed on the keyboard. Additionally, xev returns mouse events (including moving the mouse pointer over different open windows). The sheer amount of text returned by xev inside the console window explains why a large screen buffer is needed and why I personally found it easier to do one key at a time.
Listed below are the numerical values X shows for the hotkeys on my system (YOUR VALUES MAY VARY):
Hotkey keycode ====== ======= Media . . . . . . . 237 Play/Pause . . . . 162 Mute . . . . . . . 160 Up Volume . . . . . 176 Down Volume . . . . 174 E-Mail . . . . . . 236 WWW . . . . . . . . 178 Calculator . . . . 161
Create one last script, call it keycodes.sh.
NOTE: Your actual keycode values may differ from these here, and you can also choose ANY arbitrary F key from F13 to F24 for each hotkey. The idea here is that any hotkey needs to "pretend" to be an extended F-key for X and KDE to identify it.
#!/bin/bash ########################################### # keycodes.sh # FORMAT: keycode nnn=Fxx # where nnn is the three-digit keycode # and xx is any value from 13 to 24 unique # for each key. ########################################### xmodmap -e 'keycode 174=F21' # lower volume xmodmap -e 'keycode 176=F22' # raise volume xmodmap -e 'keycode 160=F23' # mute xmodmap -e 'keycode 161=F20' # calculator xmodmap -e 'keycode 162=F19' # play-pause xmodmap -e 'keycode 237=F18' # media xmodmap -e 'keycode 178=F17' # WWW xmodmap -e 'keycode 236=F16' # e-mail exit 0 ########################################### # END OF keycodes.sh SCRIPT ###########################################
patrick@pr01:~$ chmod 755 ~/.kde/Autostart/keycodes.sh
You could either search for "keys" under the "Search" tab or go straight there by expanding the "Regional & Accessibility" tree. Navigate to KHotKeys either way.
You should see a window with two large panes, four command buttons on the bottom labeled "New Action", "New Group", "Delete Action", and "Global Settings". Click on "New Group". In the input field near the upper right side of the window, it'll say "New Action Group" - edit this and call it "hotkeys".
Now, a group called "hotkeys" will appear in the left pane (there were two already there on my system, "Examples" and "Konqueror Gestures").
NOTE: For this example, I will show mapping the "Raise Volume" button to the "louder" shell script we created earlier.
Hotkey command ====== ======= Media . . . . . . . konqueror /path/to/media/files Play/Pause . . . . xmms -t Mute . . . . . . . home/USER/bin/mute Up Volume . . . . . home/USER/bin/louder Down Volume . . . . home/USER/bin/softer E-Mail . . . . . . /path/to/firefox http://www.gmail.com WWW . . . . . . . . /path/to/firefox Calculator . . . . kcalcNOTE: UPDATED JUNE 5: I noticed that ~ (meaning /home/USER/) does NOT work since KDE doesn't interpret this as the user's part of the ${PATH}. Be sure to specify the entire path of script or program. Konqueror, XMMS, and KCalc are in the system default path which KDE already understands, thus the entire path is not needed (although it won't hurt to put it in).
NOTE: xmms -t simply toggles play/pause XMMS from a command prompt.
NOTE: mute, louder, and softer are the three scripts created earlier.
NOTE: For the E-mail button, I chose opening the Web browser to a Web mail page (Google Mail in this example), but it could just as easily be used to open any e-mail client, such as Thunderbird, Netscape Mail, or Mozilla Mail. Or, you could Wine Outlook Express (Just kidding).
NOTE: The Media button could be used to open a media player, but I chose to open the file browser (konqueror) to my music files directory instead.