Files
rikkei_simple_care/client/internal/winapi/window_darwin.go
2026-07-01 09:49:27 +07:00

31 lines
824 B
Go

//go:build darwin
package winapi
import (
"fmt"
"os"
"os/exec"
)
// ActivateAppWindow — đưa cửa sổ app lên trước
func ActivateAppWindow(titleHint string) {
pid := os.Getpid()
script := fmt.Sprintf(`tell application "System Events" to set frontmost of first process whose unix id is %d to true`, pid)
cmd := exec.Command("osascript", "-e", script)
_ = cmd.Run()
}
// PlayNotifySound — beep hệ thống macOS
func PlayNotifySound() {
cmd := exec.Command("osascript", "-e", "beep")
_ = cmd.Run()
}
// ShowWarningMessageBox hiển thị hộp thoại cảnh báo macOS bất đồng bộ
func ShowWarningMessageBox(title, message string) {
script := fmt.Sprintf(`display alert %q message %q`, title, message)
cmd := exec.Command("osascript", "-e", script)
_ = cmd.Start() // Run asynchronously
}