​[Electron] Make the app background transparent, ​and don’t let the user click the mouse.

syobochim
Nov 9, 2020

--

​I made a desktop app with Electron.

  • I want the background to be transparent.
  • I want to erase the frame.
  • I don’t want user to change the size.
  • Do not shadow windows (When I made the background transparent, something like a shadow of letters appeared.)
  • Don’t want the mouse to click (prevent someone from making a choice)
  • I don’t want you to open developer mode.

​I didn’t have a lot of things organized on the Internet, so just for reference.

​I added the settings when I opened the window in main.js, which is defined in main of package.json .

const { BrowserWindow } = require("electron")function createClapWindow() {
const mainWindow = new BrowserWindow({
transparent: true,
frame: false,
resizable: false,
hasShadow: false,
webPreferences: {
devTools: false
}
})
mainWindow.setIgnoreMouseEvents(true)
mainWindow.loadFile('public/index.html')
}

--

--

syobochim
syobochim

No responses yet