Last active
December 20, 2015 00:38
-
-
Save manuquentin/6042763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var io = require('socket.io-client'); | |
var socket = io.connect('http://my-server'); | |
socket.on('status', function(status){ | |
if(status.exit == 1){ | |
lockScreen(); | |
}else if(status.sensei == 1){ | |
launchSite(); | |
} | |
}); | |
socket.on('error', function(err){ | |
// Do something with the error | |
}); | |
function lockScreen(){ | |
exec('/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend'); | |
} | |
function launchSite(){ | |
exec('open -a Google\\ Chrome "http://github.com"'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment