Skip to content

Instantly share code, notes, and snippets.

@zokier
Created September 9, 2011 08:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zokier/1205728 to your computer and use it in GitHub Desktop.
Save zokier/1205728 to your computer and use it in GitHub Desktop.
Stats about kb layouts
# this script calculates the use of modifier keys in different kb layouts
# kotoistus is Finnish keyboard layout (and for this purpose equivalent of Swedish layout)
# fi-intl is my custom layout, essentially US layout mixed with ö and ä letters
# us is basic US layout.
symbol_counts = {
#'a': 443776445,
#' ': 74199965, # ignore spaces for now
'_': 22890057,
',': 10895692,
')': 10749798,
'(': 10745839,
'*': 9211904,
';': 8187969,
'-': 6628768,
'=': 5878296,
'>': 4428291,
'/': 3468260,
'.': 3011078,
'{': 2212412,
'}': 2211783,
'"': 2120264,
'&': 1647188,
':': 1032587,
'+': 962554,
'#': 909859,
'[': 889538,
']': 888722,
'<': 839910,
'|': 643903,
'%': 583092,
'!': 561462,
'\\': 540456,
'\'': 454201,
'@': 131199,
'?': 112488,
'~': 84629,
'^': 19064,
'$': 17922,
'`': 7272
}
modifiers_myintl = {
#'a': 'none',
#' ': 'none', # ignore spaces for now
'_': 'shift',
',': 'none',
')': 'shift',
'(': 'shift',
'*': 'shift',
';': 'shift',
'-': 'none',
'=': 'none',
'>': 'altgr',
'/': 'none',
'.': 'none',
'{': 'shift',
'}': 'shift',
'"': 'shift',
'&': 'shift',
':': 'shift',
'+': 'shift',
'#': 'shift',
'[': 'none',
']': 'none',
'<': 'altgr',
'|': 'shift',
'%': 'shift',
'!': 'shift',
'\\': 'none',
'\'': 'none',
'@': 'shift',
'?': 'shift',
'~': 'shift',
'^': 'shift',
'$': 'shift',
'`': 'none'
}
modifiers_us = {
#'a': 'none',
#' ': 'none', # ignore spaces for now
'_': 'shift',
',': 'none',
')': 'shift',
'(': 'shift',
'*': 'shift',
';': 'none',
'-': 'none',
'=': 'none',
'>': 'shift',
'/': 'none',
'.': 'none',
'{': 'shift',
'}': 'shift',
'"': 'shift',
'&': 'shift',
':': 'shift',
'+': 'shift',
'#': 'shift',
'[': 'none',
']': 'none',
'<': 'shift',
'|': 'shift',
'%': 'shift',
'!': 'shift',
'\\': 'none',
'\'': 'none',
'@': 'shift',
'?': 'shift',
'~': 'shift',
'^': 'shift',
'$': 'shift',
'`': 'none'
}
modifiers_kotoistus = {
#'a': 'none',
#' ': 'none', # ignore spaces for now
'_': 'shift',
',': 'none',
')': 'shift',
'(': 'shift',
'*': 'shift',
';': 'shift',
'-': 'none',
'=': 'shift',
'>': 'shift',
'/': 'shift',
'.': 'none',
'{': 'altgr',
'}': 'altgr',
'"': 'shift',
'&': 'shift',
':': 'shift',
'+': 'none',
'#': 'shift',
'[': 'altgr',
']': 'altgr',
'<': 'none',
'|': 'altgr',
'%': 'shift',
'!': 'shift',
'\\': 'altgr',
'\'': 'none',
'@': 'altgr',
'?': 'shift',
'~': 'altgr',
'^': 'shift',
'$': 'altgr',
'`': 'shift'
}
def do_stat_stuff(layout):
modifier_counts = {
'none': 0,
'shift': 0,
'altgr': 0
}
for symbol in symbol_counts:
modifier_counts[layout[symbol]] += symbol_counts[symbol]
for modifier in modifier_counts:
print modifier, modifier_counts[modifier]
layouts = {
'fi-intl' : modifiers_myintl,
'us' : modifiers_us,
'kotoistus' : modifiers_kotoistus
}
for layout_name in layouts:
print layout_name
do_stat_stuff(layouts[layout_name])
raw_input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment