Skip to content

Commit

Permalink
Fix LKP profile matching sometimes selecting irrelevant profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Crozzers committed Jun 9, 2024
1 parent a6e1754 commit 97ecbf1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ def find_matching_profile(window: Window) -> Optional[dict]:
exe = apply_to.get('executable', '') or None
if not name and not exe:
continue
score = (
match(name, window.name)
+ match(exe, window.executable)
)
matches.append((score, profile))
score = 0
if name:
score += match(name, window.name)
if exe:
score += match(exe, window.executable)
if score:
matches.append((score, profile))
if not matches:
return None
return sorted(matches, key=lambda x: x[0])[0][1]
Expand Down

0 comments on commit 97ecbf1

Please sign in to comment.