Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

fehmer
Copy link
Member

@fehmer fehmer commented May 5, 2025

wip

@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff assets Languages, themes, layouts, etc. labels May 5, 2025
@fehmer fehmer changed the title impr: support layouts with combined characters impr: support layouts with combined characters (@fehmer) May 5, 2025
@monkeytypegame monkeytypegame deleted a comment from github-actions bot May 5, 2025
@fehmer
Copy link
Member Author

fehmer commented May 5, 2025

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));

  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;
}

@Diamonds85
Copy link

#6482

@Diamonds85
Copy link

Diamonds85 commented May 5, 2025

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

Copy link
Contributor

@NadAlaba NadAlaba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not an exhaustive list but it just demonstrates that graphemer is not reliable for this use case

@fehmer
Copy link
Member Author

fehmer commented May 7, 2025

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 ิั ิ,ั

@GuckicheLorraine
Copy link
Contributor

GuckicheLorraine commented May 7, 2025

"æ" 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.)

@fehmer fehmer changed the title impr: support layouts with combined characters (@fehmer) refactor: split key labels in layout files (@fehmer) May 7, 2025
@fehmer fehmer marked this pull request as ready for review May 8, 2025 12:12
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label May 8, 2025
@Miodec Miodec added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets Languages, themes, layouts, etc. frontend User interface or web stuff waiting for update Pull requests or issues that require changes/comments before continuing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants