add onapplicationquit and onapplicationfocus