javascript - Disable maximizing in electron - Stack Overflow

So I have an electron app. I have set maxWidths and maxHeights but how do I disable maximizing.I have

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
Add a ment  | 

3 Answers 3

Reset to default 5

This 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

相关推荐

  • javascript - Disable maximizing in electron - Stack Overflow

    So I have an electron app. I have set maxWidths and maxHeights but how do I disable maximizing.I have

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信