From 512a2b4a2821a1edadf5530d060e3ae5468d75e8 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 12 Nov 2026 09:01:06 +0100 Subject: fix(tablet): restore the backlight after a restart or shutdown The server never ran the modules' stop: `deck-it stop` ends it with SIGTERM and nothing called stop_all, so a shutdown left the tablet dim. A SIGTERM handler now runs stop_all before exiting. The settings from before a dim lived only in memory, so a new server's undim had nothing to put back. They are now kept in ~/.cache/deck-it/dim, and a freshly loaded page asks for undim, since it is never dimmed itself. Co-Authored-By: Claude Opus 5.5 --- deckit/server.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'deckit/server.py') diff --git a/deckit/server.py b/deckit/server.py index f222ecb..875a19d 100644 --- a/deckit/server.py +++ b/deckit/server.py @@ -27,6 +27,7 @@ import mimetypes import os import re import secrets +import signal import socketserver import subprocess import threading @@ -300,6 +301,9 @@ def serve(): TOKEN = load_token() REGISTRY = build(CFG) REGISTRY.start_all() + # `deck-it stop` ends the server with SIGTERM; let the modules clean up + # (the tablet's backlight) before it goes. + signal.signal(signal.SIGTERM, lambda *_: (REGISTRY.stop_all(), os._exit(0))) threading.Thread(target=sleep.watch, daemon=True).start() RUNDIR.mkdir(mode=0o700, parents=True, exist_ok=True) RUNDIR.chmod(0o700) -- cgit v1.2.3