Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Swap caps lock and control key positions System
I know that a lot of people have been waiting for a solution to the capslock/control problem under Panther. Well ... I just finished modifying the keyboard driver for the G4 PowerBooks (it may well work on other ADB keyboard machines). This driver will map the capslock and enter keys to control. Download the installer [415KB download]. The installer will install the driver to your system. Inside the installer package is the source of the new driver, and the diffs with the stock Apple driver.

PLEASE read the messages in the installer before hitting the install button!

[robg adds:I have not tested the new driver, but I know people have been waiting for it, so here it is. Since the source and diff files are included, it should be easy to verify that nothing bad is happening with the modified driver. According to the author, this should work on Jaguar as well.]
    •    
  • Currently 2.71 / 5
  You rated: 5 / 5 (7 votes cast)
 
[33,779 views]  

10.3: Swap caps lock and control key positions | 13 comments | Create New Account
Click here to return to the '10.3: Swap caps lock and control key positions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Swap caps lock and control key positions
Authored by: dborod on Nov 07, '03 11:20:50AM

This is really good news, but has anyone figured out how to turn the enter key on my TiBook into another function (fn) key under Panther?



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: metameta on Nov 07, '03 03:08:12PM

I'm hoping I can modify this driver to map the enter key to esc.

The esc key is sooo tiny on the powerbook, its painful using vi,
where esc is the most used key.

Though looking at the source, i think it might already swap "`"
and "esc". Shouldn't be too hard to swap in the enter key code.



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: snark on Nov 07, '03 04:24:44PM

That one is easier - you won't have to compile anything:
Edit /System/Library/Extensions/AppleADBKeyboard.kext/Contents/Info.plist as root,
find a key "ADBVirtualKeys" followed by a bunch of hex codes, find the '0x34' (the postition for the enter keys code) and replace it with '0x35' (the code for the escape key).
Then 'touch /System/Library/Extensions' and reboot.
From now on, the enter key should generate the escape code.

This table holds a replacement code for each (plain) ADB key code.
By default, it is configured to replace every code with itself.
Fiddling with modifier keys (cmd, alt, shift, control) ist way harder and dancing around the ADB keyboards hardwired logic for the capslock and Fn keys is the really tricky part.



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: cryptlib on Nov 09, '03 05:06:32AM

How did you find out which keycode corresponds to enter and escape? Myself, I'd rather have the tilde key generate escape and the enter key generate tilde, because escape to the left of 1 is how god intended Vi to be used.



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: n8gray on Nov 10, '03 05:13:43PM

If you poke around in the ADB keyboard source code you should be able to find a list of keycodes. IIRC only the modifier keys are listed explicitly. To figure out the code for ~ I think you'll have to do some experimentation.



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: snark on Nov 11, '03 05:04:47AM

Use good old (classic) ResEdit and edit a KCHR Ressource. It shows, which ADB code correspond to which key.

Also, if you only want to remap non-modifiers, creating a new KCHR ressource with ResEdit and storing its ressource fork in the data fork of a file ~/Library/KeybiardLayouts/MyLayout.rsrc does the trick even better - without patching anything in /System.
You can then select your new Layout in SystemPrefs-> Languages -> Keyboard



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: arjunraj on Nov 10, '03 02:34:13PM

Actually, this program already might have that option built in. Check out ADBControlFix.pkg/Contents/Resources/Welcome.rtf



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: n8gray on Nov 07, '03 12:07:34PM
I did a similar hack that allows me to remap modifiers arbitrarily. It's not so useful to have Control in Capslock position when all Mac shortcuts use Command. With my remapping I've got Capslock sending Command, Command sending Control, and Control sending Capslock. Even more sick: under X I remap again (using xmodmap) so that Capslock sends Control and Command sends Meta. It sounds confusing but it actually simplifies my life considerably. Shortcuts always use the capslock key, whether in X or OS X. Copy and paste is always Capslock-C Capslock-V, no matter which two apps I'm cutting and pasting from/to (other than, say, xterm...).

Unfortunately my hack only works for USB keyboards -- it doesn't help with my PowerBook Al. Fortunately uControl has finally been ported to Panther. I'm still using my hack because I do have occasional use for capslock and uControl can't map any other key to it. Plus, well, I did write it, and I do think that my solution is cleaner for USB keyboards -- it remaps at a lower level.

[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: n8gray on Nov 09, '03 01:24:32AM
Somebody asked, so if you're interested in my hacked driver you can get it here.

[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: sapporo on Nov 08, '03 10:11:23AM

I think I found the sources to the modified driver in ADBControlFix.pkg/Contents/Resources/AppleADBKeyBoard.tar.gz, but I couldn't find the diff to the original sources. So, if I wanted to create these myself, were would I download the original sources. Anyone have an URL at hand?

Thanks,
-sapporo.



[ Reply to This | # ]
10.3: Swap caps lock and control key positions
Authored by: snark on Nov 08, '03 04:35:15PM

Go to http://www.opensource.apple.com/darwinsource/ (free registration as an apple developer required before actual source access). He seems to have used the 10.2.8 sources as a base - but applying the diff to the 10.3 sources should work as well.

And while you are at it: you can modify the 10.3 sources to get real F-keys without the Fn-mess: edit AppleADBKeyboard.cpp Funktion setFKeyMode and insert a new line 233 that says

    mode = (mode ? 0 : 1) ;
This reverts the Fn-Key logic for F-Keys, and even survives sleeping or working with UniversalAccess... (but patching driver sources is nothing for the faint at heart - do it at your own risk!)



[ Reply to This | # ]
Map Apple Keyboard to Mimic Windows
Authored by: charles2003 on Nov 10, '03 02:58:27AM

Though, I'd really rather be able to re-map my Windows computer to have the keyboard mimic Apple's keyboard (That is have the CONTROL key under the thumb rather than the little finger.), the next best thing would be able to re-map my Mac, so the command-key is under the little finger, thus being able to use the same "muscle-memory" commands for both platforms. (cntrl-c = command-c for copy, etc.)

Has anyone made such a re-mapping? Or is anyone will to write one and post it here?



[ Reply to This | # ]
Map Apple Keyboard to Mimic Windows
Authored by: n8gray on Nov 10, '03 04:57:12PM

The hack I mentioned above can do this on a USB keyboard, along with any other remapping of modifier keys.



[ Reply to This | # ]