3

I, I'm writing an app with electron (http://electron.atom.io/). I would like to deactivate the monitor/display of the pc and only activate it again, when something in the app happens (for energy-saving). Is there a way to do this? The only think I found, is the powerSaveBlocker (http://electron.atom.io/docs/api/power-save-blocker/) which doesn't help me...

cklm
  • 787
  • 1
  • 6
  • 24
  • Following [Aakash answer](https://stackoverflow.com/a/44261513/2269874), this is a good solution: [Create a batch file to change the power options in Windows 7](https://stackoverflow.com/questions/30807801/create-a-batch-file-to-change-the-power-options-in-windows-7) – Yigal Jul 27 '20 at 07:41

2 Answers2

2

You'll need to use native system APIs to do this, on Windows you can use one of the solutions proposed in Turn on/off monitor.

Vadim Macagon
  • 14,463
  • 2
  • 52
  • 45
0

One of the ways you can do that is by executing batch files from electron/node in Windows , shell scripts in Linux and whatever MAC OS uses to execute commands.

These scripts would contain the OS level commands to turn on/off the display which are easily available .

When to fire these scripts would depend on your application logic .

Aakash Uniyal
  • 1,519
  • 4
  • 17
  • 32