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

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