Maria MEK
Maria MEK

Reputation: 13

Electron how to detect if monitor/screen displays is plugged out

i can to get screens information with: screen.getAllDisplays(), but can not detect when active(where my app is open) display is plugging out

Upvotes: 0

Views: 475

Answers (1)

Electron have a listener to detect when a display is plugging out, is on the screen module https://www.electronjs.org/es/docs/latest/api/screen#evento-display-removed

you could write something like this

const { screen } = require('electron');

screen.on('display-removed', (event, display) => {
 // do something with the display data
});

Upvotes: 1

Related Questions