tui

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tui implements the interactive Bubble Tea terminal interface for IServ.

Index

Constants

View Source
const (
	// LangEN selects English UI labels (default).
	LangEN = "en"
	// LangRU selects Russian UI labels.
	LangRU = "ru"
	// LangDE selects German UI labels.
	LangDE = "de"
)
View Source
const (
	// IconSetAuto selects Nerd Font glyphs when available and falls back to Universal Unicode.
	IconSetAuto = "auto"
	// IconSetUnicode renders universal 1-cell BMP geometric symbols (works on every OS/font).
	IconSetUnicode = "unicode"
	// IconSetEmoji renders optional color emoji icons.
	IconSetEmoji = "emoji"
	// IconSetNerd renders Catppuccin Nerd Font glyphs (requires Symbols Nerd Font or a Nerd Font).
	IconSetNerd = "nerd"
	// IconSetMinimal is kept as a backwards-compatible alias for [IconSetUnicode].
	IconSetMinimal = IconSetUnicode
)
View Source
const (
	// MinTermWidth is the minimum terminal column count required to render the TUI.
	MinTermWidth = 100
	// MinTermHeight is the minimum terminal row count required to render the TUI.
	MinTermHeight = 25
)

Variables

View Source
var ThemeNames = []string{"Catppuccin", "Dracula"}

ThemeNames lists the supported theme presets in cycle order.

Functions

func BuildIServFileWebURL

func BuildIServFileWebURL(baseURL, davPath string) string

BuildIServFileWebURL maps an IServ WebDAV path to the authenticated IServ web file browser URL.

func CopyToClipboard

func CopyToClipboard(text string) error

CopyToClipboard writes text to the OS clipboard (Wayland wl-copy, native OS clipboard via atotto/clipboard, and OSC 52 terminal fallback for SSH/headless).

func DetectDefaultIconSet

func DetectDefaultIconSet() string

DetectDefaultIconSet returns IconSetNerd if a Nerd Font or built-in Nerd terminal is detected, otherwise IconSetUnicode.

func ExtractShortcutURL

func ExtractShortcutURL(name string, raw []byte) string

ExtractShortcutURL extracts and validates an HTTP(S) target URL from .url/.webloc/.desktop files.

func FileIcon

func FileIcon(f iserv.FileEntry, theme Theme, iconSet string) (string, lipgloss.Color, string)

FileIcon maps a file or directory entry to an icon glyph, color, and kind label.

func IconSetLabel

func IconSetLabel(s string) string

IconSetLabel returns a human-readable display name for the active icon preset.

func IconSetShort

func IconSetShort(s string) string

IconSetShort returns a compact badge label for chips and sub-bars.

func IsLinkShortcutFile

func IsLinkShortcutFile(name string) bool

IsLinkShortcutFile reports whether name is an internet shortcut (.url, .webloc, .desktop).

func LangLabel

func LangLabel(s string) string

LangLabel returns the localized display name for the active language.

func LangShort

func LangShort(s string) string

LangShort returns the compact 2-letter code for sub-bars and badges.

func NextIconSet

func NextIconSet(cur string) string

NextIconSet cycles icon presets: unicode -> emoji -> nerd -> unicode.

func NextLang

func NextLang(cur string) string

NextLang cycles through supported UI languages: EN -> RU -> DE -> EN.

func NextThemeName

func NextThemeName(cur string) string

NextThemeName returns the next theme preset name after cur.

func NormalizeIconSet

func NormalizeIconSet(s string) string

NormalizeIconSet canonicalizes user-supplied icon preset names (including legacy "minimal").

func NormalizeLang

func NormalizeLang(s string) string

NormalizeLang returns LangRU or LangDE when requested, otherwise LangEN.

func NotifIcon

func NotifIcon(module string, read bool, theme Theme, iconSet string) (string, lipgloss.Color)

NotifIcon returns the themed icon glyph and color for a notification alert.

func OpenInBrowser

func OpenInBrowser(target string) error

OpenInBrowser opens a validated HTTP(S) URL or existing local file using the OS handler.

func PrevLang

func PrevLang(cur string) string

PrevLang cycles backwards through supported UI languages: EN -> DE -> RU -> EN.

func ResolveIServURL

func ResolveIServURL(baseURL, raw string) string

ResolveIServURL normalizes a relative or absolute IServ URL against baseURL.

func ResolveIconSet

func ResolveIconSet(s string) string

ResolveIconSet converts "auto" (or empty) to a concrete preset via DetectDefaultIconSet.

func SemanticIcon

func SemanticIcon(kind string, theme Theme, iconSet string) (string, lipgloss.Color)

SemanticIcon returns a themed glyph paired with its accent color.

func TabIconGlyph

func TabIconGlyph(tab Tab, iconSet string) string

TabIconGlyph returns the icon glyph for a workspace tab in the active icon set.

Types

type ConnectFunc

type ConnectFunc = client.ConnectFunc

