Skip to content

Commit 3652660

Browse files
committed
fix: simplify set comparison + minor corrections
1 parent 4d3e6d7 commit 3652660

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wlr_layout_ui/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def main():
5454
elif sys.argv[1] == "-m":
5555
load()
5656
current_uids = set(di.uid for di in displayInfo)
57-
for key in sorted(profiles.keys()):
57+
for key in sorted(profiles):
5858
prof_uids = {p["uid"] for p in profiles[key]}
5959
# check that the two sets have the same elements
60-
if len(prof_uids & current_uids) == len(current_uids):
60+
if prof_uids == current_uids:
6161
print(f"Matched profile {key}. Applying it...")
6262
apply_profile(profiles[key])
6363
sys.exit(0)
@@ -70,7 +70,7 @@ def main():
7070
"""With no options, launches the GUI
7171
Options:
7272
-l : list profiles
73-
-m : find a profile that matches the current displays layout, and apply it.
73+
-m : find a profile that matches the currently plugged display set, and apply it.
7474
No-op if not found; will apply first in alphabetical order if multiple found.
7575
<profile name> : loads a profile
7676
"""
@@ -83,7 +83,7 @@ def main():
8383
print(f"No such profile: {sys.argv[1]}")
8484
raise SystemExit(1)
8585
apply_profile(profile)
86-
sys.exit(0)
86+
return
8787
load()
8888
max_width = int(sum(max(screen.available, key=lambda mode: mode.width).width for screen in displayInfo) // UI_RATIO)
8989
max_height = int(sum(max(screen.available, key=lambda mode: mode.height).height for screen in displayInfo) // UI_RATIO)

0 commit comments

Comments
 (0)