Skip to content

Commit

Permalink
fix: gather closeness score for all outputs
Browse files Browse the repository at this point in the history
defined in a given profile.
  • Loading branch information
tomeon committed Apr 19, 2024
1 parent 93bf26a commit c7e1c05
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions autorandr.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def find_profiles(current_config, profiles):

missing_output_names = []
fingerprint_mismatch = []
closeness_scores = []
profile_output_names = config.keys()

for name in profile_output_names:
Expand All @@ -777,6 +778,11 @@ def find_profiles(current_config, profiles):
elif not output.fingerprint_equals(current_config[name]):
fingerprint_mismatch.append(name)

closeness = max(match_asterisk(output.edid, current_config[name].edid), match_asterisk(
current_config[name].edid, output.edid))

closeness_scores.append(closeness)

if len(fingerprint_mismatch) > 0:
continue
elif len(missing_output_names) > 0:
Expand All @@ -788,8 +794,9 @@ def find_profiles(current_config, profiles):
percent_present_in_profile = len(possible_output_names) / len(current_output_names)
percent_present_in_current_config = len(profile_output_names) / len(possible_output_names)

closeness = max(match_asterisk(output.edid, current_config[name].edid), match_asterisk(
current_config[name].edid, output.edid))
closeness = 1
for closeness_score in closeness_scores:
closeness *= closeness_score

score = percent_present_in_profile * percent_present_in_current_config * closeness

Expand Down

0 comments on commit c7e1c05

Please sign in to comment.