Skip to content

Instantly share code, notes, and snippets.

@manuquentin
Last active December 20, 2015 00:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save manuquentin/6042763 to your computer and use it in GitHub Desktop.
Save manuquentin/6042763 to your computer and use it in GitHub Desktop.
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