Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

Customizing OS X keyboard

In order to change the mapping of the keyboard in OS X you must use Ukelele or a similar program to create a keylayout XML file in ~/Library/Keyboard Layouts. Once this file is created, it is available for use via System Preferences -> International -> Input Menu -> check the keyboards you want available for use.

Within Ukelele goto File -> New -> Copy of other keyboard layout -> (Within Finder) Macintosh HD/[Ukelele install dir]/System Keyboards/Roman/French.keylayout

Now you should see a basic layout of the keyboard. Pressing control keys such as alt and ctrl should show a different set of characters on the same keyboard. Note that the Windows key is the Apple key.

Open up the Character map (also found within Internation/Input Menu and activated via the same drop down as the keyboards in the top bar) and click and drag characters where you want them active on the keyboard. When finished with the layout, save the file, something with extension keylayout and put it within ~/Library/Keyboard Layouts. Logout and log back in and use the Input Menu to search for the keyboard you just named and highlight its checkbox. The keyboard should now be available from the top bar drop down menu. In some cases you may have to rename the layout file and logout/login for the changes to take effect.

Change keyboard mapping

In order to get greater than and less than signs without using the retarded French keyboard layout for those keys, remap keys using xmodmap. For help and testing xev can show you what is being typed.

Place the following inside ~/.bashrc to have it run whenever you login.

xmodmap -e "keysym a = a A ae AE less less"
xmodmap -e "keysym z = z Z guillemotleft less greater greater"
xmodmap -e "keysym semicolon = period semicolon horizconnector multiply horizconnector multiply"
xmodmap -e "keysym ugrave = percent percent percent percent percent percent"


The order of the letters after the = sign signify the modifiers to the keypress. The first is without modifier (natural key press of 'a'. Second is with Shift. Third and fourth is after a Mode_Switch (in RedHat Linux that is pressing Shift_R + Alt_R simultaneous, in that order) but without modifier after switching modes. And the last two is with Alt_R and Alt_R + Shift_R modifiers.


To see what currently is mapped use
xmodmap -pke | less
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed