I learned using the Dvorak keyboard a good while ago, and when I jumped back to blending I found the constant switching between Qwerty (for sane hot keys) and Dvorak (for sane writing) annoying.
So I’ve cooked up a script to transform an existing Qwerty key configuration to one that responds to the same keys in Dvorak. The conversion map included in this script is tailored to converting the Norwegain Qwerty variant to the Norwegain Dvorak variant, and may need some adjustments in order to properly transform other variants of Qwerty to Dvorak.
If you have a custom key configuration I advice backing it up before trying to run this script, as it may end up badly scrambling your key configuration.
Usage is simple, copy the script below into a text block in Blender and run it. It will convert the current keymap and prompt for a name to save it as. After that you can load your default startup file, change the input preset in the user properties to what you just saved the keymap as, and then save the startup file.
Do not run this script twice in a row, it will scramble the key configuration. If you need to test adjustments to the conversion map, save the blend file with the script in it and restart blender between every time you try running it. It’s not requried to enter anything in the input box that saves the key configuration, which appears when running the script, it’s there for the convenience of properly saving the key configuration after it’s been converted.
# Copyright 2015 Julian Sivertsen
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation. See <http://www.gnu.org/licenses/>.
import bpy
# Mapping between the Qwerty keys, and what keys they are replaced with
# when using Dvorak. In other words. Label of the key on the keyboard
# is on the left, and the key that is registered when pressing that key is
# on the right.
# This particular map is for Norwegain Qwerty to Norwegian Dvorak.
conversion_map = {
'A': 'A',
'B': 'X',
'C': 'J',
'D': 'E',
'E': 'PERIOD',
'F': 'U',
'G': 'I',
'H': 'D',
'I': 'C',
'J': 'H',
'K': 'T',
'L': 'N',
'M': 'M',
'N': 'B',
'O': 'R',
'P': 'L',
'Q': 'RIGHT_BRACKET',
'R': 'P',
'S': 'O',
'T': 'Y',
'U': 'G',
'V': 'K',
'W': 'COMMA',
'X': 'Q',
'Y': 'F',
'Z': 'QUOTE',
'PERIOD': 'V',
'COMMA': 'W',
'MINUS': 'Z',
'SEMI_COLON': 'SEMI_COLON',
'RIGHT_BRACKET': 'SLASH',
'ACCENT_GRAVE': 'S',
'QUOTE': 'MINUS',
# Slash becomes an unbindable key. The unbindable key in turn
# becomes Accent grave. No support for 105 key keyboards :(
'SLASH': 'ACCENT_GRAVE',
}
wm = bpy.context.window_manager
# Transform the keys using the conversion_map
for km in wm.keyconfigs.user.keymaps:
for kmi in km.keymap_items:
if kmi.key_modifier in conversion_map:
kmi.key_modifier = conversion_map[kmi.key_modifier]
if kmi.type in conversion_map:
kmi.type = conversion_map[kmi.type]
# Ask the user for a name to save the preset as
bpy.ops.wm.keyconfig_preset_add('INVOKE_DEFAULT')