[gnome-shell/wip/carlosg/osk-updates] keyboard: Add Hangul OSK keymap
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-updates] keyboard: Add Hangul OSK keymap
- Date: Wed, 15 Jun 2022 17:55:57 +0000 (UTC)
commit 92a73981b3f3071c09343dca2537b2722596226b
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jun 15 15:49:19 2022 +0200
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.
data/gnome-shell-osk-layouts.gresource.xml | 1 +
data/osk-layouts/kr.json | 720 +++++++++++++++++++++++++++++
js/ui/keyboard.js | 16 +-
3 files changed, 736 insertions(+), 1 deletion(-)
---
diff --git a/data/gnome-shell-osk-layouts.gresource.xml b/data/gnome-shell-osk-layouts.gresource.xml
index accfb8eda5..b5112919c7 100644
--- a/data/gnome-shell-osk-layouts.gresource.xml
+++ b/data/gnome-shell-osk-layouts.gresource.xml
@@ -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>
diff --git a/data/osk-layouts/kr.json b/data/osk-layouts/kr.json
new file mode 100644
index 0000000000..d89f8c7863
--- /dev/null
+++ b/data/osk-layouts/kr.json
@@ -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)"
+}
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index fdbb1c3c72..760c8886a7 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -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.signals;
const EdgeDragAction = imports.ui.edgeDragAction;
@@ -2192,6 +2192,20 @@ var KeyboardController = class {
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]