diff --git a/backend/ambilight-ctl b/backend/ambilight-ctl index cbab1af..c08576d 100755 --- a/backend/ambilight-ctl +++ b/backend/ambilight-ctl @@ -66,15 +66,19 @@ def main(argv): key, raw = argv[2], argv[3] if key in ("reverse",): value = raw.lower() in ("1", "true", "yes", "on") - elif key == "leds": + vtype = "b" + elif key in ("leds", "baud"): value = int(raw) + vtype = "i" + elif key in ("port", "side", "capture", "drm_device"): + value = str(raw) + vtype = "s" else: value = float(raw) + vtype = "d" try: from gi.repository import GLib - res = call("SetParam", GLib.Variant("(sv)", (key, GLib.Variant( - "b" if isinstance(value, bool) else "d" if isinstance(value, float) else "i", - value)))) + res = call("SetParam", GLib.Variant("(sv)", (key, GLib.Variant(vtype, value)))) err = res.unpack()[0] if err: print(json.dumps({"ok": False, "error": err}))