49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"git.akyoto.dev/cli/dash/clock"
|
||
|
"git.akyoto.dev/cli/dash/editor"
|
||
|
"git.akyoto.dev/cli/dash/empty"
|
||
|
"git.akyoto.dev/cli/dash/osinfo"
|
||
|
"github.com/gdamore/tcell/v2"
|
||
|
"github.com/rivo/tview"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
app := tview.NewApplication()
|
||
|
|
||
|
header := clock.New(app)
|
||
|
main := editor.New(app)
|
||
|
footer := osinfo.New(app)
|
||
|
left := empty.New(app)
|
||
|
right := empty.New(app)
|
||
|
|
||
|
grid := tview.NewGrid()
|
||
|
grid.SetRows(3, 0, 3)
|
||
|
grid.SetColumns(0, 80, 0)
|
||
|
grid.SetBorders(false)
|
||
|
grid.SetBackgroundColor(tcell.ColorDefault)
|
||
|
|
||
|
grid.AddItem(header, 0, 0, 1, 3, 0, 0, false)
|
||
|
grid.AddItem(footer, 2, 0, 1, 3, 0, 0, false)
|
||
|
|
||
|
// Layout for screens narrower than 100 cells (menu and side bar are hidden).
|
||
|
grid.AddItem(left, 0, 0, 0, 0, 0, 0, false)
|
||
|
grid.AddItem(main, 1, 0, 1, 3, 0, 0, false)
|
||
|
grid.AddItem(right, 0, 0, 0, 0, 0, 0, false)
|
||
|
|
||
|
// Layout for screens wider than 100 cells.
|
||
|
grid.AddItem(left, 1, 0, 1, 1, 0, 100, false)
|
||
|
grid.AddItem(main, 1, 1, 1, 1, 0, 100, false)
|
||
|
grid.AddItem(right, 1, 2, 1, 1, 0, 100, false)
|
||
|
|
||
|
app.SetRoot(grid, true)
|
||
|
app.SetFocus(main)
|
||
|
|
||
|
err := app.Run()
|
||
|
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|