How to make electron window draggable with the titleBarStyle: 'hidden' option + react and loadURL not loadFIle. How to make it be draggable with loadURL? thank you
for vanilla js this is enough, adding this to styles.css
*{
-webkit-app-region: drag
}
but it doesn't work with react... even after the build... when it loads a file and not the URL
here's the main electron script
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
let win;
async function createWindow() {
// Create the browser window.
win = new BrowserWindow({
width: 500,
height: 450,
titleBarStyle: 'hidden',
webPreferences: {
nodeIntegration: false, // is default value after Electron v5
contextIsolation: true, // protect against prototype pollution
enableRemoteModule: false, // turn off remote
preload: path.join(app.getAppPath(), 'preload.js'), // use a preload script
backgroundThrottling: false,
},
});
// Load app
// win.loadFile(path.join(__dirname, './index.html'));
win.loadURL('http://localhost:3000');
win.setAlwaysOnTop(true, 'screen');
// win.removeMenu();
// rest of code..
}
app.on('ready', createWindow);
how to make an electron + react window draggable? thank you