@@ -352,6 +352,9 @@ def edid_equals(self, other):
352352 return hashlib .md5 (binascii .unhexlify (self .edid )).hexdigest () == other .edid
353353 return self .edid == other .edid
354354
355+ def __ne__ (self , other ):
356+ return not (self == other )
357+
355358 def __eq__ (self , other ):
356359 return self .edid_equals (other ) and self .output == other .output and self .filtered_options == other .filtered_options
357360
@@ -561,6 +564,13 @@ def apply_configuration(new_configuration, current_configuration, dry_run=False)
561564 if subprocess .call (argv ) != 0 :
562565 raise AutorandrException ("Command failed: %s" % " " .join (argv ))
563566
567+ def is_equal_configuration (source_configuration , target_configuration ):
568+ "Check if all outputs from target are already configured correctly in source"
569+ for output in target_configuration .keys ():
570+ if (output not in source_configuration ) or (source_configuration [output ] != target_configuration [output ]):
571+ return False
572+ return True
573+
564574def add_unused_outputs (source_configuration , target_configuration ):
565575 "Add outputs that are missing in target to target, in 'off' state"
566576 for output_name , output in source_configuration .items ():
@@ -696,12 +706,14 @@ def main(argv):
696706 if profile_blocked (os .path .join (profile_path , profile_name )):
697707 print ("%s (blocked)" % profile_name , file = sys .stderr )
698708 continue
709+ props = []
699710 if profile_name in detected_profiles :
700- print ( "%s (detected)" % profile_name , file = sys . stderr )
711+ props . append ( " (detected)" )
701712 if ("-c" in options or "--change" in options ) and not load_profile :
702713 load_profile = profile_name
703- else :
704- print (profile_name , file = sys .stderr )
714+ if is_equal_configuration (config , profiles [profile_name ]["config" ]):
715+ props .append ("(current)" )
716+ print ("%s%s%s" % (profile_name , " " if props else "" , " " .join (props )), file = sys .stderr )
705717
706718 if "-d" in options :
707719 options ["--default" ] = options ["-d" ]
0 commit comments