readium / r2-testapp-js

NodeJS Readium2 "test app"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux Lubuntu (not Ubuntu, or Kubuntu), Electron BrowserWindow at app startup with empty contents (does not crash, but annoying)

danielweck opened this issue · comments

Did you test disabling the GPU? cf. electron/electron#6139 (comment) (cos’ yeah I’ve reinstalled Xubuntu from scratch this weekend and I had GPU issues for something else… and since Lubuntu ships with the minimal config possible…).

That or maybe electron/electron#8505.

Ah no, the empty BrowserWindow is not really a "bug", it is a "feature" :)

The r2-testapp-js user interface / UX is really basic, there is in fact no initial Electron BrowserWindow for a bookshelf / library view (only a system menu to choose publications from the filesystem). So on MacOS (platform darwin) we display a "welcome" native message box to let the user know about the existence of the top-level system menu, whereas on the other platforms we create a BrowserWindow to hosts the system menu and to display the "welcome" message that explains users what to do.

const detail = "Note that this is only a developer application (" +
"test framework) for the Readium2 NodeJS 'streamer' and Electron-based 'navigator'.";
const message = "Use the 'Electron' menu to load publications.";
if (process.platform === "darwin") {
const choice = dialog.showMessageBox({
buttons: ["&OK"],
cancelId: 0,
defaultId: 0,
detail,
message,
noLink: true,
normalizeAccessKeys: true,
title: "Readium2 Electron streamer / navigator",
type: "info",
});
if (choice === 0) {
debug("ok");
}
} else {
const html = `<html><h2>${message}<hr>${detail}</h2></html>`;
const electronBrowserWindow = new BrowserWindow({
height: 300,
webPreferences: {
allowRunningInsecureContent: false,
contextIsolation: false,
devTools: false,
nodeIntegration: false,
nodeIntegrationInWorker: false,
sandbox: false,
webSecurity: true,
webviewTag: false,
// preload: __dirname + "/" + "preload.js",
},
width: 400,
});
electronBrowserWindow.webContents.loadURL("data:text/html," + html);
}

So, this issue is about the weird empty reader view in Lubuntu's LXDE X11-based window manager ( https://lxde.org ), instead of the "welcome" message.

Thanks for the Electron GPU heads-up though, good to know.

Ok OK sorry for the noise then.

On a somewhat related note, Lubuntu is currently transitioning to LXQt, see their explainer.

@JayPanoz I created this r2-navigator-js issue just in case GPU hardware-accelerated webview is problematic in our current Electron v2 implementations:
readium/r2-navigator-js#17

Eventually we will migrate to Electron v3+ which will bring its own set of breaking changes / integration challenges:
readium/r2-navigator-js#15
... but hopefully this will fix any potential GPU issues :)

Ah, my bad, I was trying to use the npm run electron CLI to open a custom root directory, when in fact the command line parameter is meant to be a file! (EPUB to open directly)
I added a directory check to the CLI to avoid this silly mistake in the future:
e5f2310