So I have an electron app. I have set maxWidths and maxHeights but how do I disable maximizing.
I have already made custom buttons for ms-windows but i don't want to remove the traffic lights on mac.
On other applications, i have seen the green traffic light greyed out. How do I acheive this?
So I have an electron app. I have set maxWidths and maxHeights but how do I disable maximizing.
I have already made custom buttons for ms-windows but i don't want to remove the traffic lights on mac.
On other applications, i have seen the green traffic light greyed out. How do I acheive this?
Share asked Jul 10, 2021 at 10:07 IsaacIsaac 112 silver badges2 bronze badges 2- do you want a fixed size window? – mercury Commented Jul 10, 2021 at 10:12
- No, my app just isn't sutable for full screen. – Isaac Commented Jul 11, 2021 at 7:53
3 Answers
Reset to default 5This is supported by Electron out of the box. When creating your BrowserWindow
just set the maximizable
property of the options object to false
. Since you didn't show us any code, this is just an example:
const { BrowserWindow } = require ("electron");
var window = new BrowserWindow ({ title: "My App", maximizable: false });
Please note that at the time of writing, this is not supported on Linux. See the Electron documentation for more information on BrowserWindow
and its options.
See https://www.electronjs/docs/latest/api/browser-window
resizable boolean (optional) - Whether window is resizable. Default is true.
In windows machine, Browser Window can be restricted to maximize by putting option maximizable: false
. See code example below.
const { BrowserWindow } = require ("electron");
var window = new BrowserWindow ({ title: "My App", maximizable: false });
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744923318a4601270.html
评论列表(0条)