summaryrefslogtreecommitdiff
path: root/internal/display/activate_darwin.go
blob: 54c6b94d8e80e81c569fefafd275aa4f803edef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// +build darwin

package display

import (
	"os"
	"os/exec"
	"time"
)

// activateWindow brings the SDL window to the foreground on macOS
func activateWindow() {
	// Give SDL a moment to create the window
	go func() {
		time.Sleep(500 * time.Millisecond)
		// Get the executable path
		execPath, err := os.Executable()
		if err != nil {
			return
		}
		// Use open -a to bring the window to foreground
		exec.Command("open", "-a", execPath).Run()
	}()
}