From 008f31278dd44cc8a3c308f54e1fdb36009ab000 Mon Sep 17 00:00:00 2001 From: Zijia Xiong Date: Sun, 16 Jun 2024 19:01:26 +0100 Subject: [PATCH] Fix logic about receive signals --- main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 345534d..a001ae4 100644 --- a/main.go +++ b/main.go @@ -226,7 +226,7 @@ func main() { restoreStateAndHide() } } else { - log.Info("A signal received, and I'm not resident, bye bye") + log.Info("SIGUSR1 received, and I'm not resident, bye bye") gtk.MainQuit() } case syscall.SIGUSR2: // open drawer @@ -234,13 +234,14 @@ func main() { log.Debug("SIGUSR2 received, showing the window") showWindowChannel <- struct{}{} } else { - log.Info("A signal received, and I'm not resident, bye bye") - gtk.MainQuit() + log.Info("SIGUSR2 received, and I'm not resident but I'm still here, doing nothing") } case SIG25: // colse drawer - if *resident { - log.Debug("SIG25 received, hiding the window") - restoreStateAndHide() + if *resident { + log.Debug("SIG25 received, hiding the window") + if win.IsVisible() { + restoreStateAndHide() + } } else { log.Info("A signal received, and I'm not resident, bye bye") gtk.MainQuit()