Cristian Muscalu
Cristian Muscalu

Reputation: 9905

how to enalbe "Press ESC to exit full screen mode" in electron

How can i enable the "Press ESC to exit full screen mode message" in electron while i'm in fullscreen in an iframe?

2019-11-06_13-01-16

Observation: Same iframe with same options in Chrome shows the message, but electron doesn't.

Upvotes: 0

Views: 1080

Answers (1)

Peacock
Peacock

Reputation: 302

The easiest way to do this would be through some simple window controlling with the remote module.

const remote = require("electron").remote;

document.addEventListener("keydown", event => {
    switch (event.key) {
        case "Escape":
            if (remote.getCurrentWindow().isFullScreen()) {
                remote.getCurrentWindow().setFullScreen(false);
            }
            break;
         }
});

Code and original answer here by Zen.

Upvotes: 1

Related Questions