summaryrefslogtreecommitdiff
path: root/internal/display/activate_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/display/activate_darwin.go')
-rw-r--r--internal/display/activate_darwin.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/display/activate_darwin.go b/internal/display/activate_darwin.go
new file mode 100644
index 0000000..54c6b94
--- /dev/null
+++ b/internal/display/activate_darwin.go
@@ -0,0 +1,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()
+ }()
+}