blob: ac9e4ded055ed799fe84965c7327a882df56bac1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const St = imports.gi.St;
const Shell = imports.gi.Shell;
const Main = imports.ui.main;
function OnScreenKeyboardButton() {
this._init();
}
OnScreenKeyboardButton.prototype = {
_init: function() {
label = GLib.markup_escape_text('Keyboard', -1);
this.actor = new St.Button ({ label: label });
this.actor.connect("clicked", Lang.bind(this, this._toggleShowOnScreenKeyboard));
this._onScreenKeyboardShown = false;
},
_toggleShowOnScreenKeyboard: function() {
if (this._onScreenKeyboardShown) {
Main.keyboard.hide();
} else {
Main.keyboard.show();
}
this._onScreenKeyboardShown = !this._onScreenKeyboardShown;
},
};
let button;
function init() {
button = new OnScreenKeyboardButton();
}
function enable() {
let _children = Main.panel._centerBox.get_children();
Main.panel._centerBox.insert_actor(button.actor, _children.length - 1);
Main.panel._centerBox.add(button.actor);
}
function disable() {
Main.panel._centerBoxBox.remove_actor(button.actor);
}
|