Objet BrowserWindowConstructorOptions
widthInteger (facultatif) - Largeur de la fenêtre en pixels. La valeur par défaut est800.heightInteger(facultatif) - Hauteur de la fenêtre en pixels. La valeur par défaut est600.xInteger (facultatif) - (obligatoire si y est utilisé) Décalage gauche de la fenêtre à partir de l'écran. La valeur par défaut est de centrer la fenêtre.yInteger (facultatif) - (obligatoire si x est utilisé) Décalage supérieur de la fenêtre par rapport à l'écran. La valeur par défaut est de centrer la fenêtre.useContentSizeBoolean (facultatif) - La largeur (width) et la hauteur (height) seront utilisées pour définir la taille de la page Web, ce qui signifie que la taille de la fenêtre réelle inclura la taille du cadre de celle-ci et sera légèrement plus grande.falsepar défaut.centerboolean (facultatif) - Affiche la fenêtre au centre de l’écran.falsepar défaut.minWidthInteger (facultatif) - Largeur minimum de la fenêtre. La valeur par défaut est0.minHeightInteger (facultatif) - Hauteur minimale de la fenêtre. La valeur par défaut est0.maxWidthInteger (facultatif) - Largeur maximale de la fenêtre. Il n'y a pas de limite par défaut.maxHeightInteger (facultatif) - Hauteur maximale de la fenêtre. Il n'y a pas de limite par défaut.<code>resizable</code> boolean (facultatif) - Indique si la fenêtre est redimensionnable.true` par défaut.movableboolean (facultatif) macOS Windows - Indique si la fenêtre est déplaçable. Ceci n'est pas implémenté sous Linux.truepar défaut.minimizableboolean (facultatif) macOS Windows - Indique si la fenêtre est minimisable. Ceci n'est pas implémenté sous Linux.truepar défaut.maximizableboolean (facultatif) macOS Windows - Indique si la fenêtre est maximizable. Ceci n'est pas implémenté sous Linux.truepar défaut.closableboolean (optional) macOS Windows - Indique si la fenêtre est closable. Ceci n'est pas implémenté sous Linux.truepar défaut.focusableboolean (facultatif) - Indique que la fenêtre pourra ou non prendre le focus. True par défaut. Sous Windows, définirfocusable: falseimplique également de définirskipTaskbar: true`. Sur Linux, mettrefocusable: falsefait que la fenêtre arrête d'interragir avec wm, par conséquent la fenêtre restera toujours au dessus dans tous les espaces de travail.alwaysOnTopboolean (facultatif) - Indique si la fenêtre doit toujours rester au-dessus des autres fenêtres.falsepar défaut.fullscreenboolean (facultatif) - Indique si la fenêtre doit s'afficher en plein écran. Quand explicitement mit afalse, le bouton plein écran sera caché ou désactivé sur macOS.falsepar défaut.fullscreenableboolean (facultatif) - Indique si la fenêtre peut s'afficher en plein écran. Sur macOS, indique également si le bouton de maximizer/zoom doit faire basculer en mode plein écran ou agrandir la fenêtre.truepar défaut.simpleFullscreenboolean (facultatif) macOS - Utilise fullscreen sur macOS pre-Lion .falsepar défaut.skipTaskbarboolean (facultatif) macOS Windows - Indique si il faut afficher la fenêtre dans la barre des tâches.falsepar défaut.- `
hiddenInMissionControlboolean (facultatif) macOS - Indique si la fenêtre doit être masquée lorsque l'utilisateur bascule sur Mission Control. kioskboolean (optional) - Whether the window is in kiosk mode.falsepar défaut.titlestring (optional) - Default window title. Default is"Electron". If the HTML tag<title>is defined in the HTML file loaded byloadURL(), this property will be ignored.icon(NativeImage | string) (optional) - The window icon. On Windows it is recommended to useICOicons to get best visual effects, you can also leave it undefined so the executable's icon will be used.- boolean (facultatif) -
Détermine si la fenêtre doit s'afficher ou non à la création. True par défaut. frameboolean (facultatif) - Spécifiezfalsepour créer une fenêtre sans cadre.truepar défaut.parentBaseWindow (facultatif) - Indique la fenêtre parente.falsepar défaut.modalboolean (facultatif) - Indique si il s'agit d'une fenêtre modale. Cela ne fonctionne que lorsque la fenêtre est une fenêtre enfant.falsepar défaut.acceptFirstMouseboolean (facultatif) macOS - Indique si un click sur une fenêtre inactive passera à travers pour être transmis au contenu Web. La valeur par défaut estfalsesur macOS. Et cette option n'est pas configurable sur les autres plateformes.disableAutoHideCursorboolean (facultatif) - Permet de masquer le curseur lors de la saisie.falsepar défaut.autoHideMenuBarboolean (facultatif) - Masque la barre de menu sauf si la toucheAltest enfoncée.falsepar défaut.enableLargerThanScreenbooléen (facultatif) macOS - Permet à la fenêtre d'être redimensionnée en étant plus grande que l'écran. Seulement pertinent pour macOS, les autres systèmes d'exploitation autorisant par défaut des fenêtres plus grandes que l'écran par défaut.falsepar défaut.backgroundColorstring (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported iftransparentis set totrue. Default is#FFF(white). See win.setBackgroundColor for more information.hasShadowboolean (facultatif) - Indique si la fenêtre doit avoir une ombre.truepar défaut.opacitynumber (optional) macOS Windows - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.darkThemeboolean (facultatif) - Force l'utilisation du thème sombre pour la fenêtre, ne fonctionne que sur certains environnements de bureau GTK+3.falsepar défaut.transparentboolean (facultatif) - Rend la fenêtre transparent.falsepar défaut. Ne fonctionne pas sous Windows à moins que la fenêtre soit sans bordure.- string (facultatif) - Type de fenêtre, par défaut normal. Voir ci-dessous pour en savoir plus.
visualEffectStatestring (optional) macOS - Specify how the material appearance should reflect window activity state on macOS. Must be used with thevibrancyproperty. Les valeurs possibles étant:followWindow- The backdrop should automatically appear active when the window is active, and inactive when it is not. C'est le comportement par défaut.active- The backdrop should always appear active.inactive- The backdrop should always appear inactive.
titleBarStylestring (optional) - The style of window title bar. Default isdefault. Les valeurs possibles étant:default- Results in the standard title bar for macOS or Windows respectively.hidden- Results in a hidden title bar and a full size content window. Sur macOS, la fenêtre aura toujours les commandes standard des fenêtres (« feux de circulation ») en haut à gauche. On Windows and Linux, when combined withtitleBarOverlay: trueit will activate the Window Controls Overlay (seetitleBarOverlayfor more information), otherwise no window controls will be shown.hiddenInsetmacOS - Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.customButtonsOnHovermacOS - Results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. Note: This option is currently experimental.
titleBarOverlayObject | Boolean (optional) - When using a frameless window in conjunction withwin.setWindowButtonVisibility(true)on macOS or using atitleBarStyleso that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay JavaScript APIs and CSS Environment Variables. Specifyingtruewill result in an overlay with default system colors.falsepar défaut.colorString (optional) Windows Linux - The CSS color of the Window Controls Overlay when enabled. La couleur par défaut est la couleur du système.symbolColorString (facultatif) Windows - Couleur CSS des symboles de l'overlay des contrôles lorsqu'il est activé. La couleur par défaut est la couleur du système.heightInteger (optional) - The height of the title bar and Window Controls Overlay in pixels. La valeur par défaut est la hauteur du système.
accentColorboolean | string (facultatif) Windows - La couleur d'accentuation de la fenêtre. Suit par défaut la préférence de l’utilisateur des paramètres système. A définir àfalsepour désactiver explicitement, ou avec la couleur dans un des formats Hex, RGB, RGBA, HSL, HSLA ou une couleur nommée CSS. Les valeurs alpha seront ignorées.trafficLightPositionPoint (optional) macOS - Set a custom position for the traffic light buttons in frameless windows.<code>roundedCorners</code> boolean (facultatif) <em x-id="4">macOS</em> - Indique si la fenêtre sans bordure doit avoir des coins arrondis sur macOS.true` par défaut. L'assignation defalseà cette propriété empêchera la fenêtre d'être plein écran. Sur les versions de Windows antérieures à Windows 11 Build 22000 cette propriété n'a aucun effet, et les fenêtres sans cadre n'auront pas de coins arrondis.thickFrameboolean (optional) Windows - UseWS_THICKFRAMEstyle for frameless windows on Windows, which adds the standard window frame. Setting it tofalsewill remove window shadow and window animations, and disable window resizing via dragging the window edges.truepar défaut.vibrancystring (optional) macOS - Add a type of vibrancy effect to the window, only on macOS. Can beappearance-based,titlebar,selection,menu,popover,sidebar,header,sheet,window,hud,fullscreen-ui,tooltip,content,under-window, orunder-page.backgroundMaterialstring (optional) Windows - Set the window's system-drawn background material, including behind the non-client area. Can beauto,none,mica,acrylicortabbed. See win.setBackgroundMaterial for more information.zoomToPageWidthboolean (optional) macOS - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Iftrue, the window will grow to the preferred width of the web page when zoomed,falsewill cause it to zoom to the width of the screen. This will also affect the behavior when callingmaximize()directly.falsepar défaut.tabbingIdentifierstring (optional) macOS - Tab group name, allows opening the window as a native tab. Windows with the same tabbing identifier will be grouped together. This also adds a native new tab button to your window's tab bar and allows yourappand window to receive thenew-window-for-tabevent.
When setting minimum or maximum window size with minWidth/maxWidth/
minHeight/maxHeight, it only constrains the users. It won't prevent you from
passing a size that does not follow size constraints to setBounds/setSize or
to the constructor of BrowserWindow.
The possible values and behaviors of the type option are platform dependent.
Les valeurs possibles étant:
- Sous Linux, les types possibles sont
desktop,dock,toolbar,splash,notification.- Le type
desktopplace la fenêtre au niveau de la fenêtre de fond de bureau (kCGDesktopWindowLevel - 1). However, note that a desktop window will not receive focus, keyboard, or mouse events. You can still use globalShortcut to receive input sparingly. - The
docktype creates a dock-like window behavior. - The
toolbartype creates a window with a toolbar appearance. - The
splashtype behaves in a specific way. It is not draggable, even if the CSS styling of the window's body contains -webkit-app-region: drag. Ce type est couramment utilisé pour les écrans de démarrage. - The
notificationtype creates a window that behaves like a system notification.
- Le type
- On macOS, possible types are
desktop,textured,panel.- The
texturedtype adds metal gradient appearance. This option is deprecated. - The
desktoptype places the window at the desktop background window level (kCGDesktopWindowLevel - 1). Note that desktop window will not receive focus, keyboard or mouse events, but you can useglobalShortcutto receive input sparingly. - The
paneltype enables the window to float on top of full-screened apps by adding theNSWindowStyleMaskNonactivatingPanelstyle mask, normally reserved for NSPanel, at runtime. Also, the window will appear on all spaces (desktops).
- The
- On Windows, possible type is
toolbar.