(ctx context.Context)
| 142 | } |
| 143 | |
| 144 | func BootstrapStarterLayout(ctx context.Context) error { |
| 145 | ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second) |
| 146 | defer cancelFn() |
| 147 | client, err := wstore.DBGetSingleton[*waveobj.Client](ctx) |
| 148 | if err != nil { |
| 149 | log.Printf("unable to find client: %v\n", err) |
| 150 | return fmt.Errorf("unable to find client: %w", err) |
| 151 | } |
| 152 | |
| 153 | if len(client.WindowIds) < 1 { |
| 154 | return fmt.Errorf("error bootstrapping layout, no windows exist") |
| 155 | } |
| 156 | |
| 157 | windowId := client.WindowIds[0] |
| 158 | |
| 159 | window, err := wstore.DBMustGet[*waveobj.Window](ctx, windowId) |
| 160 | if err != nil { |
| 161 | return fmt.Errorf("error getting window: %w", err) |
| 162 | } |
| 163 | |
| 164 | workspace, err := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId) |
| 165 | if err != nil { |
| 166 | return fmt.Errorf("error getting workspace: %w", err) |
| 167 | } |
| 168 | |
| 169 | tabId := workspace.ActiveTabId |
| 170 | |
| 171 | starterLayout := GetStarterLayout() |
| 172 | err = ApplyPortableLayout(ctx, tabId, starterLayout, false) |
| 173 | if err != nil { |
| 174 | return fmt.Errorf("error applying starter layout: %w", err) |
| 175 | } |
| 176 | |
| 177 | return nil |
| 178 | } |
no test coverage detected