From 71dbac54138fe5ff12046b680e60a751890e7dfc Mon Sep 17 00:00:00 2001 From: John Doe Date: Fri, 10 Jul 2026 14:21:06 -0700 Subject: [PATCH] feat: add shutdown functionality for Linux press daemon --- linux_press_daemon.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/linux_press_daemon.go b/linux_press_daemon.go index 4de6c20..e65af1f 100644 --- a/linux_press_daemon.go +++ b/linux_press_daemon.go @@ -10,6 +10,7 @@ package main import ( + "context" "net/http" "os" "sync" @@ -234,3 +235,13 @@ func (a *App) resetFailedLinuxPressCycle(cycle uint64) { pressState.holdMode = false pressState.detectingHold = false } + +func stopLinuxPressDaemon() { + if linuxPressServer != nil { + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + if err := linuxPressServer.Shutdown(ctx); err != nil { + logger.Error("Error shutting down Linux press daemon: %v", err) + } + } +}