Winman - go Window Manager for terminal UIs
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/r3ap3r2004/winman
Hello world
package main
import (
"github.com/r3ap3r2004/winman"
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
wm := winman.NewWindowManager()
content := tview.NewTextView().
SetText("Hello, world!").
SetTextAlign(tview.AlignCenter)
window := wm.NewWindow().
Show().
SetRoot(content).
SetDraggable(true).
SetResizable(true).
SetTitle("Hi!").
AddButton(&winman.Button{
Symbol: 'X',
OnClick: func() { app.Stop() },
})
window.SetRect(5, 5, 30, 10)
if err := app.SetRoot(wm, true).EnableMouse(true).Run(); err != nil {
panic(err)
}
}
Documentation
Refer to https://pkg.go.dev/github.com/r3ap3r2004/winman for the package's documentation.
The demos
directory contains a showcase demonstrating the different aspects of this library
Dependencies
This package works with tview and its dependencies.
Your Feedback
Add your issue here on GitHub. Feel free to get in touch if you have any questions.
Author(s)
This package is written and maintained by Javier Peletier (@jpeletier) - Epic Labs