Change usage of SIGINT to SIGRTMIN+3
This commit is contained in:
13
main.go
13
main.go
@@ -203,8 +203,10 @@ func main() {
|
|||||||
// v0.2: we also need to support SIGUSR from now on
|
// v0.2: we also need to support SIGUSR from now on
|
||||||
showWindowChannel := make(chan interface{}, 1)
|
showWindowChannel := make(chan interface{}, 1)
|
||||||
signalChan := make(chan os.Signal, 1)
|
signalChan := make(chan os.Signal, 1)
|
||||||
signal.Notify(signalChan, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGINT)
|
const (
|
||||||
|
SIG25 = syscall.Signal(0x25) // Which is SIGRTMIN+3 on Linux, it's not used by the system
|
||||||
|
)
|
||||||
|
signal.Notify(signalChan, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGUSR2, SIG25)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
s := <-signalChan
|
s := <-signalChan
|
||||||
@@ -212,7 +214,6 @@ func main() {
|
|||||||
case syscall.SIGTERM:
|
case syscall.SIGTERM:
|
||||||
log.Info("SIGTERM received, bye bye")
|
log.Info("SIGTERM received, bye bye")
|
||||||
gtk.MainQuit()
|
gtk.MainQuit()
|
||||||
break
|
|
||||||
case syscall.SIGUSR1: // toggle drawer
|
case syscall.SIGUSR1: // toggle drawer
|
||||||
if *resident {
|
if *resident {
|
||||||
// As win.Show() called from inside a goroutine randomly crashes GTK,
|
// As win.Show() called from inside a goroutine randomly crashes GTK,
|
||||||
@@ -236,9 +237,9 @@ func main() {
|
|||||||
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()
|
||||||
}
|
}
|
||||||
case syscall.SIGINT: // colse drawer
|
case SIG25: // colse drawer
|
||||||
if *resident {
|
if *resident {
|
||||||
log.Debug("SIGINT received, hiding the window")
|
log.Debug("SIG25 received, hiding the window")
|
||||||
restoreStateAndHide()
|
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")
|
||||||
@@ -268,7 +269,7 @@ func main() {
|
|||||||
var err error
|
var err error
|
||||||
if *flagDrawerClose {
|
if *flagDrawerClose {
|
||||||
log.Infof("Closing resident instance (PID %v)", i)
|
log.Infof("Closing resident instance (PID %v)", i)
|
||||||
err = syscall.Kill(i, syscall.SIGINT)
|
err = syscall.Kill(i, SIG25)
|
||||||
} else if *flagDrawerOpen {
|
} else if *flagDrawerOpen {
|
||||||
log.Infof("Showing resident instance (PID %v)", i)
|
log.Infof("Showing resident instance (PID %v)", i)
|
||||||
err = syscall.Kill(i, syscall.SIGUSR2)
|
err = syscall.Kill(i, syscall.SIGUSR2)
|
||||||
|
|||||||
Reference in New Issue
Block a user