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 45 46 47 48 49 50 51 52 53
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const SIGTERM = 15;
var HoverClickHelper = class {
constructor(wm) {
this.proc = null;
}
set_active(active) {
if (active) {
this.open();
} else {
this.close();
}
}
open() {
try {
this.proc = Gio.Subprocess.new(
[
"cinnamon-hover-click"
],
0);
this.proc.wait_async(null, this._wait_finish.bind(this));
} catch (e) {
global.logWarning(`Could not spawn hover click window: ${e}`);
this.proc = null;
}
}
close() {
if (this.proc !== null) {
this.proc.send_signal(SIGTERM);
}
}
_wait_finish(proc, result) {
try {
this.proc.wait_finish(result);
} catch (e) {
global.logWarning(`Problem with hover click window: ${e}`);
}
this.proc = null;
}
};
|