Help menu is now centered

This commit is contained in:
Caleb Bassi 2018-02-21 03:41:40 -08:00
parent 4d7726d049
commit 096182de4d
3 changed files with 11 additions and 4 deletions

View File

@ -76,7 +76,6 @@ Feel free to add a new one. You can use 256 colors, bold, underline, and reverse
- solarized picture and theme
- copy over vtop themes
* general
- center the help menu
- command line option to set polling interval for CPU and mem
- command line updating
- command line option to only show processes, CPU, and mem

View File

@ -155,8 +155,6 @@ func main() {
disk = w.NewDisk()
temp = w.NewTemp()
help = w.NewHelpMenu()
widgetColors()
<-procLoaded
@ -169,9 +167,15 @@ func main() {
setupGrid()
help = w.NewHelpMenu()
ui.On("resize", func(e ui.Event) {
ui.Body.Width, ui.Body.Height = e.Width, e.Height
ui.Body.Resize()
help.XOffset = (ui.Body.Width - help.X) / 2
help.YOffset = (ui.Body.Height - help.Y) / 2
resized <- true
})

View File

@ -34,6 +34,10 @@ func NewHelpMenu() *HelpMenu {
block := *ui.NewBlock()
block.X = 48
block.Y = 17
block.XOffset = (ui.Body.Width - block.X) / 2
block.YOffset = (ui.Body.Height - block.Y) / 2
// block.XOffset = ui.Body.Width - 50
// block.YOffset = ui.Body.Height - 50
return &HelpMenu{block}
}
@ -46,7 +50,7 @@ func (hm *HelpMenu) Buffer() *ui.Buffer {
}
}
buf.SetAreaXY(100, 100)
buf.SetAreaXY(hm.X+2, hm.Y+2)
return buf
}