How can you customize the keyboard layout / shortcuts?

I've recently migrated from Ubuntu to Mac, but one of the features that I'm lacking most is the keyboard layout for alternative languages. I don't like to switch keyboard layouts all the time, yet at the same time I like to write using accents and diacritics, as needed in each language (Romanian, French, German, etc.).

The Romanian keyboard layout provided on Linux offers a very nice "compatibility variant", specially for programmers. Basically it's identical to the English one, but holding down the right Alt (level 3) key gives you the Romanian special characters:

Romanian keyboard layout provided on Linux

How can I have a similar functionality?

Can I at least customize it along these lines:

  • + a » ă
  • + s » ș
  • + t » ț

PS: I am aware of the Accent Menu and it's limitations.


Although it isn't exactly what you asked for, one possible solution is to use the built-in ability to rapidly switch Input Sources (aka keyboard layouts). To make this function useable, you'll need to do a little setup.

Open System Preferences: Keyboard and select the Keyboard Pane. Check the option to Show Keyboard & Character Viewers in menu bar (1), then click on the Input Sources… button (2).

image of Keyboard preferences pane

The Language and Text preference pane will open to the Input Sources tab. Select the input sources (3) you want to access on a regular basis. Fewer is better, remember you can always return to this tab and change your selections. When you've made your choices click on the Keyboard Shortcuts… button (4).

image of Language & Text pane Input Sources tab

The Keyboard preferences pane will open to the Keyboard Shortcuts tab. Select Keyboard and Text Input from the column on the left (5). Then check the options to enable the keyboard shortcuts to navigate between input sources. (6).

image of Keyboard preferences pane Keyboard Shortcuts tab

If you stay with the default shortcuts, they will conflict with the default Spotlight shortcuts. Select Spotlight from the column on the left, and either deactivate or change the keyboard shortcut assigned to the Spotlight functions.

image of Keyboard preferences pane Keyboard Shortcuts tab

Now when you need to type a special character, use the hotkey to select the appropriate Input Source and use Lion's long hold function to bring up the choices for each character.

I am currently using Romanian as my Input Source . I know this because it's displayed in the Keyboard and Character Viewers menu item. A long press on a provides:

image of Special Key selection and Keyboard & Character menubar item and special character choices

Once I've typed the Romanian character, I can use the keyboard shortcut to return to the U.S. input source.


Since you're coming from a Linux background, I think you'd feel right at home with my suggestion of reading about DefaultKeyBinding.dict file.

You use Ukelele as suggested above for the layouts of accented letters and such. But the keyboard bindings comes handy for programmers shortcuts and special keys.

Google up the file name and you'll have many links and tutorials on the subject. One reference link would be Apple's NSResponder Class Reference which lists all possible actions you can perform in any Cocoa applications using custom keybindings.


The US Extended layout may suit your needs. A chart is at

http://homepage.mac.com/thgewecke/diacritics.html

It's very easy to make your own with

http://scripts.sil.org/ukelele