detecting if xwindow is active