Merge two keyboard layouts into one
What IPA layout do you use? SIL's website has one for Dvorak. You could edit other keyboard layouts with Ukelele or directly as XML.

You could also try adding something like this to private.xml in KeyRemap4MacBook.

&lt;item&gt;
&lt;name&gt;test&lt;/name&gt;
&lt;identifier&gt;private.test&lt;/identifier&gt;
&lt;inputmode_not&gt;ROMAN&lt;/inputmode_not&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::Q, KeyCode::QUOTE&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::W, KeyCode::COMMA&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::E, KeyCode::DOT&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::R, KeyCode::P&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::T, KeyCode::Y&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::Y, KeyCode::F&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::U, KeyCode::G&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::I, KeyCode::C&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::O, KeyCode::R&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::P, KeyCode::L&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::BRACKET_LEFT, KeyCode::SLASH&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::BRACKET_RIGHT, KeyCode::EQUAL&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::S, KeyCode::O&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::D, KeyCode::E&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::F, KeyCode::U&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::G, KeyCode::I&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::H, KeyCode::D&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::J, KeyCode::H&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::K, KeyCode::T&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::L, KeyCode::N&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::SEMICOLON, KeyCode::S&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::QUOTE, KeyCode::MINUS&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::Z, KeyCode::SEMICOLON&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::X, KeyCode::Q&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::C, KeyCode::J&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::V, KeyCode::K&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::B, KeyCode::X&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::N, KeyCode::B&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::COMMA, KeyCode::W&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::DOT, KeyCode::V&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::SLASH, KeyCode::Z&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::MINUS, KeyCode::BRACKET_LEFT&lt;/autogen&gt;
&lt;autogen&gt;--KeyToKey-- KeyCode::EQUAL, KeyCode::BRACKET_RIGHT&lt;/autogen&gt;
&lt;/item&gt;


It's based on remap.qwerty2dvorak in the checkbox.xml in the test folder.

If someone else was looking for a way to change the input method when holding a key, see this question.