Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8f254d90a | ||
|
|
5e3d204019 | ||
|
|
926bcdfab8 |
@@ -22,8 +22,8 @@ The kiosk application can be executed with command line arguments to load a **Ho
|
|||||||
Additionally, a **MQTT endpoint** can be defined, allowing the application to provide controls and sensors for the Raspberry Pi and the connected touch display.
|
Additionally, a **MQTT endpoint** can be defined, allowing the application to provide controls and sensors for the Raspberry Pi and the connected touch display.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
Before you begin, ensure that you have a Raspberry Pi configured and running with a compatible touch display.
|
Before you begin, make sure that you have a Raspberry Pi configured and operational with a compatible touch display.
|
||||||
This guide assumes you are using **Raspberry Pi OS Lite (64-bit)**, which is recommended for kiosk applications due to its **lightweight** nature and minimal overhead.
|
This guide assumes that you are using the latest version of **Raspberry Pi OS (64-bit)** together with a desktop environment.
|
||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
To utilize the sensor features of your display through Home Assistant, it's essential to have a **MQTT broker running** and the **MQTT integration installed** on your Home Assistant instance.
|
To utilize the sensor features of your display through Home Assistant, it's essential to have a **MQTT broker running** and the **MQTT integration installed** on your Home Assistant instance.
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ const { app } = require("electron");
|
|||||||
* initialization tasks.
|
* initialization tasks.
|
||||||
*/
|
*/
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
|
const lock = app.requestSingleInstanceLock();
|
||||||
|
if (!lock) {
|
||||||
|
console.error("TouchKio is already running");
|
||||||
|
return app.quit();
|
||||||
|
}
|
||||||
let args = parseArgs(process);
|
let args = parseArgs(process);
|
||||||
let argsProvided = !!Object.keys(args).length;
|
let argsProvided = !!Object.keys(args).length;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "touchkio",
|
"name": "touchkio",
|
||||||
"description": "Home Assistant Touch Kiosk",
|
"description": "Home Assistant Touch Kiosk",
|
||||||
"author": "leukipp",
|
"author": "leukipp",
|
||||||
"version": "0.0.3",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+13
-5
@@ -24,12 +24,10 @@ const init = async (args) => {
|
|||||||
const theme = args.web_theme ? args.web_theme : "dark";
|
const theme = args.web_theme ? args.web_theme : "dark";
|
||||||
const zoom = args.web_zoom ? parseFloat(args.web_zoom) : 1.25;
|
const zoom = args.web_zoom ? parseFloat(args.web_zoom) : 1.25;
|
||||||
|
|
||||||
// Set app theme and name
|
|
||||||
nativeTheme.themeSource = theme;
|
|
||||||
app.setName("TouchKio");
|
|
||||||
|
|
||||||
// Init global root window
|
// Init global root window
|
||||||
|
nativeTheme.themeSource = theme;
|
||||||
WEBVIEW.window = new BaseWindow({
|
WEBVIEW.window = new BaseWindow({
|
||||||
|
title: `TouchKio - ${url.host}`,
|
||||||
icon: path.join(__dirname, "..", "img", "icon.png"),
|
icon: path.join(__dirname, "..", "img", "icon.png"),
|
||||||
});
|
});
|
||||||
WEBVIEW.window.setMenuBarVisibility(false);
|
WEBVIEW.window.setMenuBarVisibility(false);
|
||||||
@@ -106,18 +104,28 @@ const windowEvents = (window, zoom) => {
|
|||||||
WEBVIEW.locked = false;
|
WEBVIEW.locked = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update window status
|
// Handle window status updates
|
||||||
window.on("minimize", update);
|
window.on("minimize", update);
|
||||||
window.on("restore", update);
|
window.on("restore", update);
|
||||||
window.on("maximize", update);
|
window.on("maximize", update);
|
||||||
window.on("unmaximize", update);
|
window.on("unmaximize", update);
|
||||||
window.on("enter-full-screen", update);
|
window.on("enter-full-screen", update);
|
||||||
window.on("leave-full-screen", update);
|
window.on("leave-full-screen", update);
|
||||||
|
|
||||||
|
// Handle signal and exit events
|
||||||
process.on("SIGINT", app.quit);
|
process.on("SIGINT", app.quit);
|
||||||
app.on("before-quit", () => {
|
app.on("before-quit", () => {
|
||||||
WEBVIEW.status = "Terminated";
|
WEBVIEW.status = "Terminated";
|
||||||
integration.update();
|
integration.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle multiple instances
|
||||||
|
app.on("second-instance", () => {
|
||||||
|
if (window.isMinimized()) {
|
||||||
|
window.restore();
|
||||||
|
}
|
||||||
|
window.focus();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user