49 lines
914 B
Go
Raw Normal View History

2023-08-17 23:10:09 +00:00
package main
import (
2023-08-18 15:01:42 +00:00
"os"
"path/filepath"
2023-08-17 23:10:09 +00:00
"git.akyoto.dev/cli/dash/clock"
2023-08-18 15:01:42 +00:00
"git.akyoto.dev/cli/dash/core"
2023-08-17 23:10:09 +00:00
"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)
2023-08-18 15:01:42 +00:00
dataDir := core.ConfigDir()
err := os.MkdirAll(dataDir, 0700)
if err != nil {
panic(err)
}
2023-08-17 23:10:09 +00:00
2023-08-18 15:01:42 +00:00
header := clock.New(app)
main := editor.New(app, filepath.Join(dataDir, "main"))
footer := osinfo.New(app)
2023-08-17 23:10:09 +00:00
2023-08-18 15:01:42 +00:00
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)
2023-08-17 23:10:09 +00:00
2023-08-18 11:17:46 +00:00
app.EnableMouse(true)
2023-08-17 23:10:09 +00:00
app.SetRoot(grid, true)
2023-08-18 15:01:42 +00:00
app.SetFocus(main.Pages)
2023-08-17 23:10:09 +00:00
2023-08-18 15:01:42 +00:00
err = app.Run()
2023-08-17 23:10:09 +00:00
if err != nil {
panic(err)
}
}