feat: desktop mode falls back to the TUI when no graphical display is available (issue #33)

This commit is contained in:
2026-07-16 17:46:36 +02:00
parent 5801e49dc1
commit 381deb417d
4 changed files with 71 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ defmodule BDS.Application do
{Task.Supervisor, name: BDS.Scripting.TaskSupervisor},
BDS.Scripting.JobSupervisor,
BDS.Embeddings.Index
] ++ embedding_children() ++ mode_children(BDS.Server.mode(), current_env())
] ++ embedding_children() ++ mode_children(boot_mode(), current_env())
opts = [strategy: :one_for_one, name: BDS.Supervisor]
Supervisor.start_link(children, opts)
@@ -77,6 +77,20 @@ defmodule BDS.Application do
Application.get_env(:bds, :current_env_override) || @compiled_env
end
# Desktop mode without a graphical display boots the TUI instead
# (issue #33); the log line explains the surprise mode switch.
defp boot_mode do
resolved = BDS.Server.mode()
effective = BDS.Server.effective_mode(resolved)
if effective != resolved do
require Logger
Logger.info("No graphical display available, starting the terminal UI instead")
end
effective
end
defp desktop_window_children do
if desktop_automation?() do
[]