![]() Orientation: ScreenOrientation ) Ĭonsole. This task is executed only in the Renderer process (the view). This is the output on my MacBook Pro 13″: window. To change the zoom level of a window in Electron, you will need to use the webFrame module of Electron that allows you to customize the rendering of the current web page. You can get information about the current screen by looking at the window.screen property, which returns a Screen object. For example, to open a 400×300 window at 50 pixels from the left and 50 pixels from the top, this is the code that you could use: const popup = window. ![]() To specify a window's position, you can pass the coordinates as left and top (or screenX and screenY respectively) and pass the desired size as width and height (or innerWidth and innerHeight respectively). While some aspects of this API seem a little archaic, such as its windowFeatures DOMString parameter, it has nevertheless served us well over the years. The time-tested approach to controlling windows, Window.open(), is unfortunately unaware of additional screens. You will also be working with desktopCapture features and generating thumbnails from code. minWidth Integer - Window's minimum width. center Boolean - Show window in the center of the screen. This will help you understand how to control application windows in Electron. useContentSize Boolean - The width and height would be used as web page's size, which means the actual window's size will include window frame's size and be slightly larger. # How to use the Window Management API # The problem As part of the practical exercise in this chapter, you are going to generate screenshots using the Electron API and manage the application's window state and visibility. Slideshow apps can show speaker notes on the internal primary screen and the presentation on an external projector.Virtual trading desks can show market trends in multiple windows any of which can be viewed in fullscreen mode.Multi-window graphics editors à la Gimp can place various editing tools in accurately positioned windows.The Window Management API was formerly known as the Multi-Screen Window Placement API.Įxamples of sites that may use this API include: In order to retrieve the height and width of the screen, you can rely on the size property of the returned screen object: var mainScreen screenElectron.getPrimaryDisplay () var dimensions mainScreen.size console.log (dimensions.width + 'x' + dimensions.height) // Outputs i.
0 Comments
Leave a Reply. |