Avoid shadowing Python typing and retain pending mixed input selections
This commit is contained in:
1 parent
639cf3ee5e
commit
f28a652347
8 files changed
+41
-14
No files matched your search
@@ -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):
|
||||
|
||||
@@ -57,7 +57,7 @@ def choose(title, catalog, selected, kind, overrides=None):
|
||||
catalog = {**catalog, **{key: catalog.get(key, key) for key in selected}}
|
||||
rows = picker_rows(catalog, selected)
|
||||
args = ["omarchy-menu-select", title] + list(rows.values())
|
||||
on_change = ["python", str(setup.ROOT / "default/input-methods/typing.py"), "apply", kind, json.dumps({"catalog": catalog, "overrides": overrides or {}})]
|
||||
on_change = ["python", str(setup.ROOT / "default/input-methods/typing_setup.py"), "apply", kind, json.dumps({"catalog": catalog, "overrides": overrides or {}})]
|
||||
args += ["--", "--multiple", "--width", "620", "--maxheight", "650", "--on-change", json.dumps(on_change), "--change-key", "typing:" + kind]
|
||||
for key in selected:
|
||||
args += ["--selected", rows[key][1:]]
|
||||
Reference in new issue
Block a user