added quit when space is pressed for gracefull quit when run from terminal outside X