Add kiosk settings

This commit is contained in:
2022-07-22 18:25:53 +00:00
parent c7ce90883b
commit 5f2e7d7bfa
9 changed files with 152 additions and 60 deletions

View File

@@ -1,3 +1,5 @@
import { selectTree } from "../helpers";
export const AutoSettingsMixin = (SuperClass) => {
return class AutoSettingsMixinClass extends SuperClass {
constructor() {
@@ -20,6 +22,27 @@ export const AutoSettingsMixin = (SuperClass) => {
settings.sidebarHiddenPanels
);
}
if (settings.hideSidebar === true) {
selectTree(
document.body,
"home-assistant$home-assistant-main$app-drawer-layout"
).then((el) => el.style.setProperty("--app-drawer-width", "0px"));
selectTree(
document.body,
"home-assistant$home-assistant-main$app-drawer-layout app-drawer"
).then((el) => el.remove());
}
if (settings.hideHeader === true) {
customElements.whenDefined("app-header-layout").then(() => {
const appHeader = customElements.get("app-header").prototype;
const _attached = appHeader.attached;
appHeader.attached = function () {
_attached.bind(this)();
this.style.setProperty("display", "none");
};
});
}
}
};
};

View File

@@ -52,7 +52,7 @@ import { AutoSettingsMixin } from "./auto-settings";
- Saved frontend settings
X Framework
x Save sidebar
- Kiosk mode
x Kiosk mode
- Default panel?
- Screensaver?
- Tweaks