From 5ef32566db06e2e837eda0e1c805557ddd67b9ad Mon Sep 17 00:00:00 2001 From: mixeme Date: Mon, 15 Jun 2026 20:40:53 +0300 Subject: [PATCH] Show startup timing in History Measure GUI startup from the beginning of Run until the main view has loaded its store and is ready to build the History model. Insert the measurement as the first in-memory History event using the existing RunRecord display path: Application / Started / Startup completed in . This keeps startup diagnostics visible in the UI without creating a separate application log file. No scheduler, storage, or command log behavior is changed. --- src/gui/app.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/app.go b/src/gui/app.go index 4baea6a..bfa8969 100644 --- a/src/gui/app.go +++ b/src/gui/app.go @@ -31,6 +31,7 @@ type job = core.Job type event = core.RunRecord func Run() { + started := time.Now() // A stable app ID lets Fyne persist desktop preferences consistently across // launches and gives tray/window integration a predictable identity. a := app.NewWithID(appID) @@ -39,7 +40,7 @@ func Run() { w := a.NewWindow("PySentry " + core.Version) configureSystemTray(a, w) w.Resize(fyne.NewSize(1120, 720)) - w.SetContent(newMainView(w)) + w.SetContent(newMainView(w, started)) w.ShowAndRun() } @@ -74,12 +75,13 @@ func configureSystemTray(a fyne.App, w fyne.Window) { }) } -func newMainView(w fyne.Window) fyne.CanvasObject { +func newMainView(w fyne.Window, started time.Time) fyne.CanvasObject { store, jobs, err := core.OpenStore() if err != nil { return container.NewPadded(widget.NewLabel("Failed to load PySentry configuration: " + err.Error())) } - events := collectActivity(jobs) + startupDuration := time.Since(started).Round(time.Millisecond) + events := append([]event{newEvent(0, "Application", "Started", "Startup completed in "+startupDuration.String())}, collectActivity(jobs)...) // The GUI keeps the loaded jobs slice in memory and persists changes after // each edit/run. This keeps the first version responsive and easy to reason