Skip to content

Instantly share code, notes, and snippets.

@crucialfelix
Created June 28, 2012 11:12
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 crucialfelix/3010725 to your computer and use it in GitHub Desktop.
Save crucialfelix/3010725 to your computer and use it in GitHub Desktop.
Flash all windows RED on language error or server crash
// add this to your startup file
{
var flash = {
Window.allWindows.do { arg w;
var c;
c = w.background;
w.background = Color.red;
{ w.background = c; }.defer(0.5);
};
nil
};
if(thisThread.exceptionHandler.isNil,{
thisThread.exceptionHandler = { |error|
if(Error.handling,{ error.reportError; this.halt; });
Error.handling = true;
flash.defer;
nil.handleError(error);
};
});
if(NotificationCenter.registrationExists(Server.default,\didQuit,this).not,{
NotificationCenter.register(Server.default,\didQuit,this,{
"SERVER QUIT".warn;
flash.defer
});
});
}.defer(0.5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment