Merge branch 'set-sidebar-width' of github.com:codegoalie/slack-term into column-width
This commit is contained in:
commit
5d483f313f
@ -24,7 +24,11 @@ Getting started
|
||||
"slack_token": "yourslacktokenhere",
|
||||
|
||||
// add the following to use light theme, default is dark
|
||||
"theme": "light"
|
||||
"theme": "light",
|
||||
|
||||
// Set the width of the channel list sidebar. Must be between 1 and 11
|
||||
// as the entire width of the screen is 12 columns.
|
||||
"sidebar_width": 3
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -12,12 +12,14 @@ import (
|
||||
type Config struct {
|
||||
SlackToken string `json:"slack_token"`
|
||||
Theme string `json:"theme"`
|
||||
SidebarWidth int `json:"sidebar_width"`
|
||||
}
|
||||
|
||||
// NewConfig loads the config file and returns a Config struct
|
||||
func NewConfig(filepath string) (*Config, error) {
|
||||
cfg := Config{
|
||||
Theme: "dark",
|
||||
SidebarWidth: 1,
|
||||
}
|
||||
|
||||
file, err := os.Open(filepath)
|
||||
|
10
main.go
10
main.go
@ -68,15 +68,17 @@ func main() {
|
||||
// Create context
|
||||
ctx := context.CreateAppContext(flgConfig)
|
||||
|
||||
mainWidth := 12 - ctx.Config.SidebarWidth
|
||||
|
||||
// Setup body
|
||||
termui.Body.AddRows(
|
||||
termui.NewRow(
|
||||
termui.NewCol(1, 0, ctx.View.Channels),
|
||||
termui.NewCol(11, 0, ctx.View.Chat),
|
||||
termui.NewCol(ctx.Config.SidebarWidth, 0, ctx.View.Channels),
|
||||
termui.NewCol(mainWidth, 0, ctx.View.Chat),
|
||||
),
|
||||
termui.NewRow(
|
||||
termui.NewCol(1, 0, ctx.View.Mode),
|
||||
termui.NewCol(11, 0, ctx.View.Input),
|
||||
termui.NewCol(ctx.Config.SidebarWidth, 0, ctx.View.Mode),
|
||||
termui.NewCol(mainWidth, 0, ctx.View.Input),
|
||||
),
|
||||
)
|
||||
termui.Body.Align()
|
||||
|
Loading…
Reference in New Issue
Block a user