1
0
Fork 0
tetris-go/engine/system/hypr.go
2025-09-14 22:16:29 +02:00

23 lines
489 B
Go

package system
import (
"os"
"path/filepath"
"strings"
)
func IsHyprland() bool {
// Primary signals
xdg := os.Getenv("XDG_RUNTIME_DIR")
his := os.Getenv("HYPRLAND_INSTANCE_SIGNATURE")
if xdg != "" && his != "" {
sock := filepath.Join(xdg, "hypr", his, ".socket.sock")
if st, err := os.Stat(sock); err == nil && !st.IsDir() {
return true
}
}
// Fallback: desktop hint
hint := strings.ToLower(os.Getenv("XDG_CURRENT_DESKTOP"))
return strings.Contains(hint, "hypr")
}