Created
June 24, 2024 12:18
-
-
Save t57ser/ee82b7ea981e35afc9a3130c28e7e20e to your computer and use it in GitHub Desktop.
[Bug]: Using app.disableHardwareAcceleration() makes window disappear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {app, BrowserWindow, ipcMain, WebContentsView} = require('electron') | |
let mainWindow | |
function createWindow () { | |
const mainWindow1 = new BrowserWindow({ | |
x: 0, | |
y: 0, | |
width: 1000, | |
height: 600, | |
show: false, | |
frame: false, | |
transparent: true, | |
}); | |
mainWindow1.loadURL("https://www.example.com").then(() => { | |
//mainWindow1.webContents.openDevTools(); | |
mainWindow1.show(); | |
}) | |
} | |
app.disableHardwareAcceleration(); | |
app.on('ready', createWindow) | |
app.on('window-all-closed', function () { | |
if (process.platform !== 'darwin') { | |
app.quit() | |
} | |
}) | |
app.on('activate', function () { | |
if (mainWindow === null) { | |
createWindow() | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"main": "main.js", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"devDependencies": { | |
"electron": "31.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment