Fix logic about receive signals

This commit is contained in:
Zijia Xiong
2024-06-16 19:01:26 +01:00
parent 99765402d7
commit 008f31278d

13
main.go
View File

@@ -226,7 +226,7 @@ func main() {
restoreStateAndHide() restoreStateAndHide()
} }
} else { } 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() gtk.MainQuit()
} }
case syscall.SIGUSR2: // open drawer case syscall.SIGUSR2: // open drawer
@@ -234,13 +234,14 @@ func main() {
log.Debug("SIGUSR2 received, showing the window") log.Debug("SIGUSR2 received, showing the window")
showWindowChannel <- struct{}{} showWindowChannel <- struct{}{}
} else { } else {
log.Info("A signal received, and I'm not resident, bye bye") log.Info("SIGUSR2 received, and I'm not resident but I'm still here, doing nothing")
gtk.MainQuit()
} }
case SIG25: // colse drawer case SIG25: // colse drawer
if *resident { if *resident {
log.Debug("SIG25 received, hiding the window") log.Debug("SIG25 received, hiding the window")
restoreStateAndHide() if win.IsVisible() {
restoreStateAndHide()
}
} else { } else {
log.Info("A signal received, and I'm not resident, bye bye") log.Info("A signal received, and I'm not resident, bye bye")
gtk.MainQuit() gtk.MainQuit()