diff --git a/docs/Config.md b/docs/Config.md index 8b37c6aaa65..b2683ef0b83 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -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 diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 602dc54bf6b..0d26449206c 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -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"` @@ -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"` diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 6acdc804ca4..5ea1a1cc976 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -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 { diff --git a/schema/config.json b/schema/config.json index 3de7df17d2f..e40a18274bd 100644 --- a/schema/config.json +++ b/schema/config.json @@ -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": [