Skip to content

Commit

Permalink
added display brightness check
Browse files Browse the repository at this point in the history
  • Loading branch information
hanayik committed Feb 21, 2017
1 parent e3e5702 commit cc6b2c0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ff = require('./camera/ffmpeg')
const appRootDir = require('app-root-dir').get() //get the path of the application bundle
const ffmpeg = appRootDir+'/ffmpeg/ffmpeg'
const exec = require( 'child_process' ).exec
const system = require('system-control')();
//icon credit: http://www.flaticon.com/authors/madebyoliver

// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -37,6 +38,22 @@ function createWindow () {
// when you should delete the corresponding element.
mainWindow = null
})

function checkForMaxBrightness() {
system.display.getBrightness().then(function(brightness) {
console.log(brightness)
if (brightness < 1) {
dialog.showMessageBox({ type: 'info', buttons: ['Adjust brightness for me', 'Cancel'], message: "Your screen seems a bit dim, would you like to set it to it's maximum setting? It's best to have it as bright as possible." }, function (buttonIndex) {
if (buttonIndex == 0) {
maxBrightness = 1
system.display.setBrightness(maxBrightness).then(function() {});
}
});
}
});
}

checkForMaxBrightness()
}

// This method will be called when Electron has finished
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"csvsync": "^1.0.1",
"jQuery": "^1.7.4",
"moment": "^2.17.1",
"system-control": "0.0.4",
"systeminformation": "^3.16.0"
}
}

0 comments on commit cc6b2c0

Please sign in to comment.