monkeytype icon indicating copy to clipboard operation
monkeytype copied to clipboard

refactor: split key labels in layout files (@fehmer)

Open fehmer opened this issue 7 months ago • 5 comments

wip

fehmer avatar May 05 '25 07:05 fehmer

code used to transform the layout files:

const { readFileSync, readdirSync, writeFileSync } = require("fs");
const layouts = readdirSync("./static/layouts");

for (const layoutFile of layouts) {
  const layout = JSON.parse(readFileSync("./static/layouts/" + layoutFile));
  const isLegacy = !Array.isArray(layout.keys["row1"][0]);

  if (!isLegacy) continue;

  for (let rowName of Object.keys(layout.keys)) {
    const newRow = [];
    let srcRow = layout.keys[rowName];

    for (const char of srcRow) {
      newRow.push(unicodeSplit(char));
    }
    layout.keys[rowName] = newRow;
  }

  writeFileSync(
    "./static/layouts/" + layoutFile,
    JSON.stringify(layout, undefined, 2)
  );
}

function unicodeSplit(s) {
	const split = [];
	for (const c of s){
	  split.push(c);
	}
	return split;
}

fehmer avatar May 05 '25 07:05 fehmer

#6482

ghost avatar May 05 '25 11:05 ghost

No way bro 💀 const keycode = layoutKeyToKeycode("🤷", `isoDvorak);

ghost avatar May 05 '25 12:05 ghost

file graphemer unicode
arabic_101.json:row1:0 ذّ ذ,ّ
arabic_101.json:row2:0 ضَ ض,َ
arabic_101.json:row2:1 صً ص,ً
arabic_101.json:row2:2 ثُ ث,ُ
arabic_101.json:row2:3 قٌ ق,ٌ
arabic_101.json:row3:0 شِ ش,ِ
arabic_101.json:row3:1 سٍ س,ٍ
arabic_101.json:row4:1 ءْ ء,ْ
arabic_102.json:row2:0 ضَ ض,َ
arabic_102.json:row2:1 صً ص,ً
arabic_102.json:row2:2 ثُ ث,ُ
arabic_102.json:row2:3 قٌ ق,ٌ
arabic_102.json:row2:12 ذّ ذ,ّ
arabic_102.json:row4:1 ءْ ء,ْ
arabic_102.json:row4:2 ؤِ ؤ,ِ
arabic_102.json:row4:3 رٍ ر,ٍ
arabic_mac.json:row2:0 ضَ ض,َ
arabic_mac.json:row2:1 صً ص,ً
arabic_mac.json:row2:2 ثِ ث,ِ
arabic_mac.json:row2:3 قٍ ق,ٍ
arabic_mac.json:row2:4 فُ ف,ُ
arabic_mac.json:row2:5 غٌ غ,ٌ
arabic_mac.json:row2:6 عْ ع,ْ
arabic_mac.json:row2:7 هّ ه,ّ
bepo.json:row4:7 q,Q,o̊ q,Q,o,̊
burmese.json:row3:1 ျှ ျ,ှ
burmese.json:row3:2 ိီ ိ,ီ
burmese.json:row3:3 ်္ ်,္
burmese.json:row3:4 ါွ ါ,ွ
burmese.json:row3:5 ့ံ ့,ံ
burmese.json:row3:6 ြဲ ြ,ဲ
hindi_inscript.json:row1:2 2ॅ 2,ॅ
hindi_inscript.json:row1:11 -ः -,ः
hindi_inscript.json:row1:12 ऋृ ऋ,ृ
hindi_inscript.json:row4:1 ंँ ं,ँ
thai_kedmanee.json:row1:6 ุู ุ,ู
thai_kedmanee.json:row2:5 ัํ ั,ํ
thai_kedmanee.json:row2:6 ี๊ ี,๊
thai_kedmanee.json:row3:5 ้็ ้,็
thai_kedmanee.json:row3:6 ่๋ ่,๋
thai_kedmanee.json:row4:4 ิฺ ิ,ฺ
thai_kedmanee.json:row4:5 ื์ ื,์
thai_manoonchai.json:row2:6 ัึ ั,ึ
thai_manoonchai.json:row3:6 าำ า,ำ
thai_manoonchai.json:row4:4 จ๊ จ,๊
thai_manoonchai.json:row4:5 ค๋ ค,๋
thai_manoonchai.json:row4:6 ี์ ี,์
thai_pattachote.json:row1:6 ูุ ู,ุ
thai_pattachote.json:row2:0 ็๊ ็,๊
thai_pattachote.json:row2:5 ่ึ ่,ึ
thai_pattachote.json:row3:0 ้๋ ้,๋
thai_pattachote.json:row3:2 งำ ง,ำ
thai_pattachote.json:row3:4 ั์ ั,์
thai_pattachote.json:row3:5 ีื ี,ื
thai_pattachote.json:row4:5 ิั ิ,ั

fehmer avatar May 07 '25 16:05 fehmer

"æ" and "œ" are cobsidered as typing at the same time "a" and "e" and "o" and "e" when using emulator.

(Affects Bepo, Bepo_Afnor and Optimot layouts. Probably affects any other layouts that uses those two keys.)

GuckicheLorraine avatar May 07 '25 17:05 GuckicheLorraine