Option to use screensaver instead of turning off screen in fully
This commit is contained in:
parent
180fad3ea0
commit
63812d821a
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules/
|
|||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
.vscode
|
.vscode
|
||||||
.env
|
.env
|
||||||
|
custom_components/hacs/
|
File diff suppressed because one or more lines are too long
@ -37,6 +37,7 @@ export const BrowserModBrowserMixin = (C) =>
|
|||||||
darkMode:
|
darkMode:
|
||||||
this._hass && this._hass.themes && this._hass.themes.darkMode,
|
this._hass && this._hass.themes && this._hass.themes.darkMode,
|
||||||
userData: this._hass && this._hass.user,
|
userData: this._hass && this._hass.user,
|
||||||
|
config: this.config,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,15 @@ export const FullyKioskMixin = (C) =>
|
|||||||
window.fully.bind(ev, `window.browser_mod.fully_update("${ev}");`);
|
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;
|
this._keepingAlive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import { BrowserModCameraMixin } from "./camera";
|
|||||||
import { BrowserModScreensaverMixin } from "./screensaver";
|
import { BrowserModScreensaverMixin } from "./screensaver";
|
||||||
import { BrowserModPopupsMixin } from "./popups";
|
import { BrowserModPopupsMixin } from "./popups";
|
||||||
import { BrowserModBrowserMixin } from "./browser";
|
import { BrowserModBrowserMixin } from "./browser";
|
||||||
|
import pjson from "../package.json";
|
||||||
|
|
||||||
const ext = (baseClass, mixins) =>
|
const ext = (baseClass, mixins) =>
|
||||||
mixins.reduceRight((base, mixin) => mixin(base), baseClass);
|
mixins.reduceRight((base, mixin) => mixin(base), baseClass);
|
||||||
@ -35,7 +36,6 @@ class BrowserMod extends ext(BrowserModConnection, [
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const pjson = require("../package.json");
|
|
||||||
console.info(
|
console.info(
|
||||||
`%cBROWSER_MOD ${pjson.version} IS INSTALLED
|
`%cBROWSER_MOD ${pjson.version} IS INSTALLED
|
||||||
%cDeviceID: ${deviceID}`,
|
%cDeviceID: ${deviceID}`,
|
||||||
|
@ -92,15 +92,21 @@ export const BrowserModScreensaverMixin = (C) =>
|
|||||||
do_blackout(timeout) {
|
do_blackout(timeout) {
|
||||||
this.screensaver_set(
|
this.screensaver_set(
|
||||||
() => {
|
() => {
|
||||||
if (this.isFully) window.fully.turnScreenOff(true);
|
if (this.isFully) {
|
||||||
else this._blackout_panel.style.display = "block";
|
if (this.config.screensaver) window.fully.startScreensaver();
|
||||||
|
else window.fully.turnScreenOff(true);
|
||||||
|
} else {
|
||||||
|
this._blackout_panel.style.display = "block";
|
||||||
|
}
|
||||||
this.screen_update();
|
this.screen_update();
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if ((this._blackout_panel.style.display = "block"))
|
if ((this._blackout_panel.style.display = "block"))
|
||||||
this._blackout_panel.style.display = "none";
|
this._blackout_panel.style.display = "none";
|
||||||
if (this.isFully && !window.fully.getScreenOn())
|
if (this.isFully) {
|
||||||
window.fully.turnScreenOn();
|
if (!window.fully.getScreenOn()) window.fully.turnScreenOn();
|
||||||
|
window.fully.stopScreensaver();
|
||||||
|
}
|
||||||
this.screen_update();
|
this.screen_update();
|
||||||
},
|
},
|
||||||
timeout || 0
|
timeout || 0
|
||||||
@ -108,7 +114,10 @@ export const BrowserModScreensaverMixin = (C) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
no_blackout() {
|
no_blackout() {
|
||||||
if (this.isFully) window.fully.turnScreenOn();
|
if (this.isFully) {
|
||||||
|
window.fully.turnScreenOn();
|
||||||
|
window.fully.stopScreensaver();
|
||||||
|
}
|
||||||
this.screensaver_stop();
|
this.screensaver_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +125,9 @@ export const BrowserModScreensaverMixin = (C) =>
|
|||||||
this.sendUpdate({
|
this.sendUpdate({
|
||||||
screen: {
|
screen: {
|
||||||
blackout: this.isFully
|
blackout: this.isFully
|
||||||
? !window.fully.getScreenOn()
|
? this.fully_screensaver !== undefined
|
||||||
|
? this.fully_screensaver
|
||||||
|
: !window.fully.getScreenOn()
|
||||||
: Boolean(this._blackout_panel.style.display === "block"),
|
: Boolean(this._blackout_panel.style.display === "block"),
|
||||||
brightness: this.isFully
|
brightness: this.isFully
|
||||||
? window.fully.getScreenBrightness()
|
? window.fully.getScreenBrightness()
|
||||||
|
1241
package-lock.json
generated
1241
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -1,19 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "browser_mod",
|
"name": "browser_mod",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "rollup -c",
|
||||||
"watch": "webpack --watch --mode=development",
|
"watch": "rollup -c --watch",
|
||||||
"update-card-tools": "npm uninstall card-tools && npm install thomasloven/lovelace-card-tools"
|
"update-card-tools": "npm uninstall card-tools && npm install thomasloven/lovelace-card-tools"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Thomas Lovén",
|
"author": "Thomas Lovén",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"webpack": "^5.36.2",
|
"@babel/core": "^7.13.1",
|
||||||
"webpack-cli": "^4.7.0"
|
"@rollup/plugin-babel": "^5.3.0",
|
||||||
|
"@rollup/plugin-json": "^4.1.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||||
|
"rollup": "^2.39.0",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
|
"rollup-plugin-typescript2": "^0.30.0",
|
||||||
|
"typescript": "^4.1.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"card-tools": "github:thomasloven/lovelace-card-tools"
|
"card-tools": "github:thomasloven/lovelace-card-tools"
|
||||||
|
24
rollup.config.js
Normal file
24
rollup.config.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||||
|
import json from "@rollup/plugin-json";
|
||||||
|
// import typescript from "rollup-plugin-typescript2";
|
||||||
|
import { terser } from "rollup-plugin-terser";
|
||||||
|
import babel from "@rollup/plugin-babel";
|
||||||
|
|
||||||
|
const dev = process.env.ROLLUP_WATCH;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: "js/main.js",
|
||||||
|
output: {
|
||||||
|
file: "custom_components/browser_mod/browser_mod.js",
|
||||||
|
format: "es",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
nodeResolve(),
|
||||||
|
json(),
|
||||||
|
// typescript(),
|
||||||
|
babel({
|
||||||
|
exclude: "node_modules/**",
|
||||||
|
}),
|
||||||
|
!dev && terser({ format: { comments: false } }),
|
||||||
|
],
|
||||||
|
};
|
@ -10,6 +10,8 @@ browser_mod:
|
|||||||
alias: test
|
alias: test
|
||||||
fully:
|
fully:
|
||||||
force_stay_awake: true
|
force_stay_awake: true
|
||||||
|
fully2:
|
||||||
|
screensaver: true
|
||||||
|
|
||||||
lovelace:
|
lovelace:
|
||||||
mode: storage
|
mode: storage
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: './js/main.js',
|
|
||||||
mode: 'production',
|
|
||||||
output: {
|
|
||||||
filename: 'custom_components/browser_mod/browser_mod.js',
|
|
||||||
path: path.resolve(__dirname)
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user