diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-21 03:41:40 -0800 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-21 03:42:40 -0800 |
commit | 096182de4d1a07f0d593a79b2f7ce3650c59aef1 (patch) | |
tree | cb1b01a56fd20dd77225916ac38581014a8fa32e | |
parent | 4d7726d0498cf612970b00fe64faf1e6e9c7fd72 (diff) |
Help menu is now centered
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | gotop.go | 8 | ||||
-rw-r--r-- | widgets/help.go | 6 |
3 files changed, 11 insertions, 4 deletions
@@ -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 @@ -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 }) diff --git a/widgets/help.go b/widgets/help.go index d365452..90eeec9 100644 --- a/widgets/help.go +++ b/widgets/help.go @@ -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 } |