Skip to content

Commit 97ecbf1

Browse files
committed
Fix LKP profile matching sometimes selecting irrelevant profiles
1 parent a6e1754 commit 97ecbf1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ def find_matching_profile(window: Window) -> Optional[dict]:
147147
exe = apply_to.get('executable', '') or None
148148
if not name and not exe:
149149
continue
150-
score = (
151-
match(name, window.name)
152-
+ match(exe, window.executable)
153-
)
154-
matches.append((score, profile))
150+
score = 0
151+
if name:
152+
score += match(name, window.name)
153+
if exe:
154+
score += match(exe, window.executable)
155+
if score:
156+
matches.append((score, profile))
155157
if not matches:
156158
return None
157159
return sorted(matches, key=lambda x: x[0])[0][1]

0 commit comments

Comments
 (0)