Skip to main content

App

Struct App 

Source
pub struct App {
    pub tabs_meta: Vec<TabId>,
    pub active: usize,
    pub tabs: Vec<TabState>,
    pub tab_generation: u64,
    pub theme: Theme,
    pub last_refresh: DateTime<Utc>,
    pub quit: bool,
    pub settings: Option<SettingsState>,
}

Fields§

§tabs_meta: Vec<TabId>§active: usize§tabs: Vec<TabState>§tab_generation: u64

Monotonically increasing identity for a complete tab-set replacement. Background fetches carry this with their tab identity so results from a previous Settings reload cannot land in a new tab at the old index.

§theme: Theme§last_refresh: DateTime<Utc>§quit: bool§settings: Option<SettingsState>

When Some, the Settings overlay is open and consuming key events.

Implementations§

Source§

impl App

Source

pub fn new(tabs_meta: Vec<TabId>) -> Self

Source

pub fn with_theme(tabs_meta: Vec<TabId>, theme: Theme) -> Self

Like App::new but with an explicit theme. Lets tests build an App without reading the real Omarchy theme file ($HOME/.config/omarchy/current/theme/colors.toml) — new resolves that path and the $HOME env var via merged_with_omarchy, which is not hermetic. Production code uses new/new_with_primary.

Source

pub fn new_with_primary( tabs_meta: Vec<TabId>, primary: Option<VendorId>, ) -> Self

Construct with an initial active tab — usually [ui] primary from config. Silently falls through to index 0 if the requested vendor isn’t present (e.g. it was disabled).

Source

pub fn active_tab_id(&self) -> Option<&TabId>

Source

pub fn active_vendor(&self) -> Option<VendorId>

Source

pub fn set_tabs(&mut self, tabs_meta: Vec<TabId>)

Replace the tab set — used after a Settings save reloads config, so tabs added or removed in config.toml while the TUI is open (e.g. a new [[anthropic.accounts]] entry) appear without a restart. Every tab resets to Loading (the caller re-spawns fetches) and the selection is clamped in case the list shrank.

Source

pub fn apply_refresh( &mut self, generation: u64, tab: &TabId, state: TabState, ) -> bool

Apply an asynchronous refresh only when it still belongs to this tab generation and the captured tab identity still exists. Lookup by identity, rather than the old positional index, also makes a reordered tab list safe.

Source

pub fn select_primary(&mut self, primary: Option<VendorId>)

Move to the first tab of primary’s vendor (the default account tab, since it precedes any of that vendor’s account tabs).

Source

pub fn next_tab(&mut self)

Source

pub fn prev_tab(&mut self)

Trait Implementations§

Source§

impl Debug for App

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for App

§

impl RefUnwindSafe for App

§

impl Send for App

§

impl Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl UnwindSafe for App

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more