Ukelele is a keyboard layout program. Download and run it from Desktop, seems to be able to do everything to do with keyboard layouts. This is the Apple kb document for the .keylayout files.
Could use Keyboard & Mouse/Keyboard preference pane to set Ctrl key to act as Cmd, which means that shortcut keys act when I press Ctrl, just like Windows. In Ukelele now when I press Ctrl it detects it as Cmd. So I need to set Cmd-Left and Cmd-Right to act as Word Left and Word Right. If possible.
Looking around, I think that it might not be possible by changing the layout file. The layout file doesn't really specify which command is done when Cmd is pressed - this seems to be in a key bindings file. But if that's the case then there is another way to do it, which works only for programs built on standard Cocoa text controls. That page also references a page for firefox key bindings which operate similarly.
I made the following key binding file for my system, which operates how I would like (with Cmd/Ctrl swapped so shortcuts are done with the physical Ctrl key):
{
/* Note that this file is also designed to work when Ctrl and Cmd are
swapped in keyboard preferences, so that pressing Ctrl key will
be seen as Cmd (@) here. */
/* home */
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"@\UF729" = "moveToBeginningOfDocument:";
"@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
"@\UF72B" = "moveToEndOfDocument:";
"@$\UF72B" = "moveToEndOfDocumentAndModifySelection:";
/* page up/down */
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
/* up and down */
"$\UF700" = "moveUpAndModifySelection:";
"$\UF701" = "moveDownAndModifySelection:";
"@\UF700" = "pageUp:";
"@\UF701" = "pageDown:";
/* the ideal behaviour here would to move selection to bottom of
the paragraph, but that isn't supported. Instead, move selection
down a line, which is better than the native behaviour of
selecting to the end of the document.*/
"@$\UF700" = "moveUpAndModifySelection:";
"@$\UF701" = "moveDownAndModifySelection:";
/* left and right */
"@\UF702" = "moveWordLeft:";
"@\UF703" = "moveWordRight:";
"@$\UF702" = "moveWordLeftAndModifySelection:";
"@$\UF703" = "moveWordRightAndModifySelection:";
}
When I just created this myself and put it in ~/Library/KeyBindings/DefaultKeyBinding.dict, it didn't work. I had to use the KeyFixer script/app and then edit that file, to get it to work. Don't understand why. There were two files with apparently the same name there after running their script.
You can use 'pl -input filename' to check the property list file, it sort of compiles it.
This Windows kb article explains how to remap keys in Windows, looks like it would be possible to swap Ctrl and Alt there. But that's tricky and requires rebooting, so instead AutoHotkey is an option.
Download the AutoHotkey installer and use this script, with Cmd/Ctrl swapped in keyboard and mouse, and Ctrl, Alt and Windows keys work as they should do under Windows:
Ctrl::Alt
LWin::Ctrl
Alt::LWin
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment