@@ -56,6 +56,9 @@ class WorkspaceLayoutModel {
5656 private focusTimeoutRef : NodeJS . Timeout | null = null ;
5757 private debouncedPersistAIWidth : ( ) => void ;
5858 private debouncedPersistVTabWidth : ( ) => void ;
59+ private widgetsSidebarVisible : boolean ;
60+ widgetsSidebarVisibleAtom : jotai . PrimitiveAtom < boolean > ;
61+ private debouncedPersistWidgetsSidebarVisible : ( ) => void ;
5962
6063 private constructor ( ) {
6164 this . aiPanelRef = null ;
@@ -71,6 +74,8 @@ class WorkspaceLayoutModel {
7174 this . vtabWidth = VTabBar_DefaultWidth ;
7275 this . vtabVisible = false ;
7376 this . panelVisibleAtom = jotai . atom ( false ) ;
77+ this . widgetsSidebarVisible = true ;
78+ this . widgetsSidebarVisibleAtom = jotai . atom ( true ) ;
7479 this . initializeFromMeta ( ) ;
7580
7681 this . handleWindowResize = this . handleWindowResize . bind ( this ) ;
@@ -104,6 +109,17 @@ class WorkspaceLayoutModel {
104109 console . warn ( "Failed to persist vtabbar width:" , e ) ;
105110 }
106111 } , 300 ) ;
112+
113+ this . debouncedPersistWidgetsSidebarVisible = debounce ( ( ) => {
114+ try {
115+ RpcApi . SetMetaCommand ( TabRpcClient , {
116+ oref : WOS . makeORef ( "workspace" , this . getWorkspaceId ( ) ) ,
117+ meta : { "layout:widgetsvisible" : this . widgetsSidebarVisible } ,
118+ } ) ;
119+ } catch ( e ) {
120+ console . warn ( "Failed to persist widgets sidebar visibility:" , e ) ;
121+ }
122+ } , 300 ) ;
107123 }
108124
109125 static getInstance ( ) : WorkspaceLayoutModel {
@@ -135,6 +151,10 @@ class WorkspaceLayoutModel {
135151 return getOrefMetaKeyAtom ( WOS . makeORef ( "workspace" , this . getWorkspaceId ( ) ) , "layout:vtabbarwidth" ) ;
136152 }
137153
154+ private getWidgetsSidebarVisibleAtom ( ) : jotai . Atom < boolean | undefined > {
155+ return getOrefMetaKeyAtom ( WOS . makeORef ( "workspace" , this . getWorkspaceId ( ) ) , "layout:widgetsvisible" ) ;
156+ }
157+
138158 private initializeFromMeta ( ) : void {
139159 try {
140160 const savedVisible = globalStore . get ( this . getPanelOpenAtom ( ) ) ;
@@ -150,6 +170,11 @@ class WorkspaceLayoutModel {
150170 if ( savedVTabWidth != null && savedVTabWidth > 0 ) {
151171 this . vtabWidth = savedVTabWidth ;
152172 }
173+ const savedWidgetsSidebarVisible = globalStore . get ( this . getWidgetsSidebarVisibleAtom ( ) ) ;
174+ if ( savedWidgetsSidebarVisible != null ) {
175+ this . widgetsSidebarVisible = savedWidgetsSidebarVisible ;
176+ globalStore . set ( this . widgetsSidebarVisibleAtom , savedWidgetsSidebarVisible ) ;
177+ }
153178 const tabBarPosition = globalStore . get ( getSettingsKeyAtom ( "app:tabbar" ) ) ?? "top" ;
154179 const showLeftTabBar = tabBarPosition === "left" && ! isBuilderWindow ( ) ;
155180 this . vtabVisible = showLeftTabBar ;
@@ -352,6 +377,17 @@ class WorkspaceLayoutModel {
352377 return this . getResolvedAIWidth ( window . innerWidth ) ;
353378 }
354379
380+ getWidgetsSidebarVisible ( ) : boolean {
381+ return this . widgetsSidebarVisible ;
382+ }
383+
384+ setWidgetsSidebarVisible ( visible : boolean ) : void {
385+ if ( this . widgetsSidebarVisible === visible ) return ;
386+ this . widgetsSidebarVisible = visible ;
387+ globalStore . set ( this . widgetsSidebarVisibleAtom , visible ) ;
388+ this . debouncedPersistWidgetsSidebarVisible ( ) ;
389+ }
390+
355391 // ---- Initial percentage helpers (used by workspace.tsx for defaultSize) ----
356392
357393 getLeftGroupInitialPercentage ( windowWidth : number , showLeftTabBar : boolean ) : number {
0 commit comments