Skip to content

Commit

Permalink
Manoonchai v0.2 layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
narze authored Sep 17, 2021
1 parent e708ede commit 4f05a6a
Show file tree
Hide file tree
Showing 5 changed files with 846 additions and 42 deletions.
84 changes: 42 additions & 42 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,54 @@ const choices = filenames.map((filename) => ({
value: filename,
}))

;(async () => {
const response = await prompts({
type: "select",
name: "input",
message: "Pick input JSON file",
choices,
})
; (async () => {
const response = await prompts({
type: "select",
name: "input",
message: "Pick input JSON file",
choices,
})

const jsonInput = JSON.parse(
fs.readFileSync(path.join(process.cwd(), "input", response.input), "utf8")
)
const jsonInput = JSON.parse(
fs.readFileSync(path.join(process.cwd(), "input", response.input), "utf8")
)

// Keylayout
try {
const keylayoutXml = await generateKeylayout(jsonInput)
const layoutName = response.input.split(".")[0]
const outputFilename = `output/${layoutName}.keylayout`
fs.writeFileSync(outputFilename, keylayoutXml)
// Keylayout
try {
const keylayoutXml = await generateKeylayout(jsonInput)
const layoutName = response.input.split(".").slice(0, -1).join(".")
const outputFilename = `output/${layoutName}.keylayout`
fs.writeFileSync(outputFilename, keylayoutXml)

fixUnicode(outputFilename)
fixUnicode(outputFilename)

console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}
console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}

// Klc
try {
const layoutName = response.input.split(".")[0]
const outputFilename = `output/${layoutName}.klc`
await generateKlc(jsonInput, outputFilename)
// Klc
try {
const layoutName = response.input.split(".").slice(0, -1).join(".")
const outputFilename = `output/${layoutName}.klc`
await generateKlc(jsonInput, outputFilename)

console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}
console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}

// Xkb
try {
const layoutName = response.input.split(".")[0]
const outputFilename = `output/${layoutName}_xkb`
await generateXkb(jsonInput, outputFilename)
try {
const layoutName = response.input.split(".").slice(0, -1).join(".")
const outputFilename = `output/${layoutName}_xkb`
await generateXkb(jsonInput, outputFilename)

console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}
})()
console.log(`Output : ${outputFilename}`)
} catch (e) {
console.error(e)
process.exit(1)
}
})()
63 changes: 63 additions & 0 deletions input/Manoonchai-v0.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "Manoonchai v0.2",
"version": "0.2",
"language": "Thai",
"layers": ["Base", "Shift", "Command", "AltGr", "Control", "ShiftAltGr"],
"license": "MIT",
"os": {
"windows": {
"installerName": "Mnc02",
"company": "Manoonchai",
"localeId": "0000041e"
}
},
"keys": {
"`": ["`", "~", "`", "`", "`", ""],
"1": ["1", "!", "1", "", "1", ""],
"2": ["2", "@", "2", "", "2", ""],
"3": ["3", "#", "3", "", "3", ""],
"4": ["4", "$", "4", "", "4", ""],
"5": ["5", "%", "5", "", "5", ""],
"6": ["6", "^", "6", "", "6", ""],
"7": ["7", "&", "7", "", "7", ""],
"8": ["8", "*", "8", "", "8", ""],
"9": ["9", "(", "9", "", "9", ""],
"0": ["0", ")", "0", "", "0", ""],
"-": ["-", "_", "-", "÷", "-", ""],
"=": ["=", "+", "=", "×", "=", ""],
"q": ["", "", "q", "", "q", ""],
"w": ["", "", "w", "", "w", ""],
"e": ["", "", "e", "", "e", ""],
"r": ["", "", "r", "", "r", ""],
"t": ["", "", "t", "", "t", ""],
"y": ["", "", "y", "", "y", ""],
"u": ["", "", "u", "", "u", ""],
"i": ["", "", "i", "", "i", ""],
"o": ["", "", "o", "", "o", ""],
"p": ["", "", "p", "", "p", ""],
"[": ["", "", "[", "[", "[", "{"],
"]": ["", "", "]", "]", "]", "}"],
"\\": ["", "", "\\", "\\", "\\", "|"],
"a": ["", "", "a", "", "a", ""],
"s": ["", "", "s", "", "s", ""],
"d": ["", "", "d", "", "d", ""],
"f": ["", "", "f", "฿", "f", ""],
"g": ["", "", "g", "", "g", ""],
"h": ["", "", "h", "", "h", ""],
"j": ["", "", "j", "", "j", ""],
"k": ["", "", "k", "", "k", ""],
"l": ["", "", "l", "", "l", ""],
";": ["", "", ";", ";", ";", ":"],
"'": ["", "", "'", "'", "'", "\""],
"z": ["", "", "z", "", "z", ""],
"x": ["", "", "x", "", "x", ""],
"c": ["", "", "c", "", "c", ""],
"v": ["", "", "v", "", "v", ""],
"b": ["", "", "b", "", "b", ""],
"n": ["", "?", "n", "", "n", ""],
"m": ["", "", "m", "", "m", ""],
",": ["", "", ",", ",", ",", "<"],
".": ["", "", ".", ".", ".", ">"],
"/": ["", "฿", "/", "/", "/", "?"]
}
}
Loading

0 comments on commit 4f05a6a

Please sign in to comment.