Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/wconfig/settingsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ type SettingsType struct {
PreviewDefaultSort string `json:"preview:defaultsort,omitempty" jsonschema:"enum=name,enum=modtime"`

TabPreset string `json:"tab:preset,omitempty"`
TabNewTabLayout any `json:"tab:newtablayout,omitempty"`
TabConfirmClose bool `json:"tab:confirmclose,omitempty"`
TabBackground string `json:"tab:background,omitempty"`

Expand Down
20 changes: 19 additions & 1 deletion pkg/wcore/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package wcore

import (
"context"
"encoding/json"
"fmt"
"log"
"regexp"
Expand Down Expand Up @@ -195,6 +196,23 @@ func getTabBackground() string {
return config.Settings.TabPreset
}

// getNewTabLayoutFromConfig returns the user-configured layout for new tabs,
// falling back to the default single-terminal layout if not configured.
func getNewTabLayoutFromConfig() PortableLayout {
settings := wconfig.GetWatcher().GetFullConfig()
rawLayout := settings.Settings.TabNewTabLayout
if rawLayout != nil {
barr, err := json.Marshal(rawLayout)
if err == nil {
var layout PortableLayout
if json.Unmarshal(barr, &layout) == nil && len(layout) > 0 {
return layout
}
}
}
return GetNewTabLayout()
}

var tabNameRe = regexp.MustCompile(`^T(\d+)$`)

// getNextTabName returns the next auto-generated tab name (e.g. "T3") given a
Expand Down Expand Up @@ -250,7 +268,7 @@ func CreateTab(ctx context.Context, workspaceId string, tabName string, activate

// No need to apply an initial layout for the initial launch, since the starter layout will get applied after onboarding modal dismissal
if !isInitialLaunch {
err = ApplyPortableLayout(ctx, tab.OID, GetNewTabLayout(), true)
err = ApplyPortableLayout(ctx, tab.OID, getNewTabLayoutFromConfig(), true)
if err != nil {
return tab.OID, fmt.Errorf("error applying new tab layout: %w", err)
}
Expand Down
22 changes: 22 additions & 0 deletions schema/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,28 @@
"tab:preset": {
"type": "string"
},
"tab:newtablayout": {
"type": "array",
"description": "Custom block layout for new tabs. Each element defines a block with its position in the tile tree. If not set, defaults to a single terminal block.",
"items": {
"type": "object",
"properties": {
"indexarr": {
"type": "array",
"items": {"type": "integer"},
"description": "Path in the tile tree (e.g. [0] = first child, [1] = second child, [1,1] = second child of second child)"
},
"size": {"type": "integer", "description": "Relative size/weight of the block"},
"blockdef": {
"type": "object",
"properties": {"meta": {"type": "object"}},
"description": "Block definition with meta (view, controller, file, url, etc.)"
},
"focused": {"type": "boolean", "description": "Whether this block should receive focus"}
},
"required": ["indexarr", "blockdef"]
}
},
"tab:confirmclose": {
"type": "boolean"
},
Expand Down