close resident on SIGUSR1 if visible #31

This commit is contained in:
piotr
2021-09-30 12:33:39 +02:00
parent 1c7a481108
commit 8daf645e3b
2 changed files with 7 additions and 2 deletions

Binary file not shown.

View File

@@ -162,8 +162,13 @@ func main() {
if *resident {
// As win.Show() called from inside a goroutine randomly crashes GTK,
// let's just set e helper variable here. We'll be checking it with glib.TimeoutAdd.
log.Debug("SIGUSR1 received, showing the window")
showWindowTrigger = true
if !win.IsVisible() {
log.Debug("SIGUSR1 received, showing the window")
showWindowTrigger = true
} else {
log.Debug("SIGUSR1 received, hiding the window")
restoreStateAndHide()
}
} else {
log.Info("SIGUSR1 received, and I'm not resident, bye bye")
gtk.MainQuit()