From f37e295166f88ac6dbf1305363363db4b2d152c5 Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Tue, 2 Jun 2026 12:34:14 -0400 Subject: [PATCH] Add Windows window-minimize guard --- internal/enforce/guard_other.go | 2 +- internal/enforce/windows.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 internal/enforce/windows.go diff --git a/internal/enforce/guard_other.go b/internal/enforce/guard_other.go index d009114..7405110 100644 --- a/internal/enforce/guard_other.go +++ b/internal/enforce/guard_other.go @@ -1,4 +1,4 @@ -//go:build !linux +//go:build !linux && !windows package enforce diff --git a/internal/enforce/windows.go b/internal/enforce/windows.go new file mode 100644 index 0000000..5dc4444 --- /dev/null +++ b/internal/enforce/windows.go @@ -0,0 +1,21 @@ +//go:build windows + +package enforce + +import ( + "context" + + "antidrift/internal/winapi" +) + +// NewGuard returns the Windows window-minimize guard. +func NewGuard() Guard { return windowsGuard{} } + +type windowsGuard struct{} + +// MinimizeActive minimizes the current foreground window. It is best-effort: +// with nothing focused it does nothing and returns nil. Stateless and per-call, +// mirroring the short-lived X11 connection model. +func (windowsGuard) MinimizeActive(context.Context) error { + return winapi.MinimizeForeground() +}