@@ -42,6 +42,7 @@ import (
4242 "github.com/docker/docker-agent/pkg/tui/service/tuistate"
4343 "github.com/docker/docker-agent/pkg/tui/styles"
4444 "github.com/docker/docker-agent/pkg/userconfig"
45+ "github.com/docker/docker-agent/pkg/version"
4546)
4647
4748// SessionSpawner creates new sessions with their own runtime.
@@ -163,6 +164,9 @@ type appModel struct {
163164
164165 // buildCommandCategories is a function that returns the list of command categories.
165166 buildCommandCategories func (context.Context , tea.Model ) []commands.Category
167+
168+ appName string
169+ appVersion string
166170}
167171
168172// Option configures the TUI.
@@ -176,6 +180,24 @@ func WithLeanMode() Option {
176180 }
177181}
178182
183+ // WithAppName sets the application name.
184+ //
185+ // If not provided, defaults to "docker agent".
186+ func WithAppName (name string ) Option {
187+ return func (m * appModel ) {
188+ m .appName = name
189+ }
190+ }
191+
192+ // WithVersion sets the application version.
193+ //
194+ // If not provided, defaults to version.Version.
195+ func WithVersion (v string ) Option {
196+ return func (m * appModel ) {
197+ m .appVersion = v
198+ }
199+ }
200+
179201// WithCommandBuilder builds the command categories shown in the command
180202// palette from the given function. It overrides the default command category
181203// builder. To include the default commands, the given function should call
@@ -242,6 +264,8 @@ func New(ctx context.Context, spawner SessionSpawner, initialApp *app.App, initi
242264 focusedPanel : PanelEditor ,
243265 editorLines : 3 ,
244266 dockerDesktop : os .Getenv ("TERM_PROGRAM" ) == "docker_desktop" ,
267+ appName : "docker agent" ,
268+ appVersion : version .Version ,
245269 }
246270
247271 // Apply options
@@ -260,7 +284,7 @@ func New(ctx context.Context, spawner SessionSpawner, initialApp *app.App, initi
260284 m .chatPage = initialChatPage
261285
262286 // Initialize status bar (pass m as help provider)
263- m .statusBar = statusbar .New (m )
287+ m .statusBar = statusbar .New (m , statusbar . WithTitle ( m . appName + " " + m . appVersion ) )
264288
265289 // Add the initial session to the supervisor
266290 sv .AddSession (ctx , initialApp , initialApp .Session (), initialWorkingDir , cleanup )
@@ -2320,9 +2344,9 @@ func (m *appModel) View() tea.View {
23202344// When the agent is working, a rotating spinner character is prepended so that
23212345// terminal multiplexers (tmux) can detect activity in the pane.
23222346func (m * appModel ) windowTitle () string {
2323- title := "docker agent"
2347+ title := m . appName
23242348 if sessionTitle := m .sessionState .SessionTitle (); sessionTitle != "" {
2325- title = sessionTitle + " - docker agent"
2349+ title = sessionTitle + " - " + m . appName
23262350 }
23272351 if m .chatPage .IsWorking () {
23282352 title = spinner .Frame (m .animFrame ) + " " + title
0 commit comments