diff --git a/themes/dracula/js/backgrounds.js b/themes/dracula/js/backgrounds.js index facc60f..f311244 100644 --- a/themes/dracula/js/backgrounds.js +++ b/themes/dracula/js/backgrounds.js @@ -67,10 +67,15 @@ class Backgrounds { const path = this._backgroundImages[i]; let button = this._createImage(path); button.addEventListener("click", () => { - nody_greeter.broadcast({ - type: "change-background", - path, - }); + if (window.nody_greeter) { + nody_greeter.broadcast({ + type: "change-background", + path, + }); + } else { + this._backgroundPath = path; + this._updateBackgroundImages(); + } }); this._backgroundsList.appendChild(button); } diff --git a/themes/dracula/js/index.js b/themes/dracula/js/index.js index 1476f9b..b9b246e 100644 --- a/themes/dracula/js/index.js +++ b/themes/dracula/js/index.js @@ -47,15 +47,10 @@ async function initGreeter() { brightness = new Brightness(); - if (!nody_greeter.window_metadata.is_primary) { + if (window.nody_greeter && !window.nody_greeter.window_metadata.is_primary) { // Hide login elements on non-primary screen document.querySelector("#screen").classList.add("hide"); } } -if (window._ready_event === undefined) { - _ready_event = new Event("GreeterReady"); - window.dispatchEvent(_ready_event); -} - window.addEventListener("GreeterReady", initGreeter); diff --git a/themes/gruvbox/js/index.js b/themes/gruvbox/js/index.js index d93de70..d33446f 100644 --- a/themes/gruvbox/js/index.js +++ b/themes/gruvbox/js/index.js @@ -49,7 +49,7 @@ async function initGreeter() { document.querySelector("#lock-label").classList.remove("hide"); } - if (!nody_greeter.window_metadata.is_primary) { + if (window.nody_greeter && !window.nody_greeter.window_metadata.is_primary) { // Hide login elements on non-primary screen document.querySelector("#screen").classList.add("hide"); } @@ -57,9 +57,4 @@ async function initGreeter() { const notGreeter = false; -if (window._ready_event === undefined) { - _ready_event = new Event("GreeterReady"); - window.dispatchEvent(_ready_event); -} - window.addEventListener("GreeterReady", initGreeter); diff --git a/ts/browser.ts b/ts/browser.ts index b47f5fa..b0aa894 100644 --- a/ts/browser.ts +++ b/ts/browser.ts @@ -212,7 +212,7 @@ class Browser { if (w.is_primary) { w.window.focus(); } - logger.debug("Nody Greeter started win"); + logger.debug("Nody Greeter started win: " + w.meta.id); }); w.window.webContents.on("devtools-opened", () => { w.window.webContents.devToolsWebContents.focus();