[gnome-shell/wip/carlosg/osk-updates: 16/17] keyboard: Use extended US keyboard for terminal mode
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-updates: 16/17] keyboard: Use extended US keyboard for terminal mode
- Date: Tue, 26 Apr 2022 14:09:26 +0000 (UTC)
commit 070ad59c275413a32740819c3bb11e962a94c5a4
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 22 21:16:52 2022 +0200
keyboard: Use extended US keyboard for terminal mode
If the input hint is "terminal", use the extended keyboard.
js/misc/inputMethod.js | 9 +++++++++
js/ui/keyboard.js | 17 +++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index f207f289de..5604966fd1 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -12,6 +12,7 @@ var HIDE_PANEL_TIME = 50;
var InputMethod = GObject.registerClass({
Signals: {
'surrounding-text-updated': {},
+ 'terminal-mode-changed': {},
},
}, class InputMethod extends Clutter.InputMethod {
_init() {
@@ -23,6 +24,7 @@ var InputMethod = GObject.registerClass({
this._preeditPos = 0;
this._preeditVisible = false;
this._hidePanelId = 0;
+ this.terminalMode = false;
this._ibus = IBus.Bus.new_async();
this._ibus.connect('connected', this._onConnected.bind(this));
this._ibus.connect('disconnected', this._clear.bind(this));
@@ -255,6 +257,13 @@ var InputMethod = GObject.registerClass({
else if (purpose == Clutter.InputContentPurpose.PASSWORD)
ibusPurpose = IBus.InputPurpose.PASSWORD;
+ const terminalMode =
+ purpose === Clutter.InputContentPurpose.TERMINAL;
+ if (this.terminalMode !== terminalMode) {
+ this.terminalMode = terminalMode;
+ this.emit('terminal-mode-changed');
+ }
+
this._purpose = ibusPurpose;
if (this._context)
this._context.set_content_type(this._purpose, this._hints);
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 39740c919d..bce2769a47 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1403,6 +1403,9 @@ var Keyboard = GObject.registerClass({
// keyboard on RTL locales.
this.text_direction = Clutter.TextDirection.LTR;
+ Main.inputMethod.connect(
+ 'terminal-mode-changed', this._onTerminalModeChanged.bind(this));
+
this._keyboardController.connectObject(
'active-group', this._onGroupChanged.bind(this),
'groups-changed', this._onKeyboardGroupsChanged.bind(this),
@@ -1773,11 +1776,21 @@ var Keyboard = GObject.registerClass({
}
}
- _onGroupChanged() {
- this._ensureKeysForGroup(this._keyboardController.getCurrentGroup());
+ _updateKeys() {
+ this._ensureKeysForGroup(Main.inputMethod.terminalMode
+ ? 'us-extended'
+ : this._keyboardController.getCurrentGroup());
this._setActiveLayer(0);
}
+ _onGroupChanged() {
+ this._updateKeys();
+ }
+
+ _onTerminalModeChanged() {
+ this._updateKeys();
+ }
+
_onKeyboardGroupsChanged() {
let nonGroupActors = [this._emojiSelection, this._keypad];
this._aspectContainer.get_children().filter(c => !nonGroupActors.includes(c)).forEach(c => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]