49 lines
914 B
Go

package main
import (
"os"
"path/filepath"
"git.akyoto.dev/cli/dash/clock"
"git.akyoto.dev/cli/dash/core"
"git.akyoto.dev/cli/dash/editor"
"git.akyoto.dev/cli/dash/osinfo"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
grid := tview.NewGrid()
grid.SetRows(3, 0, 3)
grid.SetColumns(0, 80, 0)
grid.SetBorders(false)
grid.SetBackgroundColor(tcell.ColorDefault)
dataDir := core.ConfigDir()
err := os.MkdirAll(dataDir, 0700)
if err != nil {
panic(err)
}
header := clock.New(app)
main := editor.New(app, filepath.Join(dataDir, "main"))
footer := osinfo.New(app)
grid.AddItem(header, 0, 0, 1, 3, 0, 0, false)
grid.AddItem(main.Pages, 1, 1, 1, 1, 0, 0, false)
grid.AddItem(footer, 2, 0, 1, 3, 0, 0, false)
app.EnableMouse(true)
app.SetRoot(grid, true)
app.SetFocus(main.Pages)
err = app.Run()
if err != nil {
panic(err)
}
}