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 <[email protected]>
This commit is contained in:
ekklesia
2026-09-20 21:19:41 -05:00
co-authored by Claude Opus 5
parent 52301084a5
commit a5c7d1d057
2 changed files with 23 additions and 1 deletions
+10 -1
View File
@@ -77,7 +77,7 @@ sys.path.insert(
) )
import classroom_parent_call as contract # noqa: E402 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 from classroom_mqtt import room_name # noqa: E402
APP_ID = "classroom-parent-call" APP_ID = "classroom-parent-call"
@@ -810,6 +810,15 @@ def main():
GLib.set_prgname(APP_ID) GLib.set_prgname(APP_ID)
GLib.set_application_name("Parent Call") 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 # --child fills the name in, and --send presses the button once the
# sanctuary has answered for whether it may be pressed. Only the lab # sanctuary has answered for whether it may be pressed. Only the lab
# uses them: there is no teacher-facing path to either, and neither # uses them: there is no teacher-facing path to either, and neither
+13
View File
@@ -211,6 +211,19 @@ else:
every and every["config"].get( every and every["config"].get(
"org.kde.plasma.icontasks.separateLaunchers") == "true") "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()
print(f"{passed} passed, {failed} failed") print(f"{passed} passed, {failed} failed")
raise SystemExit(1 if failed else 0) raise SystemExit(1 if failed else 0)