keys

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package keys centralises all keyboard bindings for the console TUI. Every binding lives here so:

  • The footer's bubbles/help component can auto-render hints from the active pane's KeyMap (no hand-maintained help strings).
  • Pane Update handlers use key.Matches(msg, binding) instead of stringly-typed key comparisons.
  • Re-keying is one-line edit.

Each pane exports a `KeyMap` struct that implements `help.KeyMap` (ShortHelp + FullHelp). `App` holds the cross-pane bindings and is composed into every pane's FullHelp so global shortcuts stay surfaced no matter where focus is.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppKeys

type AppKeys struct {
	NextPane     key.Binding
	PrevPane     key.Binding
	GoMonitor    key.Binding
	GoNewItem    key.Binding
	GoTeam       key.Binding
	GoConnection key.Binding
	ToggleHelp   key.Binding
	Quit         key.Binding
}

AppKeys are global bindings: pane-switching, help toggle, quit. Used by the root model (`app.go`) and surfaced in every pane's full help so the user always sees how to leave the current pane.

func NewAppKeys

func NewAppKeys() AppKeys

NewAppKeys returns the canonical app-level bindings. Plain `tab` is reserved for pane-internal navigation; pane switching uses `]` / `[` (vi-adjacent), `ctrl+tab` / `ctrl+shift+tab` (browser-adjacent), and the numeric `1` / `2` / `3` / `4` quick-jumps.

type ConnectionKeys

type ConnectionKeys struct {
	App     AppKeys
	Refresh key.Binding
}

ConnectionKeys covers the Connection pane: pane-local refresh of the external-services health checks plus the cross-pane app bindings.

func NewConnectionKeys

func NewConnectionKeys(app AppKeys) ConnectionKeys

NewConnectionKeys returns the Connection pane bindings.

func (ConnectionKeys) FullHelp

func (k ConnectionKeys) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (ConnectionKeys) ShortHelp

func (k ConnectionKeys) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type MonitorKeys

type MonitorKeys struct {
	FocusLeft    key.Binding
	FocusRight   key.Binding
	Up           key.Binding
	Down         key.Binding
	PageUp       key.Binding
	PageDown     key.Binding
	Top          key.Binding
	Bottom       key.Binding
	ToggleStream key.Binding
	ReverseOrder key.Binding
	ToggleDetail key.Binding
	App          AppKeys
}

MonitorKeys covers the Monitor pane: focus left/right, scroll the waterfall, toggle subscriptions on the stream list.

func NewMonitorKeys

func NewMonitorKeys(app AppKeys) MonitorKeys

NewMonitorKeys returns the Monitor pane's bindings.

func (MonitorKeys) FullHelp

func (k MonitorKeys) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (MonitorKeys) ShortHelp

func (k MonitorKeys) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type NewItemKeys

type NewItemKeys struct {
	NextField key.Binding
	PrevField key.Binding
	Submit    key.Binding
	Clear     key.Binding
	NewForm   key.Binding
	App       AppKeys
}

NewItemKeys covers the New Item form: tab between fields, submit, reset.

func NewNewItemKeys

func NewNewItemKeys(app AppKeys) NewItemKeys

NewNewItemKeys returns the New Item form bindings. Plain `tab` is kept inside the form here — the root model only consumes pane- switch keys (`]`, `[`, `1`/`2`/`3`) so this binding wins for in-form navigation.

func (NewItemKeys) FullHelp

func (k NewItemKeys) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (NewItemKeys) ShortHelp

func (k NewItemKeys) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type NewItemWatchingKeys

type NewItemWatchingKeys struct {
	NewForm key.Binding
	App     AppKeys
}

NewItemWatchingKeys covers the New Item pane after a successful items.create — the form is gone, the lifecycle card is up, and the only pane-local action is starting over with `n`. We surface a separate keymap for this state so the footer doesn't continue to advertise tab/shift+tab/enter/esc, none of which apply.

func NewNewItemWatchingKeys

func NewNewItemWatchingKeys(app AppKeys) NewItemWatchingKeys

NewNewItemWatchingKeys returns the watching-state bindings. `n` is the discoverable mnemonic; `esc` is the muscle-memory "go back" pair with the form-mode "esc clears" binding.

func (NewItemWatchingKeys) FullHelp

func (k NewItemWatchingKeys) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (NewItemWatchingKeys) ShortHelp

func (k NewItemWatchingKeys) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type TeamKeys

type TeamKeys struct {
	App     AppKeys
	Up      key.Binding
	Down    key.Binding
	Set     key.Binding
	Refresh key.Binding
}

TeamKeys covers the Teams pane: cursor up/down through the memberships table, set-as-active on `enter` (single press; the cursor's deliberate placement makes a separate confirm step redundant), and refresh-list (`r`). Pane switching is handled at the root.

func NewTeamKeys

func NewTeamKeys(app AppKeys) TeamKeys

NewTeamKeys returns the Teams pane bindings.

func (TeamKeys) FullHelp

func (k TeamKeys) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (TeamKeys) ShortHelp

func (k TeamKeys) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

Jump to

Keyboard shortcuts

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