|
|
|
| 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. |
|
|
|
![]() |
Replies
(1 - 6)
Dec 22 2004, 03:16 AM
Post
#2
|
|
|
Member - Active Contributor Group: Members Posts: 77 Joined: 11-December 04 Member No.: 1,704 |
That's very useful.
I'll be looking back to this when I get a keyboard with hotkeys. |
|
|
|
Dec 28 2004, 06:56 PM
Post
#3
|
|
|
Premium Member Group: Members Posts: 254 Joined: 28-December 04 Member No.: 1,884 |
Ugh, I hate hotkeys. I always had them disabled on my laptop, because if you'd accidentally press one, you would end up having to wait a minute (painfully slow computer) just to close whatever you opened.
|
|
|
|
Jan 4 2005, 07:18 AM
Post
#4
|
|
|
Member - Active Contributor Group: Members Posts: 77 Joined: 11-December 04 Member No.: 1,704 |
Good point.
That happened to me a few times at school once. Even if your keyboard doesn't have hotkeys, the F1 (Help) button can be annoying when you're reaching for the F2 (Rename) button. |
|
|
|
Apr 23 2008, 09:47 PM
Post
#5
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
Rally good, I've been looking for something like this. I hate exit from full screen mode just to increase the volume.
-reply by physlord |
|
|
|
Jun 26 2008, 04:06 AM
Post
#6
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
A better hotkey system (or different at least)
Hotkeys / Keyboard Quick Launch Keys In Linux Is it possible to listen to those keystrokes, keep them in a buffer, and setup hotkeys, then have a "fire" key that actually launches programs? Ideally then if you type in the say "ff[tab]" firefox would open, etc. -reply by joseph |
|
|
|
Dec 3 2009, 07:07 PM
Post
#7
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
KDE4 quick update
Hotkeys / Keyboard Quick Launch Keys In Linux In KDE4, at least under OpenSuSE 11.2, the directory for autostart is actually ~/.Kde4/Autostart -reply by Jessica Tanenhaus |
|
|
|
![]() ![]() |
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 | |||
|---|---|---|---|---|---|---|---|
![]() |
42 | XIII | 17,308 | 13th March 2010 - 04:42 PM Last post by: yordan |
|||
![]() |
11 | Senor_Grunt | 1,123 | 18th February 2010 - 01:53 PM Last post by: Quatrux |
|||
![]() |
11 | WeaponX | 4,528 | 17th February 2010 - 09:48 PM Last post by: iG-JuanCruz |
|||
![]() |
2 | kanade | 729 | 28th January 2010 - 01:06 PM Last post by: iG-pankaj |
|||
![]() |
11 | helix | 1,986 | 27th January 2010 - 11:36 AM Last post by: iG-Bungee |
|||
![]() |
5 | takerraj | 271 | 20th January 2010 - 12:40 PM Last post by: iG-Sonny |
|||
![]() |
17 | kanade | 2,353 | 5th January 2010 - 05:22 PM Last post by: iG-Ganesh Kuppan |
|||
![]() |
6 | puzzledgranny | 291 | 26th December 2009 - 03:50 AM Last post by: iG-Stacy |
|||
![]() |
2 | magickay | 199 | 23rd December 2009 - 01:03 PM Last post by: iG-magickay |
|||
![]() |
1 | fermin25 | 261 | 13th December 2009 - 08:38 PM Last post by: yordan |
|||
![]() |
12 | dserban | 1,890 | 9th December 2009 - 01:19 PM Last post by: wutske |
|||
![]() |
11 | borejk | 2,240 | 9th December 2009 - 11:42 AM Last post by: iG-zeena |
|||
![]() |
6 | kanade | 3,015 | 8th December 2009 - 09:00 PM Last post by: yordan |
|||
![]() |
24 | liquidsparxx | 9,593 | 24th November 2009 - 03:59 AM Last post by: iG-Nasser |
|||
![]() |
14 | kanade | 5,200 | 12th November 2009 - 07:55 PM Last post by: iG-Ram |
|||
|
Lo-Fi Version | Time is now: 21st March 2010 - 07:02 PM |
© 2010 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







