Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move the BrowserWindow to the bottom right

I want to ask if there's method dynamically set the position or move the Browser Window to the bottom right?

BrowserWindow.setPosition(x, y)
like image 751
P. James Avatar asked Mar 19 '18 01:03

P. James


People also ask

How do I make the electron app full screen?

To make an Electron app run in full-screen mode when it's started, pass the following configuration option when creating the BrowserWindow instance: mainWindow = new BrowserWindow({fullscreen: true});

How do you close the electron window?

getElementById("close-btn"). addEventListener("click", function (e) { var window = remote. getCurrentWindow(); window. close(); });

How do I move the window?

Here are two keyboard shortcuts to move window: 1 Win + Left Arrow: snap the window to the left 2 Win + Right Arrow: snap the window to the right More ...

How do I move a window to the title bar?

Step 1: Click the window or you can use the keyboard shortcut – Alt + Tab and let the window that you want to move active. Step 3: Press M (equal to selecting the Move option) and the mouse cursor will turn into a cross with arrows and move to the title bar of the window.

How do I move a program to the side of my screen?

Select Move from the pop-up menu. Press the left arrow or right arrow key until the program or app appears on the screen. A similar method swaps out the Shift key for the Windows key. It also relies on the snapping feature that snaps windows to the sides of your screen.

How to move off-screen windows in Windows 10?

Some involve using different keys on the keyboard, while others involved adjusting settings within Windows 10. This method uses the left and right arrow keys on your keyboard to move off-screen windows. Launch the program or app (if it’s not opened already). Press the Shift key and right-click the active program or app icon located on the taskbar .


1 Answers

You can use the screen API, and use a fixed with to offset from the edge of the screen:

let display = electron.screen.getPrimaryDisplay();
let width = display.bounds.width;
win = new BrowserWindow({
  width: 600,
  x: width - 600,
  y: 0
});
like image 198
Obsidian Age Avatar answered Sep 20 '22 13:09

Obsidian Age