topbar

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package topbar renders the frame's top chrome row: the app mark, the folder tabs, and the connection group with a clock.

The folder tabs move here from the chat list. Selection and key handling stay in chatlist — this package only draws — so the tabs can leave the list's 38-cell column without the folder keymap changing at all.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnState

type ConnState int

ConnState is the connection dot's meaning.

const (
	Disconnected ConnState = iota
	Connecting
	Connected
)

type Folder

type Folder struct {
	Name   string
	Active bool
}

Folder is one tab: a display name and whether it is the active one.

type Model

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

Model is the top bar.

func New

func New(roles theme.Roles) Model

func (*Model) SetClock

func (m *Model) SetClock(s string)

func (*Model) SetConnection

func (m *Model) SetConnection(state ConnState, status string)

SetConnection sets the dot and its description together, so the two can never disagree about whether the client is connected.

func (*Model) SetDevices

func (m *Model) SetDevices(n int)

SetDevices sets the authorised-session count. Zero means "unknown" and drops the cell.

func (*Model) SetFolders

func (m *Model) SetFolders(f []Folder)

func (*Model) SetWidth

func (m *Model) SetWidth(w int)

func (Model) TabAt

func (m Model) TabAt(x int) int

TabAt returns the index of the folder tab drawn at column x, or -1.

It recomputes the same spans View lays out rather than remembering them, so the hit-test cannot drift from the drawing: any change to the tab layout has to be made in tabSpans, which both callers go through.

func (Model) View

func (m Model) View() string

View renders the row at exactly the configured width.

The right group degrades from the left as space runs out: the status description truncates first, then the device count is dropped, then the transport. The clock is never dropped — it is the one thing on the row that is useful when everything else has been cut.

Jump to

Keyboard shortcuts

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