File: wmGtkDialogs.js

package info (click to toggle)
cinnamon 6.4.13-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,304 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (53 lines) | stat: -rw-r--r-- 1,055 bytes parent folder | download | duplicates (3)
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;
    }


};