23 lines
489 B
Go
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")
|
|
}
|