Skip to content

Commit

Permalink
Added retro-compatibility with web-greeter
Browse files Browse the repository at this point in the history
  • Loading branch information
JezerM committed Jan 17, 2022
1 parent bfdd0c1 commit 010b9c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
13 changes: 9 additions & 4 deletions themes/dracula/js/backgrounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 1 addition & 6 deletions themes/dracula/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
7 changes: 1 addition & 6 deletions themes/gruvbox/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,12 @@ 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");
}
}

const notGreeter = false;

if (window._ready_event === undefined) {
_ready_event = new Event("GreeterReady");
window.dispatchEvent(_ready_event);
}

window.addEventListener("GreeterReady", initGreeter);
2 changes: 1 addition & 1 deletion ts/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 010b9c8

Please sign in to comment.