keyboard: Add Hangul OSK keymap

This keymap requires the corresponding input method for Hangul
input, and the hangul mode to be enabled. Look up for the right
state, and use a corresponding 'us' keymap for english input
otherwise, in order to follow hangul IM behavior.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
This commit is contained in:
Carlos Garnacho 2022-06-15 15:49:19 +02:00 committed by Florian Müllner
parent 4010f03996
commit 90bd0c4a25
3 changed files with 736 additions and 1 deletions

View File

@ -33,6 +33,7 @@
<file>ke.json</file>
<file>kg.json</file>
<file>kh.json</file>
<file>kr.json</file>
<file>la.json</file>
<file>latam.json</file>
<file>lt.json</file>

720
data/osk-layouts/kr.json Normal file
View File

@ -0,0 +1,720 @@
{
"levels": [
{
"level": "",
"mode": "default",
"rows": [
[
{
"label": "ㅂ",
"strings": [
"q"
]
},
{
"label": "ㅈ",
"strings": [
"w"
]
},
{
"label": "ㄷ",
"strings": [
"e"
]
},
{
"label": "ㄱ",
"strings": [
"r"
]
},
{
"label": "ㅅ",
"strings": [
"t"
]
},
{
"label": "ㅛ",
"strings": [
"y"
]
},
{
"label": "ㅕ",
"strings": [
"u"
]
},
{
"label": "ㅑ",
"strings": [
"i"
]
},
{
"label": "ㅐ",
"strings": [
"o"
]
},
{
"label": "ㅔ",
"strings": [
"p"
]
},
{
"iconName": "edit-clear-symbolic",
"keyval": "0xff08",
"width": 1.5
}
],
[
{
"label": "ㅁ",
"strings": [
"a"
]
},
{
"label": "ㄴ",
"strings": [
"s"
]
},
{
"label": "ㅇ",
"strings": [
"d"
]
},
{
"label": "ㄹ",
"strings": [
"f"
]
},
{
"label": "ㅎ",
"strings": [
"g"
]
},
{
"label": "ㅗ",
"strings": [
"h"
]
},
{
"label": "ㅓ",
"strings": [
"j"
]
},
{
"label": "ㅏ",
"strings": [
"k"
]
},
{
"label": "ㅣ",
"strings": [
"l"
]
},
{
"iconName": "keyboard-enter-symbolic",
"keyval": "0xff0d",
"width": 2
}
],
[
{
"label": "ㅋ",
"strings": [
"z"
]
},
{
"label": "ㅌ",
"strings": [
"x"
]
},
{
"label": "ㅊ",
"strings": [
"c"
]
},
{
"label": "ㅍ",
"strings": [
"v"
]
},
{
"label": "ㅠ",
"strings": [
"b"
]
},
{
"label": "ㅜ",
"strings": [
"n"
]
},
{
"label": "ㅡ",
"strings": [
"m"
]
},
{
"strings": [
","
]
},
{
"strings": [
".",
"#",
"!",
",",
"?",
"-",
":",
"'",
"@"
]
}
],
[
{
"action": "levelSwitch",
"label": "?123",
"level": 2,
"width": 1.5
},
{
"action": "emoji",
"iconName": "face-smile-symbolic",
"width": 1.5
},
{
"strings": [
" "
],
"width": 5
},
{
"action": "languageMenu",
"iconName": "keyboard-layout-symbolic",
"width": 1.5
},
{
"action": "hide",
"iconName": "keyboard-hide-symbolic",
"width": 2
}
]
]
},
{
"level": "opt",
"mode": "locked",
"rows": [
[
{
"strings": [
"1",
"¹",
"½",
"⅓",
"¼",
"⅛"
]
},
{
"strings": [
"2",
"²",
"⅔"
]
},
{
"strings": [
"3",
"³",
"¾",
"⅜"
]
},
{
"strings": [
"4",
"⁴"
]
},
{
"strings": [
"5",
"⅝"
]
},
{
"strings": [
"6"
]
},
{
"strings": [
"7",
"⅞"
]
},
{
"strings": [
"8"
]
},
{
"strings": [
"9"
]
},
{
"strings": [
"0",
"ⁿ",
"∅"
]
},
{
"iconName": "edit-clear-symbolic",
"keyval": "0xff08",
"width": 1.5
}
],
[
{
"strings": [
"@"
]
},
{
"strings": [
"#"
]
},
{
"strings": [
"$",
"¢",
"£",
"€",
"¥",
"₱"
]
},
{
"strings": [
"%",
"‰"
]
},
{
"strings": [
"&"
]
},
{
"strings": [
"-",
"_",
"",
"—",
"·"
]
},
{
"strings": [
"+",
"±"
]
},
{
"strings": [
"(",
"<",
"{",
"["
]
},
{
"strings": [
")",
">",
"}",
"]"
]
},
{
"iconName": "keyboard-enter-symbolic",
"keyval": "0xff0d",
"width": 2
}
],
[
{
"action": "levelSwitch",
"label": "=/<",
"level": 3,
"width": 1.5
},
{
"strings": [
"*",
"†",
"‡",
"★"
]
},
{
"strings": [
"\"",
"“",
"”",
"«",
"»"
]
},
{
"strings": [
"'",
"",
"",
"",
""
]
},
{
"strings": [
":"
]
},
{
"strings": [
";"
]
},
{
"strings": [
"!",
"¡"
]
},
{
"strings": [
"?",
"¿"
]
},
{
"action": "levelSwitch",
"label": "=/<",
"level": 3,
"width": 3
}
],
[
{
"action": "levelSwitch",
"label": "ABC",
"level": 0,
"width": 1.5
},
{
"strings": [
"_"
]
},
{
"strings": [
"/"
]
},
{
"strings": [
" "
],
"width": 3
},
{
"strings": [
","
]
},
{
"strings": [
".",
"…"
]
},
{
"action": "emoji",
"iconName": "face-smile-symbolic"
},
{
"action": "languageMenu",
"iconName": "keyboard-layout-symbolic"
},
{
"action": "hide",
"iconName": "keyboard-hide-symbolic"
}
]
]
},
{
"level": "opt+shift",
"mode": "locked",
"rows": [
[
{
"strings": [
"~"
]
},
{
"strings": [
"`"
]
},
{
"strings": [
"|"
]
},
{
"strings": [
"•",
"♪",
"♥",
"♠",
"♦",
"♣"
]
},
{
"strings": [
"√"
]
},
{
"strings": [
"Π",
"π"
]
},
{
"strings": [
"÷"
]
},
{
"strings": [
"×"
]
},
{
"strings": [
"¶",
"§"
]
},
{
"strings": [
"∆"
]
},
{
"iconName": "edit-clear-symbolic",
"keyval": "0xff08",
"width": 1.5
}
],
[
{
"strings": [
"£"
]
},
{
"strings": [
"¢"
]
},
{
"strings": [
"€"
]
},
{
"strings": [
"¥"
]
},
{
"strings": [
"^",
"↑",
"↓",
"←",
"→"
]
},
{
"strings": [
"°",
"",
"″"
]
},
{
"strings": [
"=",
"≠",
"≈",
"∞"
]
},
{
"strings": [
"{"
]
},
{
"strings": [
"}"
]
},
{
"iconName": "keyboard-enter-symbolic",
"keyval": "0xff0d",
"width": 2
}
],
[
{
"action": "levelSwitch",
"label": "?123",
"level": 2,
"width": 1.5
},
{
"strings": [
"\\"
]
},
{
"strings": [
"©"
]
},
{
"strings": [
"®"
]
},
{
"strings": [
"™"
]
},
{
"strings": [
"℅"
]
},
{
"strings": [
"["
]
},
{
"strings": [
"]"
]
},
{
"action": "levelSwitch",
"label": "?123",
"level": 2,
"width": 3
}
],
[
{
"action": "levelSwitch",
"label": "ABC",
"level": 0,
"width": 1.5
},
{
"strings": [
"<",
"",
"≤",
"«"
]
},
{
"strings": [
">",
"",
"≥",
"»"
]
},
{
"strings": [
" "
],
"width": 3
},
{
"strings": [
","
]
},
{
"strings": [
".",
"…"
]
},
{
"action": "emoji",
"iconName": "face-smile-symbolic"
},
{
"action": "languageMenu",
"iconName": "keyboard-layout-symbolic"
},
{
"action": "hide",
"iconName": "keyboard-hide-symbolic"
}
]
]
}
],
"locale": "kr",
"name": "Korean (Hangul)"
}

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported KeyboardManager */
const { Clutter, Gio, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
const {Clutter, Gio, GLib, GObject, Graphene, IBus, Meta, Shell, St} = imports.gi;
const Signals = imports.misc.signals;
const EdgeDragAction = imports.ui.edgeDragAction;
@ -2209,6 +2209,20 @@ var KeyboardController = class extends Signals.EventEmitter {
getCurrentGroup() {
if (Main.inputMethod.terminalMode)
return 'us-extended';
// Special case for Korean, if Hangul mode is disabled, use the 'us' keymap
if (this._currentSource.id === 'hangul') {
const inputSourceManager = InputSourceManager.getInputSourceManager();
const currentSource = inputSourceManager.currentSource;
let prop;
for (let i = 0; (prop = currentSource.properties.get(i)) !== null; ++i) {
if (prop.get_key() === 'InputMode' &&
prop.get_prop_type() === IBus.PropType.TOGGLE &&
prop.get_state() !== IBus.PropState.CHECKED)
return 'us';
}
}
return this._currentSource.xkbId;
}