ide/gui_enabled.go
Virgil 9f97d256cf
Some checks failed
Security Scan / security (push) Successful in 10s
Test / test (push) Has been cancelled
feat(ide): add workspace context tools
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-31 18:52:45 +00:00

26 lines
631 B
Go

package main
import (
"os"
"runtime"
"forge.lthn.ai/core/config"
)
// guiEnabled checks whether the GUI should start.
// Returns false if config says gui.enabled: false, or if no display is available.
func guiEnabled(cfg *config.Config) bool {
if cfg != nil {
var guiCfg struct {
Enabled *bool `mapstructure:"enabled"`
}
if err := cfg.Get("gui", &guiCfg); err == nil && guiCfg.Enabled != nil {
return *guiCfg.Enabled
}
}
// Fall back to display detection.
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
return true
}
return os.Getenv("DISPLAY") != "" || os.Getenv("WAYLAND_DISPLAY") != ""
}