You can use Karabiner app on OS X to remap all keys the way you want. In my case I needed keys similar to "PC keyboards" for programming purpose. Karabiner itself supports pretty much everything you want to do with it and it can override the default behaviour leaving the original at the background without performance decrease. As utility tool to support Karabiner configuration, you should install Key Codes app, you can find this through App Store. It gives you exact keycode to be used with Karabiner if you want to map key combination which is not mentioned in the Karabiner KeyCode list
After installing open Karabiner from your top bar (sorry, os x terms are still bad for me) and choose preferences. When app opens go to tab "Misc and Uninstall" and click on "Open private.xml". This should be blank at first.
Add next root element to it:
<?xml version="1.0"?>
<root>
...<item>items here</item>...
</root>
Next you can add item elements; each item consists name, identifier and autogen elements (There are more properties/elements but simplified is enough). Each item element in this tutorial is constructed in next form:
<item>
<name>Name shown in Karabiner</name>
<identified>unique.id</identifier>
<autogen>*actual code*</autogen>
</item>
So how to get AltGr and few examples of those keys I badly needed
AltGr:
R_CMD as Alt Gr.
private.altgr
KeyToKey
KeyCode::COMMAND_R,
KeyCode::SHIFT_L, ModifierFlag::OPTION_L
Quick walkie;
KeyToKey replaces key event,
First line: KeyCode::COMMAND_R is the trigger event for what key is pressed.
Second line: The combined key combination I want for the right command key.
For future the combination shift_l and option_l is required as right command key now acts as shift + option/alt.
Here is pipe symbol which I wanted to right spot.
<item>
<name>Add PIPE to right place</name>
<identifier>private.pipe</identifier>
<autogen>
__KeyToKey__
KeyCode::RawValue::0x32, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L,
KeyCode::7, ModifierFlag::OPTION_L
</autogen>
</item>
After KeyToKey there is the trigger again with shift and option flags (as that's what right command is now). The RawValue is actually '<' symbol that I got using Key Codes App. When using KeyCodes you always need to have ::RawValue after KeyCode.
The next line is what I needed to mimic with that action. The true key combination for Finnish layout is 7 + option/alt so that is triggered to get the pipe to "AltGr" + "<".
At the end of all remapping I wanted to get back my command + return event. This for example is used with facebook chat:
<item>
<name>R CMD ENTER to Normal</name>
<identifier>private.enter</identifier>
<autogen>
__KeyToKey__
KeyCode::RETURN, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L,
KeyCode::RETURN, ModifierFlag::COMMAND_R
</autogen>
</item>
For all I keep repeating the SHIFT_L | OPTION_L combination, as that is still what right command triggers. Here's partial of my file. Here is non-clickable link to the gist (I do not have enough reputation) gist(dot)github(dot)com/the-dunnock/c4f83b0cba7c0bb97f89.
<?xml version="1.0"?>
<root>
<item>
<name>R_CMD as Alt Gr.</name>
<identifier>private.altgr</identifier>
<autogen>
__KeyToKey__
KeyCode::COMMAND_R,
KeyCode::SHIFT_L, ModifierFlag::OPTION_L
</autogen>
</item>
<item>
<name>Add PIPE to right place</name>
<identifier>private.pipe</identifier>
<autogen>
__KeyToKey__
KeyCode::RawValue::0x32, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L,
KeyCode::7, ModifierFlag::OPTION_L
</autogen>
</item>
<item>
<name>Add Dollar symbol to right place</name>
<identifier>private.dollar</identifier>
<autogen>
__KeyToKey__
KeyCode::RawValue::0x15, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L,
KeyCode::4, ModifierFlag::OPTION_L
</autogen>
</item>
<name>R CMD ENTER to Normal</name>
<identifier>private.enter</identifier>
<autogen>
__KeyToKey__
KeyCode::RETURN, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L,
KeyCode::RETURN, ModifierFlag::COMMAND_R
</autogen>
</item>
</root>