3 Commits
Author SHA1 Message Date
leukipp c8f254d90a build: update version 2024-12-17 22:02:40 +01:00
leukipp 5e3d204019 docs: update readme 2024-12-17 21:56:30 +01:00
leukipp 926bcdfab8 feat: allow only a single instance 2024-12-17 21:54:49 +01:00
4 changed files with 21 additions and 8 deletions
+2 -2
View File
@@ -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.
## Setup
Before you begin, ensure that you have a Raspberry Pi configured and running 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.
Before you begin, make sure that you have a Raspberry Pi configured and operational with a compatible touch display.
This guide assumes that you are using the latest version of **Raspberry Pi OS (64-bit)** together with a desktop environment.
### 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.
+5
View File
@@ -13,6 +13,11 @@ const { app } = require("electron");
* initialization tasks.
*/
app.whenReady().then(async () => {
const lock = app.requestSingleInstanceLock();
if (!lock) {
console.error("TouchKio is already running");
return app.quit();
}
let args = parseArgs(process);
let argsProvided = !!Object.keys(args).length;
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "touchkio",
"description": "Home Assistant Touch Kiosk",
"author": "leukipp",
"version": "0.0.3",
"version": "1.0.0",
"license": "MIT",
"main": "index.js",
"scripts": {
+13 -5
View File
@@ -24,12 +24,10 @@ const init = async (args) => {
const theme = args.web_theme ? args.web_theme : "dark";
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
nativeTheme.themeSource = theme;
WEBVIEW.window = new BaseWindow({
title: `TouchKio - ${url.host}`,
icon: path.join(__dirname, "..", "img", "icon.png"),
});
WEBVIEW.window.setMenuBarVisibility(false);
@@ -106,18 +104,28 @@ const windowEvents = (window, zoom) => {
WEBVIEW.locked = false;
});
// Update window status
// Handle window status updates
window.on("minimize", update);
window.on("restore", update);
window.on("maximize", update);
window.on("unmaximize", update);
window.on("enter-full-screen", update);
window.on("leave-full-screen", update);
// Handle signal and exit events
process.on("SIGINT", app.quit);
app.on("before-quit", () => {
WEBVIEW.status = "Terminated";
integration.update();
});
// Handle multiple instances
app.on("second-instance", () => {
if (window.isMinimized()) {
window.restore();
}
window.focus();
});
};
/**