Skip to content

Commit 35cf042

Browse files
BrsktInrixia
authored andcommitted
Fix hideTopBar not applying on startup
Use observePromise to wait for the top bar element to exist before hiding it
1 parent 2ab08cc commit 35cf042

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plugins/NativeFullscreen/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { LunaUnload } from "@luna/core";
2-
import { redux } from "@luna/lib";
2+
import { observePromise, redux } from "@luna/lib";
33
import { storage } from "./Settings";
44
export { Settings } from "./Settings";
55

@@ -16,7 +16,12 @@ export const setTopBarVisibility = (visible: boolean) => {
1616
const bar = document.querySelector<HTMLElement>("div[class^='_bar']");
1717
if (bar) bar.style.display = visible ? "" : "none";
1818
};
19-
if (storage.hideTopBar) setTopBarVisibility(false);
19+
// Apply hideTopBar setting on load
20+
if (storage.hideTopBar) {
21+
observePromise<HTMLElement>(unloads, "div[class^='_bar']").then((bar) => {
22+
if (bar) setTopBarVisibility(false);
23+
});
24+
}
2025

2126
const onKeyDown = (event: KeyboardEvent) => {
2227
if (event.key === "F11") {

0 commit comments

Comments
 (0)