Skip to content

Commit

Permalink
Allow setting default screenMode (jesseduffield#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rdkang authored Jul 21, 2023
1 parent 66f5d17 commit 07f26c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ gui:
# When true, increases vertical space used by focused side panel,
# creating an accordion effect
expandFocusedSidePanel: false
# Determines which screen mode will be used on startup
screenMode: "normal" # one of 'normal' | 'half' | 'fullscreen'
logs:
timestamps: false
since: '60m' # set to '' to show all logs
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ type GuiConfig struct {
// When true, increases vertical space used by focused side panel,
// creating an accordion effect
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`

// ScreenMode allow user to specify which screen mode will be used on startup
ScreenMode string `yaml:"screenMode,omitempty"`
}

// CommandTemplatesConfig determines what commands actually get called when we
Expand Down Expand Up @@ -362,6 +365,7 @@ func GetDefaultConfig() UserConfig {
SidePanelWidth: 0.3333,
ShowBottomLine: true,
ExpandFocusedSidePanel: false,
ScreenMode: "normal",
},
ConfirmOnQuit: false,
Logs: LogsConfig{
Expand Down
14 changes: 14 additions & 0 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ const (
SCREEN_FULL
)

func getScreenMode(config *config.AppConfig) WindowMaximisation {
switch config.UserConfig.Gui.ScreenMode {
case "normal":
return SCREEN_NORMAL
case "half":
return SCREEN_HALF
case "fullscreen":
return SCREEN_FULL
default:
return SCREEN_NORMAL
}
}

// NewGui builds a new gui handler
func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand *commands.OSCommand, tr *i18n.TranslationSet, config *config.AppConfig, errorChan chan error) (*Gui, error) {
initialState := guiState{
Expand All @@ -126,6 +139,7 @@ func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand
ViewStack: []string{},

ShowExitedContainers: true,
ScreenMode: getScreenMode(config),
}

gui := &Gui{
Expand Down

0 comments on commit 07f26c1

Please sign in to comment.