aboutsummaryrefslogtreecommitdiff
path: root/views/script/core_fullscreen.js
blob: d45cccfe845006cfcc8324b8df3e70b3cbf8102f (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
window.addEventListener("load", () => {
    require('@electron/remote').getCurrentWindow().show();

    if (location.hash === "#ready") {
        const Nest = require("./nest/abi");

        $(document).keydown(function(e) {
            if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { // F11/F1/F10
                if (!require('@electron/remote').getCurrentWindow().fullScreen && require('@electron/remote').getCurrentWindow().fullScreenable) {
                    require('@electron/remote').getCurrentWindow().setFullScreen(true);
                } else {
                    require('@electron/remote').getCurrentWindow().setFullScreen(false);
                }
            }
        })

        $(document).keydown(function(e) {
            currentNest = Nest.load(homedir + "/.kartik/current.kfn");

            if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) {
                if (currentNest.config.fullscreen) {
                    currentNest.config.fullscreen = false;
                    Nest.export(homedir + "/.kartik/current.kfn", currentNest);
                    require('electron').ipcRenderer.send("reloadNest")
                } else {
                    currentNest.config.fullscreen = true;
                    Nest.export(homedir + "/.kartik/current.kfn", currentNest);
                    require('electron').ipcRenderer.send("reloadNest");
                }
            }
        })

        currentNest = Nest.load(homedir + "/.kartik/current.kfn");
        if (currentNest.config.fullscreen) {
            require('@electron/remote').getCurrentWindow().setFullScreen(true);
        } else {
            currentNest.config.fullscreen = false;
            Nest.export(homedir + "/.kartik/current.kfn", currentNest);
            require('electron').ipcRenderer.send("reloadNest")
        }
    }
})