Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

tui: fix signin on headless Linux systems (#14627)

Bruce MacDonald727d69ddf39e
diff --git a/cmd/launch/models.go b/cmd/launch/models.go
index 33f82d821..a01f847d1 100644
--- a/cmd/launch/models.go
+++ b/cmd/launch/models.go
@@ -92,6 +92,10 @@ func OpenBrowser(url string) {
case "darwin":
_ = exec.Command("open", url).Start()
case "linux":
+ // Skip on headless systems where no display server is available
+ if os.Getenv("DISPLAY") == "" && os.Getenv("WAYLAND_DISPLAY") == "" {
+ return
+ }
_ = exec.Command("xdg-open", url).Start()
case "windows":
_ = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
diff --git a/cmd/tui/signin.go b/cmd/tui/signin.go
index 3667499b2..4cfea1e00 100644
--- a/cmd/tui/signin.go
+++ b/cmd/tui/signin.go
@@ -97,11 +97,8 @@ func renderSignIn(modelName, signInURL string, spinner, width int) string {
fmt.Fprintf(&s, "To use %s, please sign in.\n\n", selectorSelectedItemStyle.Render(modelName))
- // Wrap in OSC 8 hyperlink so the entire URL is clickable even when wrapped.
- // Padding is outside the hyperlink so spaces don't get underlined.
- link := fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", signInURL, urlColor.Render(signInURL))
s.WriteString("Navigate to:\n")
- s.WriteString(urlWrap.Render(link))
+ s.WriteString(urlWrap.Render(urlColor.Render(signInURL)))
s.WriteString("\n\n")
s.WriteString(lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "242", Dark: "246"}).Render(
diff --git a/cmd/tui/signin_test.go b/cmd/tui/signin_test.go
index 0af9ddc6e..b25771831 100644
--- a/cmd/tui/signin_test.go
+++ b/cmd/tui/signin_test.go
@@ -25,22 +25,6 @@ func TestRenderSignIn_ContainsURL(t *testing.T) {
}
}
-func TestRenderSignIn_OSC8Hyperlink(t *testing.T) {
- url := "https://ollama.com/connect?key=abc123"
- got := renderSignIn("test:cloud", url, 0, 120)
-
- // Should contain OSC 8 open sequence with the URL
- osc8Open := "\033]8;;" + url + "\033\\"
- if !strings.Contains(got, osc8Open) {
- t.Error("should contain OSC 8 open sequence with URL")
- }
-
- // Should contain OSC 8 close sequence
- osc8Close := "\033]8;;\033\\"
- if !strings.Contains(got, osc8Close) {
- t.Error("should contain OSC 8 close sequence")
- }
-}
func TestRenderSignIn_ContainsSpinner(t *testing.T) {
got := renderSignIn("test:cloud", "https://example.com", 0, 80)