ConnectFunc aliases the shared connection factory.

type FontInstallerFunc

type FontInstallerFunc func(context.Context) (fonts.InstallResult, error)

FontInstallerFunc downloads and installs the Symbols Nerd Font fallback archive.

type IServClient

type IServClient = client.IServClient

IServClient aliases the shared consumer interface for TUI callers and tests.

type LoginModel

type LoginModel struct {
	// contains filtered or unexported fields
}

LoginModel manages the interactive authentication splash screen.

func NewLoginModel

func NewLoginModel(initialDomain, initialUser, initialPass string, theme Theme, zones *zone.Manager) LoginModel

NewLoginModel constructs a LoginModel pre-filled with initial domain/user defaults.

func (LoginModel) Update

func (m LoginModel) Update(msg tea.Msg) (LoginModel, tea.Cmd)

Update handles Bubble Tea messages for the login splash screen.

func (LoginModel) View

func (m LoginModel) View(width, height int) string

View renders the centered login splash screen.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the root Bubble Tea model for iserv-cli.

func NewModel

func NewModel(opts Options) Model

NewModel initializes the iserv-cli Bubble Tea model with safe defaults.

func (Model) Close

func (m Model) Close()

Close releases background zone-tracking resources held by the model.

func (Model) Init

func (m Model) Init() tea.Cmd

Init starts auto-login when credentials are pre-supplied, or blinks the login cursor.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update processes global lifecycle, login, and dashboard messages.

func (Model) View

func (m Model) View() string

View renders the too-small warning, login screen, or authenticated dashboard.

type Options

type Options struct {
	Context          context.Context
	Domain           string
	Username         string
	Password         string
	InitialTheme     string
	InitialIconSet   string
	InitialLang      string
	InitialBookmarks []config.Bookmark
	DownloadsDir     string
	ExportsDir       string
	Connect          ConnectFunc
	SaveCfg          func(config.SavedConfig) error
	LoadSpotlight    func(domain, user string) []config.SpotlightEntry
	SaveSpotlight    func(domain, user string, entries []config.SpotlightEntry) error
	OpenBrowser      func(string) error
	CopyClipboard    func(string) error
	InstallFont      FontInstallerFunc
	HasNerdFont      func() bool
}

Options configures the initial state and dependencies of the Bubble Tea Model.

type Tab

type Tab int

Tab identifies one of the 8 IServ workspace tabs.

type Theme

type Theme struct {
	Name string

	BrandBlue, Accent, Violet, Cyan, Sapphire  lipgloss.Color
	Green, Peach, Amber, Red, Pink, Teal       lipgloss.Color
	Text, Muted, Subtle, Border, BorderFocused lipgloss.Color
	Surface, Highlight, PillFill, DividerColor lipgloss.Color
	TileBg, TileFg                             lipgloss.Color

	HeaderBar, BrandBadge, VersionPill, UserBadge, Divider    lipgloss.Style
	TabActive, TabInactive, TabBar, SubBar                    lipgloss.Style
	PillActive, PillInactive, PillCount                       lipgloss.Style
	ActionChip, ActionChipPrimary, AvatarTile, StatCard       lipgloss.Style
	GroupChip, Pane, PaneFocused, Card, PaneTitle             lipgloss.Style
	RowNormal, RowSelected, RowPast, RowToday                 lipgloss.Style
	MutedText, SubtleText, SectionLabel                       lipgloss.Style
	BadgeUnread, BadgeDone, BadgeOverdue, BadgeWarn, BadgeTag lipgloss.Style
	ToastSuccess, ToastError, FooterBar, KeyBadge             lipgloss.Style
	LoginBox, HelpBox, ModalBox, SearchBar                    lipgloss.Style
	// contains filtered or unexported fields
}

Theme holds the Lip Gloss color palette and reusable component styles for iserv-cli.

func DefaultTheme

func DefaultTheme() Theme

DefaultTheme builds the default Catppuccin Mocha palette.

func ThemeByName

func ThemeByName(name string) Theme

ThemeByName returns either "Catppuccin" (Mocha, default) or "Dracula".

func (Theme) HeroTile

func (t Theme) HeroTile(bg lipgloss.Color) lipgloss.Style

HeroTile returns a compact 3-line hero badge tile style.

func (Theme) SelectedChipStyle

func (t Theme) SelectedChipStyle(fg lipgloss.Color) lipgloss.Style

SelectedChipStyle styles a selected chip (text-only color change in Catppuccin, filled pill in Dracula).

func (Theme) SelectedPrefixStyle

func (t Theme) SelectedPrefixStyle(fg lipgloss.Color) lipgloss.Style

SelectedPrefixStyle styles a selected row's leading icon/dot (text-only in Catppuccin, shaded in Dracula).

func (Theme) TabColor

func (t Theme) TabColor(tab Tab) lipgloss.Color

TabColor returns the cohesive palette accent color for each workspace tab.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL