Help menu is now centered
This commit is contained in:
parent
4d7726d049
commit
096182de4d
|
@ -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
|
||||
|
|
8
gotop.go
8
gotop.go
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user