View previous topic :: View next topic |
Author |
Message |
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Thu Jan 29, 2009 10:37 am Post subject: TIP: move Capslock on console to Shift-ShiftLock key |
|
|
I never use CapsLock ! Never ? Yes I very often 'use' it when I accidentally press the ShiftLock key and write things like EMERGE __SYNC _UdnATV WORLD.
So I was looking for a way to disable the ShiftLock key while working on console. In addition, just in case someone might actually want to use CapsLock, I wanted to make it possible to use Shift - ShiftLock to activate and deactivate CapsLock.
Note: in the above, I use ShiftLock to mean the key, and CapsLock to mean the functionality.
It turned out I had to take some time and attentively read man loadkeys and man keymaps. I will not reiterate the contents here, but just explain my conclusions
First make sure you know the keycode from the ShiftLock key by running (from a console, not a terminal emulator under X):
and press the ShiftLock key. you'll see something like
Quote: | keycode 58 press
keycode 58 release |
Wait for 10 seconds to return to the prompt.
using loadkeys, we can now easily change the key assignment
this can be done manually (as root) from the command line)
Quote: | loadkeys >> EOF
plain keycode 58 = VoidSymbol
shift keycode 58 = Caps_Lock
EOF
|
However, a cleaner way is to create a keymap that can be loaded by /etc/init.d/keymaps
Quote: | cd /usr/share/keymaps/i386/include # where the keymaps for my pc are stored
# create the keymap file
cat << EOF >> shiftcaps.map
keycode 58 = VoidSymbol
shift keycode 58 = Caps_Lock
EOF
gzip shiftcaps.map # compress it into shiftcaps.map.gz
|
Now edit the key EXTENDED_KEYMAPS in /etc/conf.d/keymaps
I have
Quote: | EXTENDED_KEYMAPS="backspace keypad euro2 shiftcaps"
|
The last word ('shiftcaps', not 'shiftcaps.map.gz') makes loadkeys load the new keymap when you run
Quote: | /etc/init.d/keymaps restart |
Last edited by javeree on Thu Jan 29, 2009 12:58 pm; edited 2 times in total |
|
Back to top |
|
|
jfp Guru
Joined: 08 Jul 2007 Posts: 326 Location: Virginia, USA
|
Posted: Thu Jan 29, 2009 11:54 am Post subject: |
|
|
javeree,
Thank you very much. This could be the next great advance in computing.
I am having trouble finding the showkeys command. Do you know what package contains it?
Code: | equery belongs showkeys |
_________________ jfp |
|
Back to top |
|
|
jfp Guru
Joined: 08 Jul 2007 Posts: 326 Location: Virginia, USA
|
Posted: Thu Jan 29, 2009 12:27 pm Post subject: |
|
|
Found it... It is not "showkeys", but "showkey".
Code: |
zippy logrotate.d # equery belongs showkey
[ Searching for file(s) showkey in *... ]
sys-apps/kbd-1.13-r1 (/usr/bin/showkey)
|
_________________ jfp |
|
Back to top |
|
|
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Thu Jan 29, 2009 12:58 pm Post subject: |
|
|
corrected in the original post |
|
Back to top |
|
|
sleipner n00b
Joined: 13 Aug 2005 Posts: 48
|
Posted: Fri Jan 30, 2009 7:14 am Post subject: |
|
|
great tip javeree!
i changed capslock to esc like i do under x.. it makes using vim so much nicer :)
Code: |
keycode 58 = Escape
alt keycode 58 = Meta_Escape
shift alt keycode 58 = Meta_Escape
altgr alt keycode 58 = Meta_Escape
control alt keycode 58 = Meta_Escape
shift control alt keycode 58 = Meta_Escape
altgr control alt keycode 58 = Meta_Escape
|
|
|
Back to top |
|
|
GetCool Guru
Joined: 23 Nov 2003 Posts: 324 Location: Madison, Wisconsin
|
Posted: Tue Feb 17, 2009 7:16 am Post subject: Re: TIP: move Capslock on console to Shift-ShiftLock key |
|
|
Wow, thanks... I've always edited /usr/share/keymaps/i386/qwerty/us.map.gz directly to make my customizations, and for some reason I never even noticed the EXTENDED_KEYMAPS variable before... and I've been editing the keymaps file for years! Am I blind?
Now I can put all kinds of crazy custom extensions in there without editing the default keymap file. Fantastic. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Wed Feb 18, 2009 7:50 am Post subject: |
|
|
Thanks for this, working good, but one question @sleipner:
When I include Code: | shift control alt keycode 58 = Meta_Escape
altgr control alt keycode 58 = Meta_Escape |
I get an error stating Code: | loadkeys: /usr/share/keymaps/i386/include/ph_esc-lock.map.gz:7: adding map 13 violates explicit keymaps line
* ERROR: keymaps failed to start |
Any hint on that? My default keymap is Code: | keymap="de-latin1-nodeadkeys" |
Edit, under X, is there a better way as using xmodmap? |
|
Back to top |
|
|
sleipner n00b
Joined: 13 Aug 2005 Posts: 48
|
Posted: Wed Feb 18, 2009 8:59 am Post subject: |
|
|
my keymap is fi-latin9 so that might do the difference.
this should give you correct keymap for escape, just copy needed lines to your keymap file and replace keycodes
Code: |
dumpkeys|grep Escape
|
|
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Wed Feb 18, 2009 9:32 am Post subject: |
|
|
Thanks, for the reference, this is my output dumpkeys | grep -i escape wrote: | keycode 1 = Escape Escape
alt keycode 1 = Meta_Escape
shift alt keycode 1 = Meta_Escape
keycode 4 = three section threesuperior Escape
control alt keycode 4 = Meta_Escape |
|
|
Back to top |
|
|
|