Skip to content
Closed
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
2 changes: 2 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ to the top of your config file or via [Visual Studio Code settings.json config][
gui:
# stuff relating to the UI
windowSize: 'normal' # one of 'normal' | 'half' | 'full' default is 'normal'
panelWindowSize:
log : 'full' # one of 'normal' | 'half' | 'full' default is 'full'
scrollHeight: 2 # how many lines you scroll by
scrollPastBottom: true # enable scrolling past the bottom
scrollOffMargin: 2 # how many lines to keep before/after the cursor when it reaches the top/bottom of the view; see 'Scroll-off Margin' section below
Expand Down
12 changes: 11 additions & 1 deletion pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ type GuiConfig struct {
SplitDiff string `yaml:"splitDiff" jsonschema:"enum=auto,enum=always"`
// Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
// One of: 'normal' (default) | 'half' | 'full'
WindowSize string `yaml:"windowSize" jsonschema:"enum=normal,enum=half,enum=full"`
WindowSize string `yaml:"windowSize" jsonschema:"enum=normal,enum=half,enum=full"`
PanelWindowSize map[string]string `yaml:"panelWindowSize"`
// Window border style.
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
Border string `yaml:"border" jsonschema:"enum=single,enum=double,enum=rounded,enum=hidden"`
Expand All @@ -142,6 +143,15 @@ type GuiConfig struct {
PortraitMode string `yaml:"portraitMode"`
}

func (GuiConfig) JSONSchemaExtend(schema *jsonschema.Schema) {
windowSize, _ := schema.Properties.Get("windowSize")
panelWindowSize, _ := schema.Properties.Get("panelWindowSize")
panelWindowSize.PatternProperties = map[string]*jsonschema.Schema{
"^(main|status|branch|log|stash)$": windowSize,
}
panelWindowSize.AdditionalProperties = jsonschema.FalseSchema
}

type ThemeConfig struct {
// Border color of focused window
ActiveBorderColor []string `yaml:"activeBorderColor" jsonschema:"minItems=1,uniqueItems=true"`
Expand Down
28 changes: 17 additions & 11 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,20 +415,26 @@ func initialWindowViewNameMap(contextTree *context.ContextTree) *utils.ThreadSaf
}

func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) types.WindowMaximisation {
if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
return types.SCREEN_FULL
} else {
defaultWindowSize := config.GetUserConfig().Gui.WindowSize

switch defaultWindowSize {
case "half":
return types.SCREEN_HALF
case "full":
panelName := string(startArgs.GitArg)
if startArgs.GitArg == appTypes.GitArgNone {
panelName = "main"
}
defaultWindowSize, ok := config.GetUserConfig().Gui.PanelWindowSize[panelName]
if !ok {
if startArgs.GitArg != appTypes.GitArgNone {
return types.SCREEN_FULL
default:
return types.SCREEN_NORMAL
} else {
defaultWindowSize = config.GetUserConfig().Gui.WindowSize
}
}
switch defaultWindowSize {
case "half":
return types.SCREEN_HALF
case "full":
return types.SCREEN_FULL
default:
return types.SCREEN_NORMAL
}
}

func initialContext(contextTree *context.ContextTree, startArgs appTypes.StartArgs) types.IListContext {
Expand Down
15 changes: 15 additions & 0 deletions schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@
],
"description": "Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).\nOne of: 'normal' (default) | 'half' | 'full'"
},
"panelWindowSize": {
"patternProperties": {
"^(main|status|branch|log|stash)$": {
"type": "string",
"enum": [
"normal",
"half",
"full"
],
"description": "Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).\nOne of: 'normal' (default) | 'half' | 'full'"
}
},
"additionalProperties": false,
"type": "object"
},
"border": {
"type": "string",
"enum": [
Expand Down