You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Winman is a basic yet powerful window manager in go for terminal-based user interfaces that plugs into tview.
It supports floating windows that can be dragged, resized and maximized. Windows can have buttons on the title bar, for example to close them, help commands or maximize / minimize.
Windows can also be modal, meaning that other windows don't receive input while
a modal window is on top. You can control whether the user can drag or resize windows around the screen.
Windows can overlap each other by setting their Z-index. Any tview.Primitive can be added to a window, thus you can combine with any other existing tview widget! Check tview for a complete list of available widgets you can use.
Installation
go get github.com/epiclabs-io/winman
Hello world
package main
import (
"github.com/epiclabs-io/winman""github.com/rivo/tview"
)
funcmain() {
app:=tview.NewApplication()
wm:=winman.NewWindowManager()
content:=tview.NewTextView().
SetText("Hello, world!"). // set content of the text viewSetTextAlign(tview.AlignCenter) // align text to the center of the text viewwindow:=wm.NewWindow(). // create new window and add it to the window managerShow(). // make window visibleSetRoot(content). // have the text view above be the content of the windowSetDraggable(true). // make window draggable around the screenSetResizable(true). // make the window resizableSetTitle("Hi!"). // set the window titleAddButton(&winman.Button{ // create a button with an X to close the applicationSymbol: 'X',
OnClick: func() { app.Stop() }, // close the application
})
window.SetRect(5, 5, 30, 10) // place the window// now, execute the application:iferr:=app.SetRoot(wm, true).EnableMouse(true).Run(); err!=nil {
panic(err)
}
}