glowingbear-mainbox/electron-start.html
Tor Hveem 32e57f2ca9 Rudimentary Electron (Atom-Shell) support
This patch serves as a starting point for making electron based Glowing
Bear builds. Primary motivation is that Mozilla is removing support for
their web runtime, so then Electron is a new way to get standalone
application running outside of browser.

This adds 2 new files that will be the main html and main js for
electron. Those files simply load the rest of the app.

It also adds two new npm run commands to build windows and darwin builds
for electron. Darwin is untested so far.

Bulding packages requires npm package `electron-packager`

There's still some problems with notifications.
And badges for the dock in Darwin is not implemented.
We could also put all keyboard shorcuts in menus.

Thanks to @lukas2511 for some guidance on the wrappers and commands.
2016-03-30 15:19:22 +02:00

31 lines
860 B
HTML

<html>
<head>
<script>
onload = function() {
const ipc= require('electron').ipcRenderer;
var webview = document.getElementById("glowingbear");
var handleconsole = function(e) {
if(e.message.substring(0,7) == "badge: ") {
ipc.send('badge', e.message.substring(7));
}else{
console.log("webview: " + e.message);
}
}
var handlenewwindow = function(e) {
require('shell').openExternal(e.url);
}
var handletitleset = function(e) {
document.title = e.title;
}
webview.addEventListener("console-message", handleconsole);
webview.addEventListener("new-window", handlenewwindow);
webview.addEventListener("page-title-set", handletitleset);
}
</script>
</head>
<body>
<webview id="glowingbear" src="index.html" style="position:fixed; top:0; left:0; bottom:0; right:0;"></webview>
</body>
</html>