Skip to content

Instantly share code, notes, and snippets.

@dg3feiko
Created November 10, 2018 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg3feiko/2ac8ec30a3b729f964dd21fe3a80a139 to your computer and use it in GitHub Desktop.
Save dg3feiko/2ac8ec30a3b729f964dd21fe3a80a139 to your computer and use it in GitHub Desktop.
Mac Lock
const isCharging = require('is-charging');
const bluebird = require('bluebird');
const exec = require('child_process').exec;
(async () => {
while (true) {
let charging = await isCharging()
console.log(charging)
if(!charging){
exec('"say" -v Victoria Beep');
}
await bluebird.delay(1000)
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment