Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!csn!nntp-xfer-1.csn.net!ncar!newshost.lanl.gov!crs From: crs@lanl.gov (Charlie Sorsby) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Keyboard remapping Date: 12 Nov 1996 02:14:41 GMT Organization: Los Alamos National Laboratory Lines: 69 Message-ID: <568mih$156@newshost.lanl.gov> Reply-To: crs@hamlet.lanl.gov NNTP-Posting-Host: hamlet.lanl.gov [I will appreciate if any follow-ups are Cc:ed to crs@hamlet.lanl.gov because I may be away for a few days fairly soon and I'd hate to have a great response expire before I could read it. Thanks.] Well... Some time ago I figured out how to remap the keyboard under X to compensate for the asinine layout of PC keyboards by moving the stupid <CAPS-LOCK> key to the right <CTRL> key and vice versa. Great! Now, as long as I run X, the control key is where god intended it to be and I can type things like backspace and escape without having to reach clear across the keyboard by using ^H and ^[ respectively and other neat things like that. But any time I, for whatever reason, choose to run FreeBSD (3.1.5R) without X, I'm out of luck. Fingers with ingrained habits due to years of finding the control key where the stupid caps lock is hit caps lock most of the time when I want control. Sigh... So, I look around and find kbdcontrol and /usr/share/syscons/keymaps/us.iso.kbd (I assume that is what is being used by default) and think, Hey! this will fix my problem. So I use kbdcontrol -d > mykeymap in my home directory and swap the key scan codes for the two keys and, lo and behold, the effective control key is in the right place when I'm not running X. Yay!!! So, I start X and... Guess what? My previous fix under X is now broken. Sigh... Well, more time with man pages and looking through various files and I find "! This file presupposes that the keyboard is in the default state, and ! may malfunction if it is not." in my .Xmodmap file where I had previously fixed the stupid keyboard layout under X. And, of course, the effect of kbdcontrol spans logins so that it doesn't revert to default when I log out which would be OK because I could simply log out and back in before running X. I could live with that but, no.... :( Well, I hacked my .login and .logout files as a work around. In .login, I ask myself if I want to start X and use a switch statement that depends upon the reply. In the case selected if I tell it not to run X, it runs "kbdcontrol -l $HOME/mykeymap" and in the case selected if I tell it to run X it does not. In my .logout I have the line "kbdcontrol -l /usr/share/syscons/keymaps/us.iso.kbd" to put things back to default. Kludgy but it seems to be working. I haven't tried (yet) getting rid of my .Xmodmap and seeing if the kbdcontrol change is propagated to X but I'm not optimistic. Something (that I've forgotten) seemed to imply that that would not work. My question is: Is there a better way? Clearly a sane keyboard layout would be the ideal but that is not an option (unless a Sun Type 5 Unix keyboard would work and someone would like to donate one. :) that is available. Thanks for reading a too-long post and for any information you may be able to provide. -- Best, Charlie "Older than dirt" Sorsby "I'm the NRA!" crs@swcp.com crs@hamlet.lanl.gov Life Member since 1965