├── .gitattributes ├── Images ├── Sample_1.PNG ├── Sample_2.PNG └── StructureOfKeyboardLayout.PNG ├── LICENSE ├── QMK_KeymapToAsciiTable.py └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Images/Sample_1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeungheonOh/QMK_KeymapToAsciiTable/4b8b553dd9f7561a0ace7bb5a7dce3003a600f79/Images/Sample_1.PNG -------------------------------------------------------------------------------- /Images/Sample_2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeungheonOh/QMK_KeymapToAsciiTable/4b8b553dd9f7561a0ace7bb5a7dce3003a600f79/Images/Sample_2.PNG -------------------------------------------------------------------------------- /Images/StructureOfKeyboardLayout.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeungheonOh/QMK_KeymapToAsciiTable/4b8b553dd9f7561a0ace7bb5a7dce3003a600f79/Images/StructureOfKeyboardLayout.PNG -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 SeungheonOh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /QMK_KeymapToAsciiTable.py: -------------------------------------------------------------------------------- 1 | 2 | QMKCodeDic = { 3 | #BASICKEYCODES 4 | "KC_NO":"Null", 5 | "XXXXXXX":"Null", 6 | "_______":"", 7 | "KC_TRNS":"", 8 | "KC_A":"A", 9 | "KC_B":"B", 10 | "KC_C":"C", 11 | "KC_D":"D", 12 | "KC_E":"E", 13 | "KC_F":"F", 14 | "KC_G":"G", 15 | "KC_H":"H", 16 | "KC_I":"I", 17 | "KC_J":"J", 18 | "KC_K":"K", 19 | "KC_L":"L", 20 | "KC_M":"M", 21 | "KC_N":"N", 22 | "KC_O":"O", 23 | "KC_P":"P", 24 | "KC_Q":"Q", 25 | "KC_R":"R", 26 | "KC_S":"S", 27 | "KC_T":"T", 28 | "KC_U":"U", 29 | "KC_V":"V", 30 | "KC_W":"W", 31 | "KC_X":"X", 32 | "KC_Y":"Y", 33 | "KC_Z":"Z", 34 | "KC_1":"1", 35 | "KC_2":"2", 36 | "KC_3":"3", 37 | "KC_4":"4", 38 | "KC_5":"5", 39 | "KC_6":"6", 40 | "KC_7":"7", 41 | "KC_8":"8", 42 | "KC_9":"9", 43 | "KC_0":"0", 44 | "KC_ENTER":"Enter", 45 | "KC_ENT":"Enter", 46 | "KC_ESC":"Esc", 47 | "KC_ESCAPE":"Esc", 48 | "KC_BSPACE":"Bksp", 49 | "KC_BSPC":"Bksp", 50 | "KC_TAB":"Tab", 51 | "KC_SPACE":"Space", 52 | "KC_SPC":"Space", 53 | "KC_MINUS":"-", 54 | "KC_MINS":"-", 55 | "KC_EQL":"=", 56 | "KC_EQUAL":"=", 57 | "KC_LBRACKET":"[", 58 | "KC_LBRC":"[", 59 | "KC_RBRACKET":"]", 60 | "KC_RBRC":"]", 61 | "KC_BSLASH":"", 62 | "KC_BSLS":"", 63 | "KC_NONUS_HASH":"#", 64 | "KC_NUHS":"#", 65 | "KC_SCOLON":";", 66 | "KC_SCLN":";", 67 | "KC_QUOTE":"'", 68 | "KC_QUOT":"'", 69 | "KC_GRAVE":"`", 70 | "KC_GRV":"`", 71 | "KC_COMMA":",", 72 | "KC_COMM":",", 73 | "KC_DOT":".", 74 | "KC_SLASH":"/", 75 | "KC_SLSH":"/", 76 | "KC_CAPSLOCK":"Caps", 77 | "KC_CLCK":"Caps", 78 | "KC_CAPS":"Caps", 79 | "KC_F1":"F1", 80 | "KC_F2":"F2", 81 | "KC_F3":"F3", 82 | "KC_F4":"F4", 83 | "KC_F5":"F5", 84 | "KC_F6":"F6", 85 | "KC_F7":"F7", 86 | "KC_F8":"F8", 87 | "KC_F9":"F9", 88 | "KC_F10":"F10", 89 | "KC_F11":"F11", 90 | "KC_F12":"F12", 91 | "KC_PSCREEN":"PrtScn", 92 | "KC_PSCR":"PrtScn", 93 | "KC_SCROLLLOCK":"SclLk", 94 | "KC_SLCK":"ScrLk", 95 | "KC_PAUSE":"Paus", 96 | "KC_PAUS":"Paus", 97 | "KC_BRK":"Break", 98 | "KC_INSERT":"Break", 99 | "KC_INS":"Ins", 100 | "KC_HOME":"Home", 101 | "KC_PGUP":"PgUp", 102 | "KC_PGDN":"PgDn", 103 | "KC_DELETE":"Del", 104 | "KC_DEL":"Del", 105 | "KC_END":"End", 106 | "KC_PGDOWN":"PgUp", 107 | "KC_RIGHT":"Right", 108 | "KC_RGHT":"Right", 109 | "KC_LEFT":"Left", 110 | "KC_UP":"Up", 111 | "KC_DOWN":"Down", 112 | "KC_NUMLOCK":"#Lk", 113 | "KC_NLCK":"#Lk", 114 | "KC_KP_SLASH":"/", 115 | "KC_PSLS":"/", 116 | "KC_KP_ASTERISK":"*", 117 | "KC_PAST":"*", 118 | "KC_KP_MINUS":"-", 119 | "KC_PMNS":"-", 120 | "KC_KP_PLUS":"+", 121 | "KC_PPLS":"+", 122 | "KC_KP_ENTER":"Entr", 123 | "KC_PENT":"Entr", 124 | "KC_KP_1":"1", 125 | "KC_P1":"1", 126 | "KC_KP_2":"2", 127 | "KC_P2":"2", 128 | "KC_KP_3":"3", 129 | "KC_P3":"3", 130 | "KC_KP_4":"4", 131 | "KC_P4":"4", 132 | "KC_KP_5":"5", 133 | "KC_P5":"5", 134 | "KC_KP_6":"6", 135 | "KC_P6":"6", 136 | "KC_KP_7":"7", 137 | "KC_P7":"7", 138 | "KC_KP_8":"8", 139 | "KC_P8":"8", 140 | "KC_KP_9":"9", 141 | "KC_P9":"9", 142 | "KC_KP_0":"0", 143 | "KC_P0":"0", 144 | "KC_KP_DOT":".", 145 | "KC_PDOT":".", 146 | "KC_NONUS_BSLASH":"", 147 | "KC_NUBS":"", 148 | "KC_APPLICATION":"App", 149 | "KC_APP":"App", 150 | "KC_POWER":"Pwr", 151 | "KC_KP_EQUAL":"=", 152 | "KC_PEQL":"=", 153 | "KC_F13":"F13", 154 | "KC_F14":"F14", 155 | "KC_F15":"F15", 156 | "KC_F16":"F16", 157 | "KC_F17":"F17", 158 | "KC_F18":"F18", 159 | "KC_F19":"F19", 160 | "KC_F20":"F20", 161 | "KC_F21":"F21", 162 | "KC_F22":"F22", 163 | "KC_F23":"F23", 164 | "KC_F24":"F24", 165 | "KC_EXECUTE":"Exec", 166 | "KC_EXEC":"Exec", 167 | "KC_HELP":"Help", 168 | "KC_MENU":"Menu", 169 | "KC_SELECT":"Slct", 170 | "KC_SLCT":"Slct", 171 | "KC_STOP":"Stop", 172 | "KC_AGAIN":"Again", 173 | "KC_AGIN":"Again", 174 | "KC_UNDO":"Undo", 175 | "KC_CUT":"Cut", 176 | "KC_COPY":"Copy", 177 | "KC_PASTE":"Paste", 178 | "KC_PSTE":"Paste", 179 | "KC_FIND":"Find", 180 | "KC__MUTE":"Mute", 181 | "KC__VOLUP":"Vol+", 182 | "KC__VOLDOWN":"Vol-", 183 | "KC_LOCKING_CAPS":"Caps", 184 | "KC_LCAP":"Caps", 185 | "KC_LOCKING_NUM":"#Lk", 186 | "KC_LNUM":"#Lk", 187 | "KC_LOCKING_SCROLL":"LkScr", 188 | "KC_LSCR":"LkScr", 189 | "KC_KP_COMMA":"REPLACE", 190 | "KC_PCMM":"REPLACE", 191 | "KC_KP_EQUAL_AS400":"=", 192 | "KC_INT1":"", 193 | "KC_RO":"", 194 | "KC_INT2":"Kata", 195 | "KC_KANA":"Kata", 196 | "KC_INT3":"¥", 197 | "KC_JYEN":"¥", 198 | "KC_INT4":"Henk", 199 | "KC_HENK":"Henk", 200 | "KC_INT5":"Muhn", 201 | "KC_MHEN":"Muhn", 202 | "KC_INT6":"", 203 | "KC_INT7":"Int7", 204 | "KC_INT8":"Int8", 205 | "KC_INT9":"Int9", 206 | "KC_LANG1":"En/Ha", 207 | "KC_HAEN":"En/Ha", 208 | "KC_LANG2":"Hanja", 209 | "KC_HANJ":"Hanja", 210 | "KC_LANG3":"Kata", 211 | "KC_LANG4":"Hira", 212 | "KC_LANG5":"Zenk", 213 | "KC_LANG6":"Lang6", 214 | "KC_LANG7":"Lang7", 215 | "KC_LANG8":"Lang8", 216 | "KC_LANG9":"Lang9", 217 | "KC_ALT_ERASE":"Erase", 218 | "KC_ERAS":"Erase", 219 | "KC_SYSREQ":"Attn", 220 | "KC_CANCEL":"Cncl", 221 | "KC_CLEAR":"Clr", 222 | "KC_CLR":"Clr", 223 | "KC_PRIOR":"Prior", 224 | "KC_RETURN":"Rtrn", 225 | "KC_SEPARATOR":"Sep", 226 | "KC_OUT":"Out", 227 | "KC_OPER":"Oper", 228 | "KC_CLEAR_AGAIN":"ClAg", 229 | "KC_EXSEL":"ExSel", 230 | "KC_LCTRL":"Ctrl", 231 | "KC_LCTL":"Ctrl", 232 | "KC_LSHIFT":"Shft", 233 | "KC_LSFT":"Shft", 234 | "KC_LALT":"Alt", 235 | "KC_LGUI":"Gui", 236 | "KC_LCMD":"Cmd", 237 | "KC_LWIN":"Win", 238 | "KC_RCTRL":"Ctrl", 239 | "KC_RCTL":"Ctrl", 240 | "KC_RSHIFT":"Shft", 241 | "KC_RSFT":"Shft", 242 | "KC_RALT":"Alt", 243 | "KC_ALGR":"Alt", 244 | "KC_RGUI":"Gui", 245 | "KC_RCMD":"Cmd", 246 | "KC_RWIN":"Win", 247 | "KC_SYSTEM_POWER":"Pwr", 248 | "KC_PWR":"Pwr", 249 | "KC_SYSTEM_SLEEP":"Sleep", 250 | "KC_SLEP":"Sleep", 251 | "KC_SYSTEM_WAKE":"Wake", 252 | "KC_WAKE":"Wake", 253 | "KC_AUDIO_MUTE":"Mute", 254 | "KC_MUTE":"Mute", 255 | "KC_AUDIO_VOL_UP":"Vol+", 256 | "KC_VOLU":"Vol+", 257 | "KC_AUDIO_VOL_DOWN":"Vol-", 258 | "KC_VOLD":"Vol-", 259 | "KC_MEDIA_NEXT_TRACK":"Next", 260 | "KC_MNXT":"Next", 261 | "KC_MEDIA_PREV_TRACK":"Prev", 262 | "KC_MPRV":"Prev", 263 | "KC_MEDIA_STOP":"Stop", 264 | "KC_MSTP":"Stop", 265 | "KC_MEDIA_PLAY_PAUSE":"Play", 266 | "KC_MPLY":"Play", 267 | "KC_MEDIA_SELECT":"Slct", 268 | "KC_MSEL":"Slct", 269 | "KC_MEDIA_EJECT":"Ejct", 270 | "KC_EJCT":"Ejct", 271 | "KC_MAIL":"Mail", 272 | "KC_CALCULATOR":"Calc", 273 | "KC_CALC":"Calc", 274 | "KC_MY_COMPUTER":"MyPC", 275 | "KC_MYCM":"MyPC", 276 | "KC_WWW_SEARCH":"Srch", 277 | "KC_WSCH":"Srch", 278 | "KC_WWW_HOME":"Home", 279 | "KC_WHOM":"Home", 280 | "KC_WWW_BACK":"Back", 281 | "KC_WBAK":"Back", 282 | "KC_WWW_FORWARD":"Frwd", 283 | "KC_WFWD":"Frwd", 284 | "KC_WWW_STOP":"Stop", 285 | "KC_WSTOP":"Stop", 286 | "KC_WWW_REFRESH":"Rfsh", 287 | "KC_WREF":"Rfsh", 288 | "KC_WWW_FAVORITES":"Fav", 289 | "KC_WFAV":"Fav", 290 | "KC_MEDIA_FAST_FORWARD":">>", 291 | "KC_MFFD":">>", 292 | "KC_MEDIA_REWIND":"<<", 293 | "KC_MRWD":"<<", 294 | "KC_BRIGHTNESS_UP":"Brt+", 295 | "KC_BRIU":"Brt+", 296 | "KC_BRIGHTNESS_DOWN":"Brt-", 297 | "KC_BRID":"Brt-", 298 | 299 | #QUANTUMKEYCODES 300 | "RESET":"Reset", 301 | "DEBUG":"Debug", 302 | "EEPROM_RESET":"EepRst", 303 | "EEP_RST":"EepRst", 304 | "KC_GESC":"`/Esc", 305 | "GRAVE_ESC":"`/Esc", 306 | "KC_LSPO":"Shf/(", 307 | "KC_RSPC":"Shf/)", 308 | "KC_LEAD":"Lead", 309 | "KC_LOCK":"Lock", 310 | 311 | #cantdothesern(M,MACROTAP), 312 | 313 | #AUDIOKEYS 314 | "AU_ON":"AuOn", 315 | "AU_OFF":"AuOff", 316 | "AU_TOG":"AuTog", 317 | "CLICKY_TOGGLE":"CkTog", 318 | "CK_TOGG":"CkTog", 319 | "CLICKY_UP":"CkUp", 320 | "CK_UP":"CkUp", 321 | "CLICKY_RESET":"CkRst", 322 | "CK_RST":"CkRst", 323 | "MU_ON":"MuOn", 324 | "MU_OFF":"MuOff", 325 | "MU_TOG":"MuTog", 326 | "MU_MOD":"MuMod", 327 | "MI_ON":"MiOn", 328 | "MI_OFF":"MiOff", 329 | "MUV_DE":"Voice-", 330 | "MUV_IN":"Voice+", 331 | 332 | #BACKLIGHTING 333 | "BL_TOGG":"BLTog", 334 | "BL_STEP":"BLStp", 335 | "BL_ON":"BLOn", 336 | "BL_OFF":"BLOff", 337 | "BL_INC":"BL+", 338 | "BL_DEC":"BL-", 339 | "BL_BRTG":"BLBrt", 340 | 341 | #BOOTMAGICNOTSUPPORTED 342 | 343 | #BLUETOOTH 344 | "OUT_AUTO":"Auto", 345 | "OUT_USB":"FUSB", 346 | "OUT_BT":"FBT", 347 | 348 | #LAYERSWITCHINGNOTSUPPORTED 349 | 350 | #MOUSEKEYS 351 | "KC_MS_UP":"MSUp", 352 | "KC_MS_U":"MSUp", 353 | "KC_MS_DOWN":"MSDw", 354 | "KC_MS_D":"MSDw", 355 | "KC_MS_LEFT":"MSLft", 356 | "KC_MS_L":"MSLf", 357 | "KC_MS_RIGHT":"MSRgt", 358 | "KC_MS_R":"MSRgt", 359 | "KC_MS_BTN1":"MSB1", 360 | "KC_BTN1":"MSB1", 361 | "KC_MS_BTN2":"MSB2", 362 | "KC_BTN2":"MSB2", 363 | "KC_MS_BTN3":"MSB3", 364 | "KC_BTN3":"MSB3", 365 | "KC_MS_BTN4":"MsB4", 366 | "KC_BTN4":"MSB4", 367 | "KC_MS_BTN5":"MSB5", 368 | "KC_BTN5":"MSB5", 369 | "KC_MS_WH_UP":"WHUp", 370 | "KC_WH_U":"WHUp", 371 | "KC_MS_WH_DOWN":"WHDw", 372 | "KC_WH_D":"WHDw", 373 | "KC_MS_WH_LEFT":"WHLft", 374 | "KC_WH_L":"WHLft", 375 | "KC_MS_WH_RIGHT":"WHRgt", 376 | "KC_WH_R":"WHLft", 377 | "KC_MS_ACCEL0":"Acl0", 378 | "KC_ACL0":"Acl0", 379 | "KC_MS_ACCEL1":"Acl1", 380 | "KC_ACL1":"Acl1", 381 | "KC_MS_ACCEL2":"Acl2", 382 | "KC_ACL2":"Acl2", 383 | 384 | #MODIFIERSNOTSUPPORTED 385 | 386 | #MOD-TAPKEYSNOTSUPPORTED 387 | 388 | #USANSISHIFTEDSYMBOLS 389 | "KC_TILDE":"~", 390 | "KC_TILD":"~", 391 | "KC_EXCLAIM":"!", 392 | "KC_EXLM":"!", 393 | "KC_AT":"@", 394 | "KC_HASH":"#", 395 | "KC_DOLLAR":"$", 396 | "KC_DLR":"$", 397 | "KC_PERCENT":"%", 398 | "KC_PERC":"%", 399 | "KC_CIRCUMFLEX":"^", 400 | "KC_CIRC":"^", 401 | "KC_AMPERSAND":"&", 402 | "KC_AMPR":"&", 403 | "KC_ASTERISK":"*", 404 | "KC_ASTR":"*", 405 | "KC_LEFT_PAREN":"(", 406 | "KC_LPRN":"(", 407 | "KC_RIGHT_PAREN":")", 408 | "KC_RPRN":")", 409 | "KC_UNDERSCORE":"_", 410 | "KC_UNDS":"_", 411 | "KC_PLUS":"+", 412 | "KC_LEFT_CURLY_BRACE":"{", 413 | "KC_LCBR":"{", 414 | "KC_RIGHT_CURLY_BRACE":"}", 415 | "KC_RCBR":"}", 416 | "KC_PIPE":"|", 417 | "KC_COLON":"", 418 | "KC_COLN":"", 419 | "KC_DOUBLE_QUOTE":"", 420 | "KC_DQUO":"", 421 | "KC_DQT":"", 422 | "KC_LEFT_ANGLE_BRACKET":"<", 423 | "KC_LABK":"<", 424 | "KC_LT":"<", 425 | "KC_RIGHT_ANGLE_BRACKET":">", 426 | "KC_RABK":">", 427 | "KC_GT":">", 428 | "KC_QUESTION":"?", 429 | "KC_QUES":"?", 430 | 431 | #ONESHOTKEYSNOTSUPPORTED 432 | 433 | #SWAPHANDS(SH_T(),NOTSUPPORTED), 434 | "SW_ON":"SWOn", 435 | "SW_OFF":"SWOff", 436 | "SH_MON":"SHMmt", 437 | "SH_MOFF":"SHMof", 438 | "SH_TG":"SHTog", 439 | "SH_TT":"SHTgM", 440 | 441 | #RGBCodes 442 | "RGB_TOG":"LdTog", 443 | "RGB_MODE_FORWARD":"LdM+", 444 | "RGB_MOD":"LdM+", 445 | "RGB_MODE_REVERSE":"LdM-", 446 | "RGB_RMOD":"LdM-", 447 | "RGB_HUI":"LdH+", 448 | "RGB_HUD":"LdH-", 449 | "RGB_SAI":"LdS+", 450 | "RGB_SAD":"LdS-", 451 | "RGB_VAI":"LdV+", 452 | "RGB_VAD":"LdV-", 453 | "RGB_SPI":"LdSp+", 454 | "RGB_SPD":"LdSp-", 455 | "RGB_MODE_PLAIN":"LdSt", 456 | "RGB_M_P":"LdSt", 457 | "RGB_MODE_BREATHE":"LdBr", 458 | "RGB_M_B":"LdBr", 459 | "RGB_MODE_RAINBOW":"LdRb", 460 | "RGB_M_R":"LdRb", 461 | "RGB_MODE_SWIRL":"LdSw", 462 | "RGB_M_SW":"LdSw", 463 | "RGB_MODE_SHAKE":"LdSh", 464 | "RGB_M_SH":"LdSh", 465 | "RGB_MODE_KNIGHT":"LdKn", 466 | "RGB_M_K":"LdKn", 467 | "RGB_MODE_XMAS":"LdXm", 468 | "RGB_M_X":"LdXm", 469 | "RGB_MODE_GRADIENT":"LdGd", 470 | "RGB_M_G":"LdGd", 471 | "RGB_MODE_RGBTEST":"LdTs", 472 | "RGB_M_T":"LdTs", 473 | 474 | #SPECIAL 475 | "BACKLIT":"Light", 476 | "MO(":"", 477 | "RAISE":"Raise", 478 | "LOWER":"Lower", 479 | 480 | #THERMALPRINTER 481 | "PRINT_ON":"PrtOn", 482 | "PRINT_OFF":"PrtOff", 483 | 484 | #PLOVER 485 | "EXT_PLV":"Exit", 486 | 487 | #BOOTMAGIC? 488 | "AG_NORM":"AGNrm", 489 | "AG_SWAP":"AGSwp", 490 | "TERM_ON":"TermOn", 491 | "TERM_OFF":"TermOf", 492 | 493 | #UNICODETEMPSOLUTION 494 | "UC":"", 495 | 496 | #commonlayers 497 | "QWERTY":"Qwerty", 498 | "COLEMAK":"Colmak", 499 | "DVORAK":"Dvorak", 500 | "PLOVER":"Plover", 501 | 502 | #NONUSHASHANDSLASH 503 | "S(KC_NUHS)":"ISO#", 504 | "S(KC_NUBS)":"ISO/", 505 | "KC_CTCP":"Ctr/Cp", 506 | "KC_RSSH":"Shf/", 507 | 508 | #ENDINGREPLACEMENTS 509 | ")":"", 510 | "":"", 511 | "":"│", 512 | "REPLACE│":"", 513 | "Space│Space│":"Space│", 514 | "_":"" 515 | } 516 | 517 | import json 518 | 519 | try: 520 | fileInput = open("keymap.c","r") 521 | fileInput = fileInput.readlines() 522 | 523 | 524 | 525 | layerStarts = False 526 | keymapStarts = False 527 | 528 | layers = [] 529 | keymaps = [] 530 | keymapTemp = [] 531 | 532 | Btop='┬' #top fill lines 533 | Bmid='┼' #middle row fill lines 534 | Blow='┴' 535 | 536 | 537 | file=open('comment.txt','w+',encoding='utf-8') 538 | file.write('\n') 539 | 540 | 541 | for line in fileInput: 542 | line = line.replace('\n', '') 543 | line = line.replace('\\', '') 544 | line = line.replace(' ', '') 545 | if 0 >= len(line): 546 | continue 547 | if line[0] == '*' or line[0] == '/': 548 | continue 549 | 550 | if layerStarts == True and line.count('};'): 551 | layerStarts = False 552 | 553 | if layerStarts: 554 | line = line.replace(',', '') 555 | line = line.replace('_', '') 556 | layers.append(line) 557 | 558 | if line.count('layers{'): 559 | layerStarts = True 560 | 561 | if keymapStarts and line[0] == ')': 562 | print("Layer '{0}' have been added".format(keymapStarts),file=file) 563 | keymaps.append(keymapTemp) 564 | keymapStarts = False 565 | keymapTemp = [] 566 | 567 | if keymapStarts: 568 | if line[len(line)-1] == ',': 569 | line = line[:-1] 570 | line = line.split(',') 571 | keymapTemp.append(line) 572 | 573 | if len(layers) > 0 and layerStarts == False: 574 | for layer in layers: 575 | if line.count("[_{0}]".format(layer)): 576 | keymapTemp.append(layer) 577 | keymapStarts = layer 578 | 579 | assert len(layers) > 0, "No Layer Found" 580 | assert len(keymaps) > 0, "No Keymap Found" 581 | 582 | print('',file=file) 583 | 584 | 585 | try: 586 | with open("KeyboardLayout.json", "r+") as jsonfile: 587 | pass 588 | except: 589 | print('Generating layout file') 590 | with open("KeyboardLayout.json", "w") as jsonfile: 591 | print("{", file= jsonfile) 592 | KeymapLayout = keymaps[0][1:] 593 | rowIndex = 0 594 | for row in KeymapLayout: 595 | print("\"{0}\": ".format(rowIndex),file=jsonfile) 596 | print("{",file=jsonfile) 597 | keyIndex = 0 598 | for key in row: 599 | print("\"{0}\": 1".format(keyIndex),file=jsonfile, end='') 600 | if keyIndex != len(row)-1: 601 | print(',',file=jsonfile, end='') 602 | print(file=jsonfile) 603 | keyIndex += 1 604 | print("}",file=jsonfile, end='') 605 | if rowIndex != len(keymaps[0])-2: 606 | print(',',file=jsonfile, end='') 607 | print(file=jsonfile) 608 | rowIndex += 1 609 | print("}", file= jsonfile) 610 | jsonfile.close() 611 | print('Layout file generated, Modify KeyboardLayout.json, and re-run this script. \nRemeber this script does not supports keys sized in decimals USE INT NUMBER ONLY') 612 | 613 | 614 | with open("KeyboardLayout.json", "r") as jsonfile: 615 | layout = json.load(jsonfile) 616 | for keymap in keymaps: 617 | keysize = 2 618 | print("/* {0}".format(keymap[0]),file=file) 619 | 620 | print('',file=file) 621 | print(" * ┌", end='',file=file) 622 | for i in range(len(keymap[1])-1): 623 | for _ in range(7 * layout["{0}".format(0)]["{0}".format(i)] - 1): 624 | print('─', end='', file=file) 625 | print(Btop, end='',file=file) 626 | for _ in range(7 * layout["{0}".format(0)]["{0}".format(len(keymap[1])-1)] - 1): 627 | print('─', end='', file=file) 628 | print("┐", end='',file=file) 629 | 630 | 631 | for i in range(len(keymap)-1): 632 | keysize = 2 633 | print('',file=file) 634 | print(" * ", end='',file=file) 635 | print("│", end='',file=file) 636 | itemIndex = 0 637 | for item in keymap[i+1]: 638 | spaces = int(((7 * layout["{0}".format(i)]["{0}".format(itemIndex)] - 1 - len(QMKCodeDic[item]))) /2) + (len(QMKCodeDic[item]) - 1 + layout["{0}".format(i)]["{0}".format(itemIndex)])%2 639 | for _ in range(spaces): 640 | print(' ', end='', file=file) 641 | print(QMKCodeDic[item], end='',file=file) 642 | for _ in range(spaces - (len(QMKCodeDic[item]) - 1 + layout["{0}".format(i)]["{0}".format(itemIndex)])%2): 643 | print(' ', end='', file=file) 644 | print('│', end='',file=file) 645 | itemIndex += 1 646 | 647 | 648 | print('',file=file) 649 | print(" * ", end='',file=file) 650 | print("", end='',file=file) 651 | itemIndex = 0 652 | for j in range(len(keymap[i+1])): 653 | #print(j,len(keymap[i+1]), end='') 654 | if j == 0 and i == len(keymap)-2: 655 | print("└", end='',file=file) 656 | 657 | elif j == 0: 658 | print("├", end='',file=file) 659 | 660 | elif j == len(keymap[i+1])-1 and i != len(keymap)-2: 661 | for _ in range(7 * layout["{0}".format(i)]["{0}".format(itemIndex)] - 1): 662 | print('─', end='', file=file) 663 | print("┤", end='',file=file) 664 | break 665 | 666 | if not i == 0 and (j == len(keymap[i+1])-1 and (j > len(keymap[i])-1 or i == len(keymap)-2)): 667 | for _ in range(7 * layout["{0}".format(i)]["{0}".format(itemIndex)] - 1): 668 | print('─', end='', file=file) 669 | print("┘", end='',file=file) 670 | elif i == len(keymap)-2 or j > len(keymap[i+2])-1: 671 | for _ in range(7 * layout["{0}".format(i)]["{0}".format(itemIndex)] - 1): 672 | print('─', end='', file=file) 673 | print(Blow, end='',file=file) 674 | else: 675 | for _ in range(7 * layout["{0}".format(i)]["{0}".format(itemIndex)] - 1): 676 | print('─', end='', file=file) 677 | print(Bmid, end='',file=file) 678 | itemIndex += 1 679 | 680 | if i == len(keymap)-2: 681 | break 682 | 683 | print('',file=file) 684 | print(" */",file=file) 685 | print('',file=file) 686 | 687 | file.close() 688 | 689 | except: 690 | print("You should execute this script the same directory where you keymap.c file is.") 691 | 692 | 693 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QMK_KeymapToAsciiTable 2 | QMK_KeymapToAsciiTable is a python script, that automates boring and time consuming task of making ASCII table for your QMK powered keyboard. It gets input from `keymap.c` QMK format file, in it's directory, make a new file called `comment.txt`, that contains searched keylayers and of course ASCII table. 3 | 4 | This script is based on basic Python, should work in every devices that has Python installed :O 5 | 6 | 7 | # How to use? 8 | 1. put the script file in the same path where your keymap.c file is. 9 | 2. execute the script, it will generate file called `comment.txt` and `KeyboardLayout.json`. 10 | 3. If you are using plane Ortho-linear keyboard, You can just open `comment.txt`, and copy the result. 11 | 4. If you are not Ortho-linear keyboard user and wish to custommize keysizes you can do followings: 12 | 13 | 1. Open the `KeyboardLayout.json` file that have been generated by first time you execute the script. 14 | 2. Type in you keyboard configurations, the keysizes. For example, If you 1st row's first key is 2u, you should fine a part startes with `"0" : ` and change the first Item to 2. Remeber that the first row / key is always 0 not 1. One thing to keep in mind: this script does not support decimals for the `KeyboardLyout.json`. You should only use integers in it. 15 | 3. Re-run the script, check the re generated `comment.txt`. 16 | 17 | ![Structure of `KeyboardLayout.json`](/Images/StructureOfKeyboardLayout.PNG) 18 | 19 | 20 | 21 | # Output samples 22 | 23 | ![Sample 1](/Images/Sample_1.PNG) 24 | 25 | ![Sample 2](/Images/Sample_2.PNG) 26 | 27 | 28 | # What layout is supported? 29 | Basically, any layouts! 30 | 31 | # How to contribute? 32 | Are you considering to contribute and add helpful features? 33 | Thanks! All you have to do is: 34 | 35 | Just like other repos, 36 | Fork it, and Pull request! 37 | 38 | # ToDo: 39 | 40 | - [ ] BIG ASS ENTER support 41 | - [x] Custom layout support 42 | - [ ] Find a better way to edit keyboard layout, not editing Json by hand 43 | - [ ] Add decimal sized key(such as 1.5u) support 44 | 45 | # Thanks to... 46 | 47 | [RionLion100](https://github.com/Rionlion100) for inspirations! 48 | --------------------------------------------------------------------------------