summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-02-01 21:52:09 +1100
committerGitHub <noreply@github.com>2023-02-01 21:52:09 +1100
commitc0e805718d1085c48425a54869a7b5091a529f5e (patch)
tree2c2da6decd77b48c8152480974d575cd0670a1e1
parent77093451d4f848d4ed613df90ff24104c21bd1cb (diff)
parent35c5f940a421b4b85918e005fbcc4290e7cc8c5b (diff)
Merge pull request #2358 from phanithinks/#2319_default_screen_mode
-rw-r--r--docs/Config.md1
-rw-r--r--pkg/config/user_config.go1
-rw-r--r--pkg/gui/gui.go15
3 files changed, 14 insertions, 3 deletions
diff --git a/docs/Config.md b/docs/Config.md
index a59c33f79..6a9be62e9 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -21,6 +21,7 @@ If you want to change the config directory:
```yaml
gui:
# stuff relating to the UI
+ windowSize: 'normal' # one of 'normal' | 'half' | 'full' default is 'normal'
scrollHeight: 2 # how many lines you scroll by
scrollPastBottom: true # enable scrolling past the bottom
sidePanelWidth: 0.3333 # number from 0 to 1
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go
index 705553407..c0b9a1468 100644
--- a/pkg/config/user_config.go
+++ b/pkg/config/user_config.go
@@ -51,6 +51,7 @@ type GuiConfig struct {
CommandLogSize int `yaml:"commandLogSize"`
SplitDiff string `yaml:"splitDiff"`
SkipRewordInEditorWarning bool `yaml:"skipRewordInEditorWarning"`
+ WindowSize string `yaml:"windowSize"`
}
type ThemeConfig struct {
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 4e15af94e..bcc3400e3 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -277,7 +277,7 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs, reuseState bool) {
contextTree := gui.contextTree()
initialContext := initialContext(contextTree, startArgs)
- initialScreenMode := initialScreenMode(startArgs)
+ initialScreenMode := initialScreenMode(startArgs, gui.Config)
initialWindowViewNameMap := gui.initialWindowViewNameMap(contextTree)
@@ -307,11 +307,20 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs, reuseState bool) {
gui.RepoStateMap[Repo(currentDir)] = gui.State
}
-func initialScreenMode(startArgs appTypes.StartArgs) WindowMaximisation {
+func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) WindowMaximisation {
if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
return SCREEN_HALF
} else {
- return SCREEN_NORMAL
+ defaultWindowSize := config.GetUserConfig().Gui.WindowSize
+
+ switch defaultWindowSize {
+ case "half":
+ return SCREEN_HALF
+ case "full":
+ return SCREEN_FULL
+ default:
+ return SCREEN_NORMAL
+ }
}
}