Avoid shadowing Python typing and retain pending mixed input selections

This commit is contained in:
David Heinemeier Hansson committed 2026-10-09 17:00:14 +02:00
1 parent 639cf3ee5e
commit f28a652347
8 files changed
+41 -14

No files matched your search

+8 -5
View File
@@ -114,12 +114,15 @@ class Indicator:
def select_next(self):
state = snapshot(self.bus)
methods = state["methods"]
if len(methods) < 2:
state["current"] = self.pending or state["current"] or self.last or next(iter(methods), "")
devices = subprocess.run(["hyprctl", "-j", "devices"], check=True, text=True, capture_output=True)
keyboards = json.loads(devices.stdout).get("keyboards", [])
following, index = cycle_choice(state, keyboards)
if following is None:
return
current = self.pending or state["current"] or self.last or methods[0]
if current not in methods:
current = methods[0]
self.pending = methods[(methods.index(current) + 1) % len(methods)]
self.pending = following
for command in layout_switches(keyboards, index) if index is not None else []:
subprocess.run(command, check=True, capture_output=True)
self.refresh()
def refresh(self):