Documentation
¶
Overview ¶
Package tui is kith's presentation layer: a Bubble Tea program that talks to the world only through api.Backend. The frame is a spaces rail, the room list for the selected rail group, and the timeline with its composer.
Index ¶
- Variables
- func EmojiCells(display config.Display) ([]string, error)
- func Run(ctx context.Context, opts RunOptions) error
- type Model
- func (m Model) Init() tea.Cmd
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() tea.View
- func (m Model) WithCache(cache *media.Cache) Model
- func (m Model) WithConfigFile(path string, cfg config.Config) Model
- func (m Model) WithFollow(uri string) Model
- func (m Model) WithKeys(keys config.Keys) Model
- func (m Model) WithLogger(log *slog.Logger) Model
- func (m Model) WithNotifications(n Notifications) Model
- func (m Model) WithRules(rules []notify.Rule, me string, on bool) Model
- func (m Model) WithSchedules(s Schedules) Model
- type Notifications
- type RunOptions
- type Schedules
Constants ¶
This section is empty.
Variables ¶
var ErrOpenedElsewhere = errors.New("kith was opened in another window")
ErrOpenedElsewhere is Run ending because another window took the seat.
Functions ¶
func EmojiCells ¶
EmojiCells is every cell the browser would draw for a display configuration, toned and presentation-reconciled. Exported for cmd/emoji-probe, which asks the terminal how wide each really is.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model driving the three-pane frame.
func (Model) Update ¶
Update routes a message to its handler, then runs the steps every state change needs (jumplist, derived cache, arming timers, quotes, inline pictures) once here rather than at each call site.
func (Model) View ¶
View renders the three-pane frame with a status line beneath it. It writes nothing shared. For the Model Update returned, the shared cache is final (primeTimeline, and TestViewLeavesTheSharedCacheAlone), so View only reads it; any other Model (an older copy, one built by hand) is laid out on a private scratch cache.
func (Model) WithConfigFile ¶
WithConfigFile sets where settings are written back and applies the config's integrations. Without a path, changes apply but are not saved.
func (Model) WithFollow ¶
WithFollow gives the model a link to follow as soon as it knows where it is.
func (Model) WithKeys ¶
WithKeys replaces the keymap with one built from config; config issues are reported on the status line and in help, never fatal.
func (Model) WithLogger ¶
WithCache gives the model a picture cache; without one it re-renders each time. WithLogger sets where failures are logged; the status line shows them briefly, the log keeps them. nil keeps the silent default.
func (Model) WithNotifications ¶
func (m Model) WithNotifications(n Notifications) Model
WithNotifications wires in the daemon's notification controls (do-not-disturb, config reload).
func (Model) WithRules ¶
WithRules sets the notification rules to describe (the badge) and our MXID. Delivery is the daemon's.
func (Model) WithSchedules ¶
WithSchedules wires in the send-later queue.
type Notifications ¶
type Notifications interface {
// SetDND puts one temporary rule in force. Every method returns the whole set
// afterwards.
SetDND(ctx context.Context, rule notify.Rule) (notify.Temps, error)
// ClearDND lifts the rule naming this place and person, ClearAllDND every one.
ClearDND(ctx context.Context, match, sender string) (notify.Temps, error)
ClearAllDND(ctx context.Context) (notify.Temps, error)
// DND reports the temporary rules in force.
DND(ctx context.Context) (notify.Temps, error)
// ReloadConfig asks the daemon to re-read the configuration file, returning the
// parse error when it will not load.
ReloadConfig(ctx context.Context) error
}
Notifications is the daemon's notification state, as much as the client acts on. Declared here because only daemon.Remote implements it.
type RunOptions ¶
type RunOptions struct {
Backend api.Backend
// Notifications and Schedules are daemon-only services, not api.Backend roles.
Notifications Notifications
Schedules Schedules
Config config.Config
// ConfigPath is where in-app setting changes are written.
ConfigPath string
// Me is the logged-in MXID.
Me string
// Log is the client's log (a file: the terminal is the program's).
Log *slog.Logger
// Follow is a matrix URI to open at start, or "".
Follow string
}
RunOptions is what the program runs with.
type Schedules ¶
type Schedules interface {
// Schedule queues a message, returning the handle that cancels it.
Schedule(ctx context.Context, msg domain.ScheduledMessage) (string, error)
// ScheduledMessages is the whole queue, every room, soonest first.
ScheduledMessages(ctx context.Context) ([]domain.ScheduledMessage, error)
// CancelScheduled drops one pending message.
CancelScheduled(ctx context.Context, id string) error
}
Schedules queues messages written now and sent later. Declared here rather than in internal/api because only the daemon (daemon.Remote) can implement it: a message sent only while the client is open is not scheduled, just late.
Source Files
¶
- activity.go
- apply.go
- assist.go
- attach.go
- attached.go
- autocorrect.go
- clipboard.go
- codes.go
- command.go
- commands.go
- completion.go
- completionmodel.go
- compose.go
- context.go
- cow.go
- create.go
- cursor.go
- days.go
- deleted.go
- derived.go
- dictionaries.go
- direction.go
- dnd.go
- draft.go
- edit.go
- editor.go
- emoji.go
- emoji_generated.go
- emojiorder.go
- emojipalette.go
- externaledit.go
- follow.go
- history.go
- identity.go
- inventory.go
- jump.go
- jumplist.go
- keychord.go
- keymap.go
- layout.go
- media.go
- mediapolicy.go
- membership.go
- model.go
- mouse.go
- openfile.go
- people.go
- picker.go
- player.go
- program.go
- prompt.go
- quotes.go
- rail.go
- read.go
- reader.go
- readpolicy.go
- redact.go
- refusals.go
- richrow.go
- roomorder.go
- roomrows.go
- rules.go
- runcmd.go
- schedule.go
- script.go
- search.go
- searchkind.go
- seat.go
- settings.go
- skintone.go
- slash.go
- spaces.go
- spam.go
- spell.go
- spellwalk.go
- spoiler.go
- star.go
- status.go
- text.go
- text_bidi.go
- threadname.go
- threads.go
- topic.go
- tracked.go
- unsaved.go
- video.go
- view.go
- view_composer.go
- view_help.go
- view_message.go
- view_rail.go
- view_search.go
- view_status.go
- view_timeline.go
- viewer.go
- why.go