diff --git a/backend/build.bat b/backend/build.bat index 061f2cb..7c8fbd8 100644 --- a/backend/build.bat +++ b/backend/build.bat @@ -63,7 +63,7 @@ echo wsl --install -d Debian echo. echo In Debian danach die Build-Abhaengigkeiten installieren: echo sudo apt update -echo sudo apt install -y build-essential pkg-config libgtk-3-dev libayatana-appindicator3-dev +echo sudo apt install -y build-essential pkg-config echo. call :cleanup_cache exit /b 1 @@ -89,7 +89,7 @@ echo In WSL fehlen Build-Abhaengigkeiten fuer den Linux-Build. echo. echo In Debian installieren: echo sudo apt update -echo sudo apt install -y build-essential pkg-config libgtk-3-dev libayatana-appindicator3-dev +echo sudo apt install -y build-essential pkg-config echo. call :cleanup_cache exit /b 1 diff --git a/backend/nsfwapp-linux-amd64 b/backend/nsfwapp-linux-amd64 index 636f4b2..a82ff87 100644 Binary files a/backend/nsfwapp-linux-amd64 and b/backend/nsfwapp-linux-amd64 differ diff --git a/backend/nsfwapp.exe b/backend/nsfwapp.exe index e54f226..502583c 100644 Binary files a/backend/nsfwapp.exe and b/backend/nsfwapp.exe differ diff --git a/backend/server.go b/backend/server.go index c17f496..3bdc76d 100644 --- a/backend/server.go +++ b/backend/server.go @@ -1108,6 +1108,6 @@ func main() { } }() - runTray(shutdown, buildTrayStats) + runTray(appCtx, shutdown, buildTrayStats) shutdown() } diff --git a/backend/tray.go b/backend/tray.go index 207e556..a9dbd05 100644 --- a/backend/tray.go +++ b/backend/tray.go @@ -1,8 +1,11 @@ +//go:build windows + // backend\tray.go package main import ( + "context" _ "embed" "os/exec" "path/filepath" @@ -16,7 +19,7 @@ import ( //go:embed assets/img/tray.ico var trayIcon []byte -func runTray(onQuit func(), statsFn func() TrayStats) { +func runTray(ctx context.Context, onQuit func(), statsFn func() TrayStats) { systray.Run(func() { if len(trayIcon) > 0 { systray.SetIcon(trayIcon) @@ -98,6 +101,11 @@ func runTray(onQuit func(), statsFn func() TrayStats) { updateStatus() + go func() { + <-ctx.Done() + systray.Quit() + }() + go func() { ticker := time.NewTicker(2 * time.Second) defer ticker.Stop() diff --git a/backend/tray_other.go b/backend/tray_other.go new file mode 100644 index 0000000..10e8a01 --- /dev/null +++ b/backend/tray_other.go @@ -0,0 +1,11 @@ +//go:build !windows + +package main + +import "context" + +func runTray(ctx context.Context, onQuit func(), statsFn func() TrayStats) { + _ = onQuit + _ = statsFn + <-ctx.Done() +}