#NEWLINE# def xwindowinfo( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# windowvar = self . local_dpy . get_input_focus ( ) . focus #NEWLINE# wmname = windowvar . get_wm_name ( ) #NEWLINE# wmclass = windowvar . get_wm_class ( ) #NEWLINE# wmhandle = str ( windowvar ) [ 20 : 30 ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'name' : None , #NEWLINE# 'class' : None , #NEWLINE# 'handle' : None , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( ( wmname == None ) and ( wmclass == None ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# windowvar = windowvar . query_tree ( ) . parent #NEWLINE# wmname = windowvar . get_wm_name ( ) #NEWLINE# wmclass = windowvar . get_wm_class ( ) #NEWLINE# wmhandle = str ( windowvar ) [ 20 : 30 ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'name' : None , #NEWLINE# 'class' : None , #NEWLINE# 'handle' : None , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# if ( wmclass == None ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'name' : wmname , #NEWLINE# 'class' : wmclass , #NEWLINE# 'handle' : wmhandle , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'name' : wmname , #NEWLINE# 'class' : wmclass [ 0 ] , #NEWLINE# 'handle' : wmhandle , #NEWLINE# #UNINDENT# }