Created
September 12, 2021 23:38
-
-
Save Fndroid/4d89afd65c4e36b901a627c051558b65 to your computer and use it in GitHub Desktop.
electron 14 breaks unresiable frameless window
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello World!</title> | |
<meta | |
http-equiv="Content-Security-Policy" | |
content="script-src 'self' 'unsafe-inline';" | |
/> | |
</head> | |
<body style="background: white"> | |
<div | |
style=" | |
background-color: red; | |
-webkit-app-region: drag; | |
height: 30px; | |
width: 100%; | |
" | |
> | |
Fake Title Bar | |
</div> | |
<h1>Hello World!</h1> | |
<p> | |
We are using node | |
<script> | |
document.write(process.versions.node); | |
</script> | |
, Chrome | |
<script> | |
document.write(process.versions.chrome); | |
</script> | |
, and Electron | |
<script> | |
document.write(process.versions.electron); | |
</script> | |
. | |
</p> | |
</body> | |
</html> |
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 } = require("electron"); | |
function createWindow() { | |
const win = new BrowserWindow({ | |
width: 801, | |
height: 601, | |
resizable: false, | |
frame: false, | |
webPreferences: { | |
nodeIntegration: true, | |
}, | |
}); | |
win.loadFile("index.html"); | |
} | |
app.whenReady().then(createWindow); | |
app.on("window-all-closed", () => { | |
if (process.platform !== "darwin") { | |
app.quit(); | |
} | |
}); | |
app.on("activate", () => { | |
if (BrowserWindow.getAllWindows().length === 0) { | |
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
{ | |
"name": "electron-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.js", | |
"scripts": { | |
"dev": "electron ." | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"electron": "^14.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment