From a5c7d1d057ce2d58b01a181576d25ca24f4b7302 Mon Sep 17 00:00:00 2001 From: ekklesia Date: Sun, 20 Sep 2026 21:19:41 -0500 Subject: [PATCH] fix: an application a device does not offer does not start either Taking the launcher off the bar is half of a feature switch. The command has to refuse as well, or a device that does not offer an application can still be talked into running it by a stale desktop entry, a leftover window rule or a technician's muscle memory. Wonder Ink already did this. Parent Call now does the same, through the same helper and with the same default: absent means yes, so every existing room is unaffected. Co-Authored-By: Claude Opus 5 --- scripts/classroom-parent-call | 11 ++++++++++- tests/test-classroom-desktop-layout.sh | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/classroom-parent-call b/scripts/classroom-parent-call index 2ee4562..6e51516 100755 --- a/scripts/classroom-parent-call +++ b/scripts/classroom-parent-call @@ -77,7 +77,7 @@ sys.path.insert( ) import classroom_parent_call as contract # noqa: E402 -from classroom_config import read_device_config # noqa: E402 +from classroom_config import feature, read_device_config # noqa: E402 from classroom_mqtt import room_name # noqa: E402 APP_ID = "classroom-parent-call" @@ -810,6 +810,15 @@ def main(): GLib.set_prgname(APP_ID) GLib.set_application_name("Parent Call") + # A device that does not offer Parent Call does not offer it. The + # panel has no button, so nothing should reach here; saying it out + # loud is for the technician who ran the command by hand and wants to + # know why. Defaults to true, so every existing room is unaffected. + if not feature(read_device_config(), "PARENT_CALL_ENABLED"): + print("classroom-parent-call: PARENT_CALL_ENABLED is false on this " + "device; not starting", flush=True) + return 0 + # --child fills the name in, and --send presses the button once the # sanctuary has answered for whether it may be pressed. Only the lab # uses them: there is no teacher-facing path to either, and neither diff --git a/tests/test-classroom-desktop-layout.sh b/tests/test-classroom-desktop-layout.sh index c9c3599..c047d70 100755 --- a/tests/test-classroom-desktop-layout.sh +++ b/tests/test-classroom-desktop-layout.sh @@ -211,6 +211,19 @@ else: every and every["config"].get( "org.kde.plasma.icontasks.separateLaunchers") == "true") +print("7. a disabled application does not start either") +# Taking the launcher off the bar is half of it. The command itself has +# to refuse, so a device that does not offer an application cannot be +# talked into running it by a stale desktop entry or a technician's +# muscle memory. +for script, setting in (("classroom-wonderink", "WONDERINK_ENABLED"), + ("classroom-parent-call", "PARENT_CALL_ENABLED")): + text = (root / "scripts" / script).read_text() + check(f"{script} refuses when {setting} is false", + setting in text and "not starting" in text) + check(f"{script} defaults to starting, so existing rooms are unaffected", + 'default=True' in text or 'feature(' in text) + print() print(f"{passed} passed, {failed} failed") raise SystemExit(1 if failed else 0)