mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-03 20:19:07 +02:00
Refactor UI --------- Co-authored-by: Eduard Gert <kontakt@eduardgert.de> Co-authored-by: braginini <bangvalo@gmail.com> Co-authored-by: Pascal Fischer <32096965+pascal-fischer@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: riccardom <riccardomanfrin@gmail.com>
32 lines
589 B
Go
32 lines
589 B
Go
//go:build !windows && !android && !ios && !freebsd && !js
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// listenForShowSignal lets external tools surface the running UI by signalling its pid (SIGUSR1).
|
|
func listenForShowSignal(ctx context.Context, tray *Tray) {
|
|
sigCh := make(chan os.Signal, 1)
|
|
signal.Notify(sigCh, syscall.SIGUSR1)
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-ctx.Done():
|
|
signal.Stop(sigCh)
|
|
return
|
|
case <-sigCh:
|
|
log.Debug("SIGUSR1 received, showing window")
|
|
tray.ShowWindow()
|
|
}
|
|
}
|
|
}()
|
|
}
|