From 5e263648d54ab3318df49dff30c0ccba53789c14 Mon Sep 17 00:00:00 2001 From: Drew Date: Sat, 16 Nov 2024 17:32:40 -0800 Subject: [PATCH] fullscreen hide mouse cursor --- main.js | 17 ++++++++--------- src/App.css | 11 ++++++++++- src/App.js | 13 ++++++++++++- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/main.js b/main.js index 4a07037..4aa1f3d 100644 --- a/main.js +++ b/main.js @@ -131,6 +131,7 @@ function createWindow() let windowOptions = { width: 800, height: 480, + fullscreen: true, webPreferences: { nodeIntegration: false, contextIsolation: true, @@ -138,17 +139,10 @@ function createWindow() worldSafeExecuteJavaScript: true, preload: path.join(__dirname, 'preload.js') }, + frame: false, + kiosk: true }; - if (isRaspberryPi || (isDev && process.env.FULLSCREEN === 'true')) - { - windowOptions.fullscreen = true; - } else - { - // Center the window on macOS or in dev mode - windowOptions.center = true; - } - mainWindow = new BrowserWindow(windowOptions); // Load the index.html from a url @@ -158,6 +152,11 @@ function createWindow() : `file://${path.join(__dirname, './build/index.html')}` ); + // Hide the cursor + mainWindow.webContents.on('dom-ready', () => { + mainWindow.webContents.insertCSS('* { cursor: none !important; }'); + }); + // Open the DevTools in development mode if (isDev) { diff --git a/src/App.css b/src/App.css index fd79d55..8ab7ee7 100644 --- a/src/App.css +++ b/src/App.css @@ -28,7 +28,12 @@ color: #333; text-align: center; text-transform: uppercase; /* Optional: if you want all caps text */ - + cursor: none !important; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + overflow: hidden; } .App { @@ -800,3 +805,7 @@ button:active { background: rgba(198, 202, 224, 0.1); color: white; } + +* { + cursor: none !important; +} diff --git a/src/App.js b/src/App.js index 46d84bf..97b29e4 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,17 @@ import VisualizationMode from './VisualizationMode'; import EffectSelectScreen from './EffectSelectScreen'; import './App.css'; +// Add this style to your existing CSS or create a new style block +const styles = { + app: { + cursor: 'none', // Hide cursor at the React level + userSelect: 'none', // Prevent text selection + WebkitUserSelect: 'none', // For Safari + MozUserSelect: 'none', // For Firefox + msUserSelect: 'none', // For IE/Edge + } +}; + const electron = window.electron; function App() { @@ -238,7 +249,7 @@ function App() { } return ( -
+
{currentScreen === 'visualization' ? (