|
|
|
| Web Hosting Guide |
Hotkeys / Keyboard Quick Launch Keys In Linux |
Dec 15 2004, 10:03 PM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 3 Joined: 15-December 04 Member No.: 1,770 |
I first submitted this tutorial a couple of months ago over at http://linuxiso.org/forums as user adpsimpson.
Having spent ages wishing the hotkeys on my laptop would work, I spent most of an afternoon looking into it. Since no site I found explained it satisfactorily, here's my method... The first step is to find out which of the keys are registered by the kernel, and what their keycodes are (the unique event number that they cause). To do this you need a program called xev, (in Mandrake this is part of X11R6-contrib, is installed by default in Slack, and should be easy to find for other distros). From the terminal, in a graphical interface, type xev to launch it, move the mouse over the new window and press the hotkeys. What appears in the terminal is something like CODE KeyPress event, serial 28, synthetic NO, window 0x2c00001, root 0xb5, subw 0x2c00002, time 3593153, (55,38), root:(730,82), state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: "" The "keycode" (in this case 64) is the important part. The next is to make the keycode actually do something when X registers it. For this you need to run xmodmap to modify the keyboard map. A small script in the ~/.kde/Autostart folder (or similar for other desktops) means this will be done each time KDE is stated. I wanted key 176 to increase the system volume, and 174 to decrease it, so the script reads CODE xmodmap -e 'keycode 174=F21' #voldown xmodmap -e 'keycode 176=F22' #volup Don't forget to make this executable. Run this script, re-run xev and you should now see, for example, F22 or F21 in the even notification. The final step is to make F21 or F22 (or whatever you called your keys) actually do something useful. You can do this using the existing shortcut options (if you wish it to start an application), or you can use the program xbindkeys, here - http://hocwp.free.fr/xbindkeys/xbindkeys.html . This program links key events to bash commands, very easily. The script in the KDE Autostart folder can then be modified to launch xbindkeys when KDE is launched, and the file ~/.xbindkeysrc modified to link the key events to the desired bash commands. I used dcop (the inter-program communication process) to tell kmix (the default KDE mixer) to increase/decrease the master volume (channel 0) whenever the relevant keys were pressed. Below is the complete file ~/.kde/Autostart/keycodes (MUST be executable): CODE #!/bin/sh #file to map special keys. #File location: ~/.kde/Autostart #File Name:keycodes xmodmap -e 'keycode 174=F21' #voldown xmodmap -e 'keycode 176=F22' #volup #Open kmix to allow xbindkeys to work: kmix #Open xbindkeys to link keys to applications: xbindkeys and the few lines I had to add to ~/.xbindkeysrc: Code: #Volume decrease "dcop kmix Mixer0 decreaseVolume 0" F21 #Volume increase "dcop kmix Mixer0 increaseVolume 0" F22 Hopefully this will help people make their keyboards more useful. If anyone has any further suggestions, or knows of obvious or important differences between desktop environments, please post them below. However it should be relatively distro/desktop independent. |
|
|
|
Posts in this topic
intrepid Hotkeys / Keyboard Quick Launch Keys In Linux Dec 15 2004, 10:03 PM
cryptwizard That's very useful.
I'll be looking back t... Dec 22 2004, 03:16 AM
the empty calorie Ugh, I hate hotkeys. I always had them disabled on... Dec 28 2004, 06:56 PM
cryptwizard Good point.
That happened to me a few times at sch... Jan 4 2005, 07:18 AM
FeedBacker Hotkeys / Keyboard Quick Launch Keys In Linux Apr 23 2008, 09:47 PM
FeedBacker Hotkeys / Keyboard Quick Launch Keys In Linux Jun 26 2008, 04:06 AM![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
9 | helix | 1,665 | 20th November 2009 - 07:50 AM Last post by: iG-BeeMan |
|||
![]() |
6 | borejk | 1,671 | 19th November 2009 - 05:49 PM Last post by: iG-vishwanath |
|||
![]() |
5 | puzzledgranny | 107 | 14th November 2009 - 05:34 AM Last post by: iG- |
|||
![]() |
1 | magickay | 28 | 12th November 2009 - 11:23 PM Last post by: yordan |
|||
![]() |
14 | kanade | 4,273 | 12th November 2009 - 07:55 PM Last post by: iG-Ram |
|||
![]() |
1 | FirefoxRocks | 116 | 5th November 2009 - 11:39 PM Last post by: HannahI |
|||
![]() |
0 | fermin25 | 42 | 22nd October 2009 - 05:39 PM Last post by: fermin25 |
|||
![]() |
11 | dserban | 1,404 | 8th October 2009 - 07:47 PM Last post by: HannahI |
|||
![]() |
2 | turbopowerdmaxsteel | 69 | 8th October 2009 - 07:40 PM Last post by: HannahI |
|||
![]() |
2 | jedipi | 3,446 | 8th October 2009 - 08:47 AM Last post by: iG-Neville |
|||
![]() |
13 | vicky99 | 2,752 | 5th October 2009 - 11:43 AM Last post by: iG-shrikant |
|||
![]() |
15 | laniczech | 1,457 | 18th September 2009 - 08:51 AM Last post by: takerraj |
|||
![]() |
17 | drogus | 3,673 | 17th September 2009 - 08:29 AM Last post by: ndowens |
|||
![]() |
63 | Airlub | 11,384 | 17th September 2009 - 08:17 AM Last post by: ndowens |
|||
![]() |
20 | liveblue | 1,571 | 17th September 2009 - 08:12 AM Last post by: ndowens |
|||
|
Lo-Fi Version | Time is now: 24th November 2009 - 09:25 PM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation


Dec 15 2004, 10:03 PM






