Skip to content

Commit

Permalink
Fixed shortcuts dialog box multiple monitors issue
Browse files Browse the repository at this point in the history
  • Loading branch information
romanakash committed Jun 1, 2020
1 parent fbfb5e5 commit 593c782
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions desktop-app/app/menu.js
@@ -1,5 +1,13 @@
// @flow
import {app, dialog, Menu, shell, BrowserWindow, clipboard} from 'electron';
import {
app,
dialog,
Menu,
shell,
BrowserWindow,
clipboard,
screen,
} from 'electron';
import * as os from 'os';
import {pkg} from './utils/generalUtils';

Expand Down Expand Up @@ -52,28 +60,33 @@ export default class MenuBuilder {
{
label: 'Keyboard Shortcuts',
click: () => {
const {getCursorScreenPoint, getDisplayNearestPoint} = screen;

let win = new BrowserWindow({
parent: BrowserWindow.getFocusedWindow(),
modal: true,
frame: false,
height: 800,
webPreferences: {
devTools: false,
nodeIntegration: true,
},
});

const currentScreen = getDisplayNearestPoint(getCursorScreenPoint());
win.setPosition(currentScreen.workArea.x, currentScreen.workArea.y);

win.center();

win.loadURL(`file://${__dirname}/shortcuts.html`);

win.once('ready-to-show', () => {
win.show();
});

win.on('blur', () => {
win.close();
win.hide();
});

win.on('close', () => {
win.on('closed', () => {
win = null;
});
},
Expand Down

0 comments on commit 593c782

Please sign in to comment.