Small Module that returns an array with all the monitors connected to the pc with their resolution and position.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
binding.gyp
package.json
screen.js

README.md

Electron Screen

js-standard-style

Small Module that returns an array with all the monitors connected to the pc with their resolution and position.
The standard API of electron already do this, but under Windows the screen api suffers lot of issues.

Works only under Windows OS!
If you want to manage screens with other OS have a look here.

Usage

Download and install electron-screen through npm, then require it:

const screen = require('electron-screen')

console.log(screen())

Under Windows electron-screen returns the following array of objects, where every object is a different screen :

[{
  bounds: {
    x: Number,
    y: Number,
    width: Number,
    height: Number
  }
}]

Build

  • For testing:
$ npm build .
  • For use the module inside Electron:
    Follow this instructions.

TODO

  • Wrap Electron's native screen API and use electron-screen only under Windows.
  • Add testing

Contributing

If you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.

I would make a special thanks to @Corralx for helping me to improving the code.

The code follows the Standard code style.
js-standard-style


License

The code is released under the MIT license.

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.