Library Usage
Embed TUIOS terminal multiplexer in your Go applications
TUIOS can be used as a Go library to embed terminal multiplexing functionality into your applications.
Installation
go get github.com/Gaurav-Gosain/tuios/pkg/tuiosBasic Usage
package main
import (
"context"
"log"
"github.com/Gaurav-Gosain/tuios/pkg/tuios"
)
func main() {
config := tuios.DefaultConfig()
config.Theme = "dracula"
config.ShowKeys = false
if err := tuios.Run(context.Background(), config); err != nil {
log.Fatal(err)
}
}Configuration Options
The Config struct provides extensive customization:
type Config struct {
// Visual settings
Theme string
BorderStyle string
DockbarPosition string
ShowKeys bool
ASCIIOnly bool
// Performance
NoAnimations bool
// Session management
SessionName string
DaemonMode bool
// Behavior
ConfigPath string
Debug bool
}Running in Daemon Mode
For persistent sessions:
config := tuios.DefaultConfig()
config.DaemonMode = true
config.SessionName = "my-session"
err := tuios.Run(ctx, config)SSH Server Mode
Serve TUIOS over SSH:
sshConfig := tuios.SSHConfig{
Host: "0.0.0.0",
Port: "2222",
KeyPath: "/path/to/host/key",
}
err := tuios.RunSSH(ctx, config, sshConfig)Custom Themes
Load custom color themes:
config.Theme = "custom-theme"
config.ConfigPath = "/path/to/config.toml"See Configuration for theme format.
Web Server Mode
Note: Web terminal functionality is in a separate binary (tuios-web) for security isolation.
For programmatic web serving, use the sip library:
import "github.com/Gaurav-Gosain/sip"
// See sip documentationArchitecture
TUIOS uses the Bubble Tea framework:
- Model: Terminal multiplexer state
- View: Rendering with Lipgloss
- Update: Event handling for keyboard, mouse, PTY I/O
The library exposes the full Bubble Tea program, allowing integration into larger TUI applications.
Examples
See /examples directory for:
- Basic embedding
- Custom keybindings
- Integration with other Bubble Tea components
API Stability
The pkg/tuios package is pre-1.0.0 and the API may change. Breaking changes will follow semantic versioning (minor version bumps until v1.0.0, then major version bumps).
For stable production use, pin to a specific version in your go.mod.
For advanced customization, import internal packages at your own risk. Internal APIs may change without notice.