@@ -75,12 +75,6 @@ func (d *Daemon) newCosmoWindow() *unifiedWindow {
7575 }
7676 uw .refreshBanner ()
7777 })
78- win .SetOnClosed (func () {
79- unsubscribe ()
80- if d .activeUnifiedWindow () == uw {
81- d .setActiveUnifiedWindow (nil )
82- }
83- })
8478
8579 // Background fetch of all user repos.
8680 go func () {
@@ -96,12 +90,31 @@ func (d *Daemon) newCosmoWindow() *unifiedWindow {
9690 })
9791 }()
9892
99- sidebar := uw .buildCosmoSidebar ()
93+ rebuild := func () {
94+ sidebar := uw .buildCosmoSidebar ()
95+ split := container .NewHSplit (sidebar , uw .content )
96+ split .Offset = 0.32
97+ win .SetContent (container .NewBorder (uw .banner , nil , nil , nil , split ))
98+ }
99+ rebuild ()
100100 uw .showCosmoWelcome ()
101101
102- split := container .NewHSplit (sidebar , uw .content )
103- split .Offset = 0.32
104- win .SetContent (container .NewBorder (uw .banner , nil , nil , nil , split ))
102+ // Tree selection and branch expansion are reset on theme change.
103+ unsubscribeTheme := d .addThemeListener (func () {
104+ rebuild ()
105+ uw .refreshBanner ()
106+ if uw .currentView != nil {
107+ uw .currentView ()
108+ }
109+ })
110+
111+ win .SetOnClosed (func () {
112+ unsubscribe ()
113+ unsubscribeTheme ()
114+ if d .activeUnifiedWindow () == uw {
115+ d .setActiveUnifiedWindow (nil )
116+ }
117+ })
105118 return uw
106119}
107120
@@ -125,10 +138,10 @@ func (uw *unifiedWindow) refreshBanner() {
125138// failing check. A tinted background and bold severity badge make the
126139// banner hard to miss, so users notice cosmonaut needs their attention.
127140func (uw * unifiedWindow ) buildIssueBanner (c doctor.Check , issue * doctor.Issue ) fyne.CanvasObject {
128- accent := cOrange
141+ accent := statusWarn
129142 badgeText := "WARNING"
130143 if issue .Severity == doctor .SeverityError {
131- accent = cRed
144+ accent = statusError
132145 badgeText = "ERROR"
133146 }
134147
@@ -141,7 +154,7 @@ func (uw *unifiedWindow) buildIssueBanner(c doctor.Check, issue *doctor.Issue) f
141154 badge .TextSize = 10
142155 badge .TextStyle = fyne.TextStyle {Monospace : true , Bold : true }
143156
144- title := canvas .NewText (c .Title , cText )
157+ title := canvas .NewText (c .Title , theme . Color ( theme . ColorNameForeground ) )
145158 title .TextSize = 13
146159 title .TextStyle = fyne.TextStyle {Bold : true }
147160
@@ -199,7 +212,7 @@ func (uw *unifiedWindow) buildCosmoSidebar() fyne.CanvasObject {
199212 mark .SetMinSize (fyne .NewSize (22 , 22 ))
200213 mark .FillMode = canvas .ImageFillContain
201214
202- title := canvas .NewText ("Cosmonaut" , cText )
215+ title := canvas .NewText ("Cosmonaut" , theme . Color ( theme . ColorNameForeground ) )
203216 title .TextStyle = fyne.TextStyle {Bold : true }
204217 title .TextSize = 13
205218
@@ -326,11 +339,11 @@ func (uw *unifiedWindow) buildAccountFooter() fyne.CanvasObject {
326339 return "Stopped"
327340 }())
328341
329- handle := canvas .NewText (ghUser , cText )
342+ handle := canvas .NewText (ghUser , theme . Color ( theme . ColorNameForeground ) )
330343 handle .TextSize = 12
331344 handle .TextStyle = fyne.TextStyle {Bold : true }
332345
333- sub := canvas .NewText ("github.com" , cTextMute )
346+ sub := canvas .NewText ("github.com" , theme . Color ( theme . ColorNamePlaceHolder ) )
334347 sub .TextSize = 10
335348 sub .TextStyle = fyne.TextStyle {Monospace : true }
336349
@@ -347,7 +360,7 @@ func (uw *unifiedWindow) buildAccountFooter() fyne.CanvasObject {
347360
348361// thinDivider returns a 1px canvas line using the theme border color.
349362func thinDivider () fyne.CanvasObject {
350- r := canvas .NewRectangle (cBorder )
363+ r := canvas .NewRectangle (theme . Color ( theme . ColorNameSeparator ) )
351364 r .SetMinSize (fyne .NewSize (1 , 1 ))
352365 return r
353366}
@@ -362,6 +375,7 @@ func markIconResource() fyne.Resource {
362375// ── CODESPACE DETAIL ────────────────────────────────────────────────────
363376
364377func (uw * unifiedWindow ) showCosmoCodespaceDetail (csName , repo string ) {
378+ uw .currentView = func () { uw .showCosmoCodespaceDetail (csName , repo ) }
365379 var cs * codespace.Codespace
366380 for _ , c := range uw .daemon .Codespaces () {
367381 if c .Name == csName {
@@ -386,7 +400,7 @@ func (uw *unifiedWindow) showCosmoCodespaceDetail(csName, repo string) {
386400 if titleText == "" {
387401 titleText = cs .Name
388402 }
389- heroTitle := canvas .NewText (titleText , cText )
403+ heroTitle := canvas .NewText (titleText , theme . Color ( theme . ColorNameForeground ) )
390404 heroTitle .TextSize = 16
391405 heroTitle .TextStyle = fyne.TextStyle {Bold : true }
392406
@@ -590,28 +604,29 @@ func (uw *unifiedWindow) portRow(csName, repo string, port codespace.Port) fyne.
590604func stateColor (state string ) color.Color {
591605 switch state {
592606 case "Available" , "Started" , "ready" , "running" , "connected" :
593- return cLime
607+ return statusOK
594608 case "Starting" , "starting" , "pending" :
595- return cOrange
609+ return statusWarn
596610 case "Error" :
597- return cRed
611+ return statusError
598612 }
599- return cTextMute
613+ return theme . Color ( theme . ColorNamePlaceHolder )
600614}
601615
602616// ── WELCOME ─────────────────────────────────────────────────────────────
603617
604618func (uw * unifiedWindow ) showCosmoWelcome () {
619+ uw .currentView = uw .showCosmoWelcome
605620 mark := canvas .NewImageFromResource (markIconResource ())
606621 mark .SetMinSize (fyne .NewSize (56 , 56 ))
607622 mark .FillMode = canvas .ImageFillContain
608623
609- h := canvas .NewText ("Welcome to Cosmonaut" , cText )
624+ h := canvas .NewText ("Welcome to Cosmonaut" , theme . Color ( theme . ColorNameForeground ) )
610625 h .TextSize = 16
611626 h .TextStyle = fyne.TextStyle {Bold : true }
612627 h .Alignment = fyne .TextAlignCenter
613628
614- sub := canvas .NewText ("Select a GitHub repo or Coder workspace to get started." , cTextMute )
629+ sub := canvas .NewText ("Select a GitHub repo or Coder workspace to get started." , theme . Color ( theme . ColorNamePlaceHolder ) )
615630 sub .TextSize = 12
616631 sub .Alignment = fyne .TextAlignCenter
617632
@@ -624,15 +639,16 @@ func (uw *unifiedWindow) showCosmoWelcome() {
624639// ── REPO SUMMARY ───────────────────────────────────────────────────────
625640
626641func (uw * unifiedWindow ) showCosmoRepoSummary (repo string ) {
642+ uw .currentView = func () { uw .showCosmoRepoSummary (repo ) }
627643 all := filterWorkspacesByProvider (uw .daemon .Workspaces (), provider .NameGitHub )
628644 repoCS := provider .FilterByRepo (all , repo )
629645
630- title := canvas .NewText (repo , cText )
646+ title := canvas .NewText (repo , theme . Color ( theme . ColorNameForeground ) )
631647 title .TextSize = 18
632648 title .TextStyle = fyne.TextStyle {Bold : true }
633649
634650 countText := fmt .Sprintf ("%d workspace(s)" , len (repoCS ))
635- info := canvas .NewText (countText , cTextDim )
651+ info := canvas .NewText (countText , theme . Color ( theme . ColorNamePlaceHolder ) )
636652 info .TextSize = 13
637653
638654 createBtn := primaryButton ("Create new GitHub codespace" , func () {
@@ -649,7 +665,8 @@ func (uw *unifiedWindow) showCosmoRepoSummary(repo string) {
649665// ── CREATE ──────────────────────────────────────────────────────────────
650666
651667func (uw * unifiedWindow ) showCreateNewGeneric () {
652- title := canvas .NewText ("Create a new workspace" , cText )
668+ uw .currentView = uw .showCreateNewGeneric
669+ title := canvas .NewText ("Create a new workspace" , theme .Color (theme .ColorNameForeground ))
653670 title .TextSize = 18
654671 title .TextStyle = fyne.TextStyle {Bold : true }
655672
@@ -677,13 +694,14 @@ func (uw *unifiedWindow) showCreateNewGeneric() {
677694}
678695
679696func (uw * unifiedWindow ) showCosmoCreateNew (repo string ) {
697+ uw .currentView = func () { uw .showCosmoCreateNew (repo ) }
680698 target , resolvedName := guiTargetForRepo (uw .daemon .Cfg , repo )
681699
682- title := canvas .NewText ("Create a new codespace" , cText )
700+ title := canvas .NewText ("Create a new codespace" , theme . Color ( theme . ColorNameForeground ) )
683701 title .TextSize = 18
684702 title .TextStyle = fyne.TextStyle {Bold : true }
685703
686- hint := canvas .NewText ("A short label makes it easier to find later." , cTextMute )
704+ hint := canvas .NewText ("A short label makes it easier to find later." , theme . Color ( theme . ColorNamePlaceHolder ) )
687705 hint .TextSize = 12
688706
689707 repoLbl := widget .NewLabel (repo )
@@ -750,6 +768,7 @@ func (uw *unifiedWindow) showCosmoCreateNew(repo string) {
750768}
751769
752770func (uw * unifiedWindow ) showCoderWorkspaceDetail (ws provider.Workspace ) {
771+ uw .currentView = func () { uw .showCoderWorkspaceDetail (ws ) }
753772 target , resolvedName := guiTargetForCoderWorkspace (uw .daemon .Cfg , ws )
754773
755774 stateLbl := canvas .NewText (strings .ToUpper (ws .State ), stateColor (ws .State ))
@@ -761,11 +780,11 @@ func (uw *unifiedWindow) showCoderWorkspaceDetail(ws provider.Workspace) {
761780 if title == "" {
762781 title = ws .Name
763782 }
764- heroTitle := canvas .NewText (title , cText )
783+ heroTitle := canvas .NewText (title , theme . Color ( theme . ColorNameForeground ) )
765784 heroTitle .TextSize = 16
766785 heroTitle .TextStyle = fyne.TextStyle {Bold : true }
767786
768- subtitle := canvas .NewText ("coder" , cTextMute )
787+ subtitle := canvas .NewText ("coder" , theme . Color ( theme . ColorNamePlaceHolder ) )
769788 subtitle .TextSize = 11
770789 subtitle .TextStyle = fyne.TextStyle {Monospace : true }
771790
@@ -1142,7 +1161,8 @@ func coderPortTargetName(cfg *config.Config, ws provider.Workspace, fallback str
11421161}
11431162
11441163func (uw * unifiedWindow ) showCosmoCreateNewCoder () {
1145- title := canvas .NewText ("Create a new Coder workspace" , cText )
1164+ uw .currentView = uw .showCosmoCreateNewCoder
1165+ title := canvas .NewText ("Create a new Coder workspace" , theme .Color (theme .ColorNameForeground ))
11461166 title .TextSize = 18
11471167 title .TextStyle = fyne.TextStyle {Bold : true }
11481168
0 commit comments