From 8ce60662f2452bcb85b47b76f5a9aef0382a1f45 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 14 May 2023 16:33:25 +0200 Subject: [PATCH] Refresh when the terminal window gets the focus --- pkg/gui/gui.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index f1e20da41..ad3dc3e34 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -288,6 +288,15 @@ func (gui *Gui) onNewRepo(startArgs appTypes.StartArgs, contextKey types.Context return err } + gui.g.SetFocusHandler(func(Focused bool) error { + if Focused { + gui.c.Log.Info("Receiving focus - refreshing") + return gui.helpers.Refresh.Refresh(types.RefreshOptions{Mode: types.ASYNC}) + } + + return nil + }) + // if a context key has been given, push that instead, and set its index to 0 if contextKey != context.NO_CONTEXT { contextToPush = gui.c.ContextForKey(contextKey)