tui

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 24 Imported by: 0

README

tui

The tui package contains all terminal user interface components built with the Bubble Tea framework. Each file implements a self-contained view or component following the Bubble Tea Model-View-Update (MVU) pattern.

Architecture

The TUI layer is the interactive frontend of Matcha. Each view implements the tea.Model interface (Init, Update, View) and communicates with other views through typed messages. The main application (main.go) orchestrates navigation between views by swapping the active model.

Views
File Description
inbox.go Email inbox list with multi-account tab support. Handles pagination, keyboard navigation, and renders email items with sender, subject, and date. Supports different mailbox types (inbox, sent, trash, archive) and both multi-account and single-account modes.
email_view.go Full email display in a scrollable viewport. Shows headers (from, to, subject, date), rendered body content, attachment list, and S/MIME verification status. Manages inline image rendering through out-of-band stdout writes.
composer.go Email composition form with fields for To, CC, BCC, Subject, and Body. Features contact autocomplete, file attachment picker, signature insertion, account selection dropdown, and draft auto-saving. Supports reply mode with pre-filled headers and quoted text.
drafts.go Draft email list view. Displays saved drafts with subject, recipient, and timestamp. Allows opening drafts in the composer or deleting them.
folder_inbox.go Folder navigation sidebar with an email list. Displays IMAP folders in a left panel and the selected folder's emails in the main area. Handles folder selection and email loading per folder.
trash_archive.go Combined trash and archive view with tab-based switching between the two. Shares the inbox component structure but targets trash/archive mailboxes.
login.go Account login form supporting Gmail, iCloud, and custom IMAP/SMTP providers. Collects credentials, server settings, and optionally S/MIME certificate paths. Validates input before submission.
settings.go Settings panel for managing accounts (add/remove), configuring mailing lists, editing signatures, toggling image display, managing tips visibility, and setting up S/MIME certificates.
mailing_list.go Editor for creating and modifying mailing list groups (name + comma-separated email addresses).
choice.go Main menu / start screen. Presents account selection, navigation to inbox, compose, drafts, sent, folders, trash/archive, and settings.
filepicker.go File browser for selecting email attachments. Navigates the filesystem with directory listing and file selection.
Supporting Files
File Description
styles.go Global Lip Gloss style definitions used across all views (dialog boxes, help text, tips, headings, body text). Also defines the Status component for spinner-based loading messages.
theme.go RebuildStyles function that updates all package-level style variables when the active theme changes, ensuring consistent colors across the UI.
messages.go Shared message types for inter-component communication: ViewEmailMsg, SendEmailMsg, Credentials, ChooseServiceMsg, EmailResultMsg, ClearStatusMsg, and the MailboxKind enum.
signature.go Textarea-based editor for composing and saving email signatures.
Test Files
File Description
inbox_test.go Tests for inbox rendering and behavior.
email_view_test.go Tests for email view rendering.
composer_test.go Tests for email composition logic.
trash_archive_test.go Tests for trash/archive view behavior.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DialogBoxStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(lipgloss.Color("#25A065")).
					Padding(1, 2).
					BorderTop(true).
					BorderLeft(true).
					BorderRight(true).
					BorderBottom(true)

	HelpStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
	TipStyle     = lipgloss.NewStyle().Foreground(lipgloss.Color("214")).Italic(true)
	SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).Bold(true)
	InfoStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).Bold(true)

	H1Style = lipgloss.NewStyle().
			Foreground(lipgloss.Color("42")).
			Bold(true).
			Align(lipgloss.Center)

	H2Style = lipgloss.NewStyle().
			Foreground(lipgloss.Color("42")).
			Bold(false).
			Align(lipgloss.Center)

	BodyStyle = lipgloss.NewStyle().
				Bold(true) // A bit bold
)
View Source
var DocStyle = lipgloss.NewStyle().Margin(1, 2)

Functions

func ClearKittyGraphics added in v0.21.1

func ClearKittyGraphics()

ClearKittyGraphics sends the Kitty graphics protocol delete command directly to stdout.

func RebuildStyles added in v0.24.0

func RebuildStyles()

RebuildStyles updates all package-level style variables to match the active theme. This must be called after theme.SetTheme() and at startup.

Types

type AccountAddedMsg added in v0.8.0

type AccountAddedMsg struct {
	AccountID string
	Err       error
}

AccountAddedMsg signals that an account was successfully added.

type AccountDeletedMsg added in v0.8.0

type AccountDeletedMsg struct {
	AccountID string
	Err       error
}

AccountDeletedMsg signals that an account was successfully deleted.

type AccountTab added in v0.8.0

type AccountTab struct {
	ID    string
	Label string
	Email string
}

AccountTab represents a tab for an account

type AddAccountMsg added in v0.8.0

type AddAccountMsg struct {
	Credentials Credentials
}

AddAccountMsg signals that a new account should be added.

type AllEmailsFetchedMsg added in v0.8.0

type AllEmailsFetchedMsg struct {
	EmailsByAccount map[string][]fetcher.Email
	Mailbox         MailboxKind
}

AllEmailsFetchedMsg signals that emails from all accounts have been fetched.

type ArchiveEmailMsg

type ArchiveEmailMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

type AttachmentDownloadedMsg

type AttachmentDownloadedMsg struct {
	Path string
	Err  error
}

type BackToInboxMsg

type BackToInboxMsg struct{}

type BackToMailboxMsg added in v0.10.0

type BackToMailboxMsg struct {
	Mailbox MailboxKind
}

type CachedEmailsLoadedMsg added in v0.8.0

type CachedEmailsLoadedMsg struct {
	Cache *config.EmailCache
}

CachedEmailsLoadedMsg signals that cached emails were loaded from disk.

type CancelFilePickerMsg

type CancelFilePickerMsg struct{}

type Choice

type Choice struct {
	UpdateAvailable bool
	LatestVersion   string
	CurrentVersion  string
	// contains filtered or unexported fields
}

func NewChoice

func NewChoice() Choice

func (Choice) Init

func (m Choice) Init() tea.Cmd

func (Choice) Update

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

func (Choice) View

func (m Choice) View() tea.View

type ChooseServiceMsg

type ChooseServiceMsg struct {
	Service string
}

type ClearStatusMsg

type ClearStatusMsg struct{}

type Composer

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

Composer model holds the state of the email composition UI.

func NewComposer

func NewComposer(from, to, subject, body string, hideTips bool) *Composer

NewComposer initializes a new composer model.

func NewComposerFromDraft added in v0.8.0

func NewComposerFromDraft(draft config.Draft, accounts []config.Account, hideTips bool) *Composer

NewComposerFromDraft creates a composer from an existing draft.

func NewComposerWithAccounts added in v0.8.0

func NewComposerWithAccounts(accounts []config.Account, selectedAccountID string, to, subject, body string, hideTips bool) *Composer

NewComposerWithAccounts initializes a composer with multiple account support.

func (*Composer) GetAttachmentPaths added in v0.21.0

func (m *Composer) GetAttachmentPaths() []string

GetAttachmentPaths returns the current attachment paths.

func (*Composer) GetBody added in v0.8.0

func (m *Composer) GetBody() string

GetBody returns the current Body field value.

func (*Composer) GetDraftID added in v0.8.0

func (m *Composer) GetDraftID() string

GetDraftID returns the draft ID for this composer.

func (*Composer) GetInReplyTo added in v0.8.0

func (m *Composer) GetInReplyTo() string

GetInReplyTo returns the In-Reply-To header value.

func (*Composer) GetQuotedText added in v0.13.5

func (m *Composer) GetQuotedText() string

GetQuotedText returns the hidden quoted text.

func (*Composer) GetReferences added in v0.8.0

func (m *Composer) GetReferences() []string

GetReferences returns the References header values.

func (*Composer) GetSelectedAccountID added in v0.8.0

func (m *Composer) GetSelectedAccountID() string

GetSelectedAccountID returns the ID of the currently selected account.

func (*Composer) GetSignature added in v0.15.0

func (m *Composer) GetSignature() string

GetSignature returns the current signature value.

func (*Composer) GetSubject added in v0.8.0

func (m *Composer) GetSubject() string

GetSubject returns the current Subject field value.

func (*Composer) GetTo added in v0.8.0

func (m *Composer) GetTo() string

GetTo returns the current To field value.

func (*Composer) Init

func (m *Composer) Init() tea.Cmd

func (*Composer) ResetConfirmation

func (m *Composer) ResetConfirmation()

ResetConfirmation ensures a restored draft isnt stuck in the exit prompt.

func (*Composer) SetAccounts added in v0.8.0

func (m *Composer) SetAccounts(accounts []config.Account)

SetAccounts sets the available accounts for sending.

func (*Composer) SetDraftID added in v0.8.0

func (m *Composer) SetDraftID(id string)

SetDraftID sets the draft ID (for loading existing drafts).

func (*Composer) SetQuotedText added in v0.13.5

func (m *Composer) SetQuotedText(text string)

SetQuotedText sets the hidden quoted text that will be appended when sending.

func (*Composer) SetReplyContext added in v0.8.0

func (m *Composer) SetReplyContext(inReplyTo string, references []string)

SetReplyContext sets the reply context for the draft.

func (*Composer) SetSelectedAccount added in v0.8.0

func (m *Composer) SetSelectedAccount(accountID string)

SetSelectedAccount sets the selected account by ID.

func (*Composer) ToDraft added in v0.8.0

func (m *Composer) ToDraft() config.Draft

ToDraft converts the composer state to a Draft for saving.

func (*Composer) Update

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

func (*Composer) View

func (m *Composer) View() tea.View

type Credentials

type Credentials struct {
	Provider   string
	Name       string
	Host       string // Host (this was the previous "Email Address" field in the UI)
	FetchEmail string // Single email address to fetch messages for. If empty, code should default this to Host when creating the account.
	Password   string
	IMAPServer string
	IMAPPort   int
	SMTPServer string
	SMTPPort   int
}

type DeleteAccountMsg added in v0.8.0

type DeleteAccountMsg struct {
	AccountID string
}

DeleteAccountMsg signals that an account should be deleted.

type DeleteEmailMsg

type DeleteEmailMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

type DeleteSavedDraftMsg added in v0.8.0

type DeleteSavedDraftMsg struct {
	DraftID string
}

DeleteDraftMsg signals that a draft should be deleted.

type DiscardDraftMsg

type DiscardDraftMsg struct {
	ComposerState *Composer
}

DiscardDraftMsg signals that a draft should be cached.

type DownloadAttachmentMsg

type DownloadAttachmentMsg struct {
	Index     int
	Filename  string
	PartID    string
	Data      []byte
	AccountID string
	Encoding  string
	Mailbox   MailboxKind
}

type DraftDeletedMsg added in v0.8.0

type DraftDeletedMsg struct {
	DraftID string
	Err     error
}

DraftDeletedMsg signals that a draft was deleted.

type DraftSavedMsg added in v0.8.0

type DraftSavedMsg struct {
	DraftID string
	Err     error
}

DraftSavedMsg signals that a draft was saved successfully.

type Drafts added in v0.8.0

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

Drafts is the model for the drafts list view

func NewDrafts added in v0.8.0

func NewDrafts(drafts []config.Draft) *Drafts

NewDrafts creates a new drafts list view

func (*Drafts) Init added in v0.8.0

func (m *Drafts) Init() tea.Cmd

func (*Drafts) SetDrafts added in v0.8.0

func (m *Drafts) SetDrafts(drafts []config.Draft)

SetDrafts updates the drafts list

func (*Drafts) Update added in v0.8.0

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

func (*Drafts) View added in v0.8.0

func (m *Drafts) View() tea.View

type DraftsLoadedMsg added in v0.8.0

type DraftsLoadedMsg struct {
	Drafts []config.Draft
}

DraftsLoadedMsg signals that drafts were loaded from disk.

type EmailActionDoneMsg

type EmailActionDoneMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
	Err       error
}

type EmailBodyFetchedMsg

type EmailBodyFetchedMsg struct {
	UID         uint32
	Body        string
	Attachments []fetcher.Attachment
	Err         error
	AccountID   string
	Mailbox     MailboxKind
}

type EmailMarkedReadMsg added in v0.26.0

type EmailMarkedReadMsg struct {
	UID       uint32
	AccountID string
	Err       error
}

EmailMarkedReadMsg signals that an email was marked as read.

type EmailMovedMsg added in v0.22.0

type EmailMovedMsg struct {
	UID          uint32
	AccountID    string
	SourceFolder string
	DestFolder   string
	Err          error
}

EmailMovedMsg signals that an email was moved to a folder.

type EmailResultMsg

type EmailResultMsg struct {
	Err error
}

type EmailView

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

func NewEmailView

func NewEmailView(email fetcher.Email, emailIndex, width, height int, mailbox MailboxKind, disableImages bool) *EmailView

func (*EmailView) GetAccountID added in v0.8.0

func (m *EmailView) GetAccountID() string

GetAccountID returns the account ID for this email

func (*EmailView) GetEmail added in v0.8.0

func (m *EmailView) GetEmail() fetcher.Email

GetEmail returns the email being viewed

func (*EmailView) Init

func (m *EmailView) Init() tea.Cmd

func (*EmailView) Update

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

func (*EmailView) View

func (m *EmailView) View() tea.View

type EmailsAppendedMsg

type EmailsAppendedMsg struct {
	Emails    []fetcher.Email
	AccountID string
	Mailbox   MailboxKind
}

type EmailsFetchedMsg

type EmailsFetchedMsg struct {
	Emails    []fetcher.Email
	AccountID string
	Mailbox   MailboxKind
}

type EmailsRefreshedMsg added in v0.8.0

type EmailsRefreshedMsg struct {
	EmailsByAccount map[string][]fetcher.Email
	Mailbox         MailboxKind
}

EmailsRefreshedMsg signals that fresh emails have been fetched in the background.

type FetchErr

type FetchErr error

type FetchFolderMoreEmailsMsg added in v0.22.0

type FetchFolderMoreEmailsMsg struct {
	Offset     uint32
	AccountID  string
	FolderName string
	Limit      uint32
}

FetchFolderMoreEmailsMsg signals a request to fetch more emails from a folder (pagination).

type FetchMoreEmailsMsg

type FetchMoreEmailsMsg struct {
	Offset    uint32
	AccountID string
	Mailbox   MailboxKind
	Limit     uint32
}

type FetchingMoreEmailsMsg

type FetchingMoreEmailsMsg struct{}

type FilePicker

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

func NewFilePicker

func NewFilePicker(startPath string) *FilePicker

func (*FilePicker) Init

func (m *FilePicker) Init() tea.Cmd

func (*FilePicker) Update

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

func (*FilePicker) View

func (m *FilePicker) View() tea.View

type FileSelectedMsg

type FileSelectedMsg struct {
	Path string
}

type FolderEmailsAppendedMsg added in v0.22.0

type FolderEmailsAppendedMsg struct {
	Emails     []fetcher.Email
	AccountID  string
	FolderName string
}

FolderEmailsAppendedMsg signals that more emails from a folder have been fetched (pagination).

type FolderEmailsFetchedMsg added in v0.22.0

type FolderEmailsFetchedMsg struct {
	Emails     []fetcher.Email
	AccountID  string
	FolderName string
}

FolderEmailsFetchedMsg signals that emails from a folder have been fetched.

type FolderInbox added in v0.22.0

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

FolderInbox combines a folder sidebar with an email list.

func NewFolderInbox added in v0.22.0

func NewFolderInbox(folders []string, accounts []config.Account) *FolderInbox

NewFolderInbox creates a new FolderInbox with the given folders and accounts.

func (*FolderInbox) AdditionalShortHelpKeys added in v0.22.0

func (m *FolderInbox) AdditionalShortHelpKeys() []key.Binding

AdditionalShortHelpKeys returns help key bindings for the folder inbox.

func (*FolderInbox) GetAccounts added in v0.22.0

func (m *FolderInbox) GetAccounts() []config.Account

GetAccounts returns the accounts.

func (*FolderInbox) GetCurrentFolder added in v0.22.0

func (m *FolderInbox) GetCurrentFolder() string

GetCurrentFolder returns the currently selected folder name.

func (*FolderInbox) GetFolders added in v0.22.0

func (m *FolderInbox) GetFolders() []string

GetFolders returns the current folder list.

func (*FolderInbox) GetInbox added in v0.22.0

func (m *FolderInbox) GetInbox() *Inbox

GetInbox returns the embedded inbox.

func (*FolderInbox) Init added in v0.22.0

func (m *FolderInbox) Init() tea.Cmd

func (*FolderInbox) RemoveEmail added in v0.22.0

func (m *FolderInbox) RemoveEmail(uid uint32, accountID string)

RemoveEmail removes an email from the embedded inbox.

func (*FolderInbox) SetEmails added in v0.22.0

func (m *FolderInbox) SetEmails(emails []fetcher.Email, accounts []config.Account)

SetEmails updates the inbox emails.

func (*FolderInbox) SetFolders added in v0.22.0

func (m *FolderInbox) SetFolders(folders []string)

SetFolders updates the folder list.

func (*FolderInbox) SetLoadingEmails added in v0.22.0

func (m *FolderInbox) SetLoadingEmails(loading bool)

SetLoadingEmails sets the loading state.

func (*FolderInbox) SetRefreshing added in v0.23.1

func (m *FolderInbox) SetRefreshing(refreshing bool)

SetRefreshing sets the refreshing state (used when user presses "r").

func (*FolderInbox) Update added in v0.22.0

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

func (*FolderInbox) View added in v0.22.0

func (m *FolderInbox) View() tea.View

type FoldersFetchedMsg added in v0.22.0

type FoldersFetchedMsg struct {
	FoldersByAccount map[string][]fetcher.Folder // accountID -> folders
	MergedFolders    []fetcher.Folder            // unique folders across all accounts
}

FoldersFetchedMsg signals that IMAP folders have been fetched for all accounts.

type ForwardEmailMsg added in v0.17.0

type ForwardEmailMsg struct {
	Email fetcher.Email
}

type GoToAccountListMsg added in v0.8.0

type GoToAccountListMsg struct{}

GoToAccountListMsg signals navigation to the account list in settings.

type GoToAddAccountMsg added in v0.8.0

type GoToAddAccountMsg struct{}

GoToAddAccountMsg signals navigation to the add account screen.

type GoToAddMailingListMsg added in v0.20.0

type GoToAddMailingListMsg struct{}

GoToAddMailingListMsg signals navigation to the add mailing list screen.

type GoToChoiceMenuMsg

type GoToChoiceMenuMsg struct{}

type GoToDraftsMsg added in v0.8.0

type GoToDraftsMsg struct{}

GoToDraftsMsg signals navigation to the drafts list.

type GoToEditAccountMsg added in v0.26.0

type GoToEditAccountMsg struct {
	AccountID  string
	Provider   string
	Name       string
	Email      string
	FetchEmail string
	IMAPServer string
	IMAPPort   int
	SMTPServer string
	SMTPPort   int
}

GoToEditAccountMsg signals navigation to edit an existing account.

type GoToEditMailingListMsg added in v0.26.0

type GoToEditMailingListMsg struct {
	Index     int
	Name      string
	Addresses string
}

GoToEditMailingListMsg signals navigation to edit an existing mailing list.

type GoToFilePickerMsg

type GoToFilePickerMsg struct{}

type GoToInboxMsg

type GoToInboxMsg struct{}

type GoToSendMsg

type GoToSendMsg struct {
	To      string
	Subject string
	Body    string
}

type GoToSentInboxMsg added in v0.10.0

type GoToSentInboxMsg struct{}

type GoToSettingsMsg

type GoToSettingsMsg struct{}

type GoToSignatureEditorMsg added in v0.15.0

type GoToSignatureEditorMsg struct{}

type GoToTrashArchiveMsg added in v0.16.0

type GoToTrashArchiveMsg struct{}

type Inbox

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

func NewArchiveInbox added in v0.16.0

func NewArchiveInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func NewInbox

func NewInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func NewInboxSingleAccount added in v0.8.0

func NewInboxSingleAccount(emails []fetcher.Email) *Inbox

NewInboxSingleAccount creates an inbox for a single account (legacy support)

func NewInboxWithMailbox added in v0.10.0

func NewInboxWithMailbox(emails []fetcher.Email, accounts []config.Account, mailbox MailboxKind) *Inbox

func NewSentInbox added in v0.10.0

func NewSentInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func NewTrashInbox added in v0.16.0

func NewTrashInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func (*Inbox) GetCurrentAccountID added in v0.8.0

func (m *Inbox) GetCurrentAccountID() string

GetCurrentAccountID returns the currently selected account ID

func (*Inbox) GetEmailAtIndex added in v0.8.0

func (m *Inbox) GetEmailAtIndex(index int) *fetcher.Email

GetEmailAtIndex returns the email at the given index for the current view

func (*Inbox) GetMailbox added in v0.10.0

func (m *Inbox) GetMailbox() MailboxKind

func (*Inbox) Init

func (m *Inbox) Init() tea.Cmd

func (*Inbox) MarkEmailAsRead added in v0.26.0

func (m *Inbox) MarkEmailAsRead(uid uint32, accountID string)

MarkEmailAsRead marks an email as read by UID and account ID, updating it in all stores.

func (*Inbox) RemoveEmail added in v0.8.0

func (m *Inbox) RemoveEmail(uid uint32, accountID string)

RemoveEmail removes an email by UID and account ID

func (*Inbox) SetEmails added in v0.8.0

func (m *Inbox) SetEmails(emails []fetcher.Email, accounts []config.Account)

SetEmails updates all emails (used after fetch)

func (*Inbox) SetFolderName added in v0.22.0

func (m *Inbox) SetFolderName(name string)

SetFolderName sets a custom folder name for the inbox title.

func (*Inbox) SetSize added in v0.22.0

func (m *Inbox) SetSize(width, height int)

SetSize sets the width and height of the inbox, then updates the list.

func (*Inbox) Update

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

func (*Inbox) View

func (m *Inbox) View() tea.View

type LoadDraftsMsg added in v0.8.0

type LoadDraftsMsg struct{}

LoadDraftsMsg signals a request to load all saved drafts.

type Login

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

Login holds the state for the login/add account form.

func NewLogin

func NewLogin(hideTips bool) *Login

NewLogin creates a new login model for adding accounts.

func (*Login) GetAccountID added in v0.8.0

func (m *Login) GetAccountID() string

GetAccountID returns the account ID being edited (if in edit mode).

func (*Login) Init

func (m *Login) Init() tea.Cmd

Init initializes the login model.

func (*Login) IsEditMode added in v0.8.0

func (m *Login) IsEditMode() bool

IsEditMode returns whether the form is in edit mode.

func (*Login) SetEditMode added in v0.8.0

func (m *Login) SetEditMode(accountID, provider, name, email, fetchEmail, imapServer string, imapPort int, smtpServer string, smtpPort int)

SetEditMode sets the login form to edit an existing account.

func (*Login) Update

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

Update handles messages for the login model.

func (*Login) View

func (m *Login) View() tea.View

View renders the login form.

type MailboxKind added in v0.10.0

type MailboxKind string
const (
	MailboxInbox   MailboxKind = "inbox"
	MailboxSent    MailboxKind = "sent"
	MailboxTrash   MailboxKind = "trash"
	MailboxArchive MailboxKind = "archive"
)

type MailingListEditor added in v0.20.0

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

MailingListEditor displays the screen to add or edit a mailing list.

func NewMailingListEditor added in v0.20.0

func NewMailingListEditor() *MailingListEditor

NewMailingListEditor creates a new mailing list editor model.

func (*MailingListEditor) Init added in v0.20.0

func (m *MailingListEditor) Init() tea.Cmd

Init initializes the mailing list editor model.

func (*MailingListEditor) SetEditMode added in v0.26.0

func (m *MailingListEditor) SetEditMode(index int, name, addresses string)

SetEditMode sets the editor to edit an existing mailing list.

func (*MailingListEditor) Update added in v0.20.0

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

Update handles messages for the mailing list editor model.

func (*MailingListEditor) View added in v0.20.0

func (m *MailingListEditor) View() tea.View

View renders the mailing list editor screen.

type MarkEmailAsReadMsg added in v0.26.0

type MarkEmailAsReadMsg struct {
	UID        uint32
	AccountID  string
	FolderName string
}

MarkEmailAsReadMsg signals that an email should be marked as read on the server.

type MoveEmailMsg added in v0.22.0

type MoveEmailMsg struct {
	UID          uint32
	AccountID    string
	SourceFolder string
}

MoveEmailMsg signals a request to show the move-to-folder picker.

type MoveEmailToFolderMsg added in v0.22.0

type MoveEmailToFolderMsg struct {
	UID          uint32
	AccountID    string
	SourceFolder string
	DestFolder   string
}

MoveEmailToFolderMsg signals that an email should be moved to a folder.

type OpenDraftMsg added in v0.8.0

type OpenDraftMsg struct {
	Draft config.Draft
}

OpenDraftMsg signals that a specific draft should be opened in the composer.

type RefreshingEmailsMsg added in v0.8.0

type RefreshingEmailsMsg struct {
	Mailbox MailboxKind
}

RefreshingEmailsMsg signals that a background refresh is in progress.

type ReplyToEmailMsg

type ReplyToEmailMsg struct {
	Email fetcher.Email
}

type RequestRefreshMsg added in v0.13.0

type RequestRefreshMsg struct {
	Mailbox    MailboxKind
	Counts     map[string]int
	FolderName string
}

RequestRefreshMsg signals a request to refresh emails from the server.

type RestoreViewMsg

type RestoreViewMsg struct{}

type SaveDraftMsg added in v0.8.0

type SaveDraftMsg struct {
	Draft config.Draft
}

SaveDraftMsg signals that the current draft should be saved to disk.

type SaveMailingListMsg added in v0.20.0

type SaveMailingListMsg struct {
	Name      string
	Addresses string
	EditIndex int // -1 means new, >= 0 means editing existing
}

SaveMailingListMsg signals that a new or edited mailing list should be saved.

type SendEmailMsg

type SendEmailMsg struct {
	To              string
	Cc              string // Cc recipient(s)
	Bcc             string // Bcc recipient(s)
	Subject         string
	Body            string
	AttachmentPaths []string
	InReplyTo       string
	References      []string
	AccountID       string // ID of the account to send from
	QuotedText      string // Hidden quoted text appended when sending
	Signature       string // Signature to append to email body
	SignSMIME       bool   // Whether to sign the email using S/MIME
	EncryptSMIME    bool   // Whether to encrypt the email using S/MIME
}

type SetComposerCursorToStartMsg

type SetComposerCursorToStartMsg struct{}

type Settings added in v0.8.0

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

Settings displays the settings screen.

func NewSettings added in v0.8.0

func NewSettings(cfg *config.Config) *Settings

NewSettings creates a new settings model.

func (*Settings) Init added in v0.8.0

func (m *Settings) Init() tea.Cmd

Init initializes the settings model.

func (*Settings) Update added in v0.8.0

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

Update handles messages for the settings model.

func (*Settings) UpdateConfig added in v0.18.0

func (m *Settings) UpdateConfig(cfg *config.Config)

UpdateConfig updates the configuration (used when accounts are deleted).

func (*Settings) View added in v0.8.0

func (m *Settings) View() tea.View

View renders the settings screen.

type SettingsState added in v0.18.0

type SettingsState int
const (
	SettingsMain SettingsState = iota
	SettingsAccounts
	SettingsMailingLists
	SettingsSMIMEConfig
	SettingsTheme
)

type SignatureEditor added in v0.15.0

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

SignatureEditor displays the signature editing screen.

func NewSignatureEditor added in v0.15.0

func NewSignatureEditor() *SignatureEditor

NewSignatureEditor creates a new signature editor model.

func (*SignatureEditor) Init added in v0.15.0

func (m *SignatureEditor) Init() tea.Cmd

Init initializes the signature editor model.

func (*SignatureEditor) Update added in v0.15.0

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

Update handles messages for the signature editor model.

func (*SignatureEditor) View added in v0.15.0

func (m *SignatureEditor) View() tea.View

View renders the signature editor screen.

type Status

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

A simple model for showing a status message

func NewStatus

func NewStatus(msg string) Status

func (Status) Init

func (m Status) Init() tea.Cmd

func (Status) Update

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

func (Status) View

func (m Status) View() tea.View

type SwitchAccountMsg added in v0.8.0

type SwitchAccountMsg struct {
	AccountID string // Empty string means "ALL" accounts
}

SwitchAccountMsg signals switching to view a specific account's inbox.

type SwitchFolderMsg added in v0.22.0

type SwitchFolderMsg struct {
	FolderName string
	AccountID  string
}

SwitchFolderMsg signals switching to a different IMAP folder.

type SwitchFromAccountMsg added in v0.8.0

type SwitchFromAccountMsg struct {
	AccountID string
}

SwitchFromAccountMsg signals changing the "From" account in composer.

type TrashArchive added in v0.16.0

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

TrashArchive is a combined view for trash and archive emails with a toggle

func NewTrashArchive added in v0.16.0

func NewTrashArchive(trashEmails, archiveEmails []fetcher.Email, accounts []config.Account) *TrashArchive

NewTrashArchive creates a new combined trash/archive view

func (*TrashArchive) AdditionalShortHelpKeys added in v0.16.0

func (m *TrashArchive) AdditionalShortHelpKeys() []key.Binding

AdditionalShortHelpKeys returns additional help keys for the trash/archive view

func (*TrashArchive) GetActiveInbox added in v0.16.0

func (m *TrashArchive) GetActiveInbox() *Inbox

GetActiveInbox returns the currently active inbox

func (*TrashArchive) GetActiveMailbox added in v0.16.0

func (m *TrashArchive) GetActiveMailbox() MailboxKind

GetActiveMailbox returns the currently active mailbox kind

func (*TrashArchive) Init added in v0.16.0

func (m *TrashArchive) Init() tea.Cmd

func (*TrashArchive) RemoveEmail added in v0.16.0

func (m *TrashArchive) RemoveEmail(uid uint32, accountID string, mailbox MailboxKind)

RemoveEmail removes an email from the appropriate inbox

func (*TrashArchive) SetArchiveEmails added in v0.16.0

func (m *TrashArchive) SetArchiveEmails(emails []fetcher.Email, accounts []config.Account)

SetArchiveEmails updates the archive emails

func (*TrashArchive) SetTrashEmails added in v0.16.0

func (m *TrashArchive) SetTrashEmails(emails []fetcher.Email, accounts []config.Account)

SetTrashEmails updates the trash emails

func (*TrashArchive) Update added in v0.16.0

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

func (*TrashArchive) View added in v0.16.0

func (m *TrashArchive) View() tea.View

type ViewEmailMsg

type ViewEmailMsg struct {
	Index     int
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

Jump to

Keyboard shortcuts

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