Skip to content

Commit c0e8057

Browse files
Merge pull request #2358 from phanithinks/#2319_default_screen_mode
2 parents 7709345 + 35c5f94 commit c0e8057

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

docs/Config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ If you want to change the config directory:
2121
```yaml
2222
gui:
2323
# stuff relating to the UI
24+
windowSize: 'normal' # one of 'normal' | 'half' | 'full' default is 'normal'
2425
scrollHeight: 2 # how many lines you scroll by
2526
scrollPastBottom: true # enable scrolling past the bottom
2627
sidePanelWidth: 0.3333 # number from 0 to 1

pkg/config/user_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type GuiConfig struct {
5151
CommandLogSize int `yaml:"commandLogSize"`
5252
SplitDiff string `yaml:"splitDiff"`
5353
SkipRewordInEditorWarning bool `yaml:"skipRewordInEditorWarning"`
54+
WindowSize string `yaml:"windowSize"`
5455
}
5556

5657
type ThemeConfig struct {

pkg/gui/gui.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs, reuseState bool) {
277277
contextTree := gui.contextTree()
278278

279279
initialContext := initialContext(contextTree, startArgs)
280-
initialScreenMode := initialScreenMode(startArgs)
280+
initialScreenMode := initialScreenMode(startArgs, gui.Config)
281281

282282
initialWindowViewNameMap := gui.initialWindowViewNameMap(contextTree)
283283

@@ -307,11 +307,20 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs, reuseState bool) {
307307
gui.RepoStateMap[Repo(currentDir)] = gui.State
308308
}
309309

310-
func initialScreenMode(startArgs appTypes.StartArgs) WindowMaximisation {
310+
func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) WindowMaximisation {
311311
if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
312312
return SCREEN_HALF
313313
} else {
314-
return SCREEN_NORMAL
314+
defaultWindowSize := config.GetUserConfig().Gui.WindowSize
315+
316+
switch defaultWindowSize {
317+
case "half":
318+
return SCREEN_HALF
319+
case "full":
320+
return SCREEN_FULL
321+
default:
322+
return SCREEN_NORMAL
323+
}
315324
}
316325
}
317326

0 commit comments

Comments
 (0)