#NEWLINE# def compare( self , client ) : #NEWLINE# #INDENT# for ( _type , rule ) in self . _rules : #NEWLINE# #INDENT# if ( _type == 'net_wm_pid' ) : #NEWLINE# #INDENT# def match_func( value ) : #NEWLINE# #INDENT# return ( rule == value ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# match_func = ( getattr ( rule , 'match' , None ) or getattr ( rule , 'count' ) ) #NEWLINE# #UNINDENT# if ( _type == 'title' ) : #NEWLINE# #INDENT# value = client . name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _type == 'wm_class' ) : #NEWLINE# #INDENT# value = None #NEWLINE# _value = client . window . get_wm_class ( ) #NEWLINE# if ( _value and ( len ( _value ) > 1 ) ) : #NEWLINE# #INDENT# value = _value [ 1 ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( _type == 'wm_instance_class' ) : #NEWLINE# #INDENT# value = client . window . get_wm_class ( ) #NEWLINE# if client : #NEWLINE# #INDENT# value = value [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( _type == 'wm_type' ) : #NEWLINE# #INDENT# value = client . window . get_wm_type ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _type == 'net_wm_pid' ) : #NEWLINE# #INDENT# value = client . window . get_net_wm_pid ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = client . window . get_wm_window_role ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( value and match_func ( value ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return False