Option to use screensaver instead of turning off screen in fully

This commit is contained in:
2021-07-11 16:18:22 +00:00
parent 180fad3ea0
commit 63812d821a
11 changed files with 610 additions and 729 deletions

View File

@@ -37,6 +37,7 @@ export const BrowserModBrowserMixin = (C) =>
darkMode:
this._hass && this._hass.themes && this._hass.themes.darkMode,
userData: this._hass && this._hass.user,
config: this.config,
},
});
};

View File

@@ -25,6 +25,15 @@ export const FullyKioskMixin = (C) =>
window.fully.bind(ev, `window.browser_mod.fully_update("${ev}");`);
}
window.fully.bind(
"onScreensaverStart",
`window.browser_mod.fully_screensaver = true; window.browser_mod.screen_update();`
);
window.fully.bind(
"onScreensaverStop",
`window.browser_mod.fully_screensaver = false; window.browser_mod.screen_update();`
);
this._keepingAlive = false;
}

View File

@@ -11,6 +11,7 @@ import { BrowserModCameraMixin } from "./camera";
import { BrowserModScreensaverMixin } from "./screensaver";
import { BrowserModPopupsMixin } from "./popups";
import { BrowserModBrowserMixin } from "./browser";
import pjson from "../package.json";
const ext = (baseClass, mixins) =>
mixins.reduceRight((base, mixin) => mixin(base), baseClass);
@@ -35,7 +36,6 @@ class BrowserMod extends ext(BrowserModConnection, [
}
});
const pjson = require("../package.json");
console.info(
`%cBROWSER_MOD ${pjson.version} IS INSTALLED
%cDeviceID: ${deviceID}`,

View File

@@ -92,15 +92,21 @@ export const BrowserModScreensaverMixin = (C) =>
do_blackout(timeout) {
this.screensaver_set(
() => {
if (this.isFully) window.fully.turnScreenOff(true);
else this._blackout_panel.style.display = "block";
if (this.isFully) {
if (this.config.screensaver) window.fully.startScreensaver();
else window.fully.turnScreenOff(true);
} else {
this._blackout_panel.style.display = "block";
}
this.screen_update();
},
() => {
if ((this._blackout_panel.style.display = "block"))
this._blackout_panel.style.display = "none";
if (this.isFully && !window.fully.getScreenOn())
window.fully.turnScreenOn();
if (this.isFully) {
if (!window.fully.getScreenOn()) window.fully.turnScreenOn();
window.fully.stopScreensaver();
}
this.screen_update();
},
timeout || 0
@@ -108,7 +114,10 @@ export const BrowserModScreensaverMixin = (C) =>
}
no_blackout() {
if (this.isFully) window.fully.turnScreenOn();
if (this.isFully) {
window.fully.turnScreenOn();
window.fully.stopScreensaver();
}
this.screensaver_stop();
}
@@ -116,7 +125,9 @@ export const BrowserModScreensaverMixin = (C) =>
this.sendUpdate({
screen: {
blackout: this.isFully
? !window.fully.getScreenOn()
? this.fully_screensaver !== undefined
? this.fully_screensaver
: !window.fully.getScreenOn()
: Boolean(this._blackout_panel.style.display === "block"),
brightness: this.isFully
? window.fully.getScreenBrightness()