Created
February 15, 2022 05:12
-
-
Save aprilandjan/ea01484a19030c73825e8f6569102875 to your computer and use it in GitHub Desktop.
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') | |
const path = require('path') | |
const url = require('url') | |
let window = null | |
// Wait until the app is ready | |
app.once('ready', () => { | |
// Create a new window | |
window = new BrowserWindow({ | |
// Set the initial width to 500px | |
width: 500, | |
// Set the initial height to 400px | |
height: 400, | |
// set the title bar style | |
titleBarStyle: 'hiddenInset', | |
// set the background color to black | |
backgroundColor: "#111", | |
// Don't show the window until it's ready, this prevents any white flickering | |
show: false, | |
resizable: false, | |
maximizable: false, | |
fullscreenable: true, | |
}) | |
window.loadURL(url.format({ | |
pathname: path.join(__dirname, 'index.html'), | |
protocol: 'file:', | |
slashes: true | |
})) | |
function showWindowProps() { | |
console.log(`win resizable=${window.resizable}; isMaximizable=${window.isMaximizable()}; isFullScreenable=${window.isFullScreenable()}`); | |
} | |
window.once('ready-to-show', () => { | |
window.show() | |
showWindowProps(); | |
// win resizable=false; isMaximizable=false; isFullScreenable=true | |
// The `zoom/fullscreen` button is disabled in window title bar, which mismatched the `isFullScreenable` value | |
window.setResizable(true) | |
showWindowProps(); | |
// win resizable=true; isMaximizable=false; isFullScreenable=false | |
// The `zoom/fullscreen` button is disabled in window title bar | |
window.setMaximizable(true) | |
showWindowProps(); | |
// win resizable=true; isMaximizable=true; isFullScreenable=false | |
// The `zoom/fullscreen` button is enabled in window title bar, which mismatched the `isFullScreenable` value | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment