mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 03:00:18 +02:00
Devices: fixes from review round 17
- A command that fails after a switch doesn't make the connector drop the new headset's connection. - On first import, the app keeps using the `frame` headset even when Set Up Connection put another block above it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fa05a4b310
commit
90fd2684ba
5 files changed
+35
-3
No files matched your search
@@ -672,6 +672,7 @@ class Registry:
|
||||
blocks = parse_blocks(read_config(self.config))
|
||||
changed = False
|
||||
with self.lock:
|
||||
first = not self.data["devices"] and not self.data.get("active")
|
||||
for b in blocks:
|
||||
host = b["hostname"] if b["hostname"] and HOST_RE.fullmatch(b["hostname"]) else None
|
||||
user = b["user"] if b["user"] and NAME_RE.fullmatch(b["user"]) else DEFAULT_USER
|
||||
@@ -714,6 +715,13 @@ class Registry:
|
||||
aliases = {b["alias"] for b in blocks}
|
||||
for d in self.data["devices"]:
|
||||
d["managed"] = d["alias"] in aliases
|
||||
if first:
|
||||
# First import: the headset the app used before is `frame`, even if Set Up
|
||||
# Connection put another block above it.
|
||||
frame = next((d for d in self.data["devices"] if d["alias"] == "frame"), None)
|
||||
if frame and self.data.get("active") != frame["id"]:
|
||||
self.data["active"] = frame["id"]
|
||||
changed = True
|
||||
if changed:
|
||||
self.save()
|
||||
return changed
|
||||
Reference in new issue
Block a user