Skip to main content

App

Struct App 

Source
pub(crate) struct App {
Show 20 fields backend: Box<dyn Backend>, pub listing: Option<Listing>, pub listing_error: Option<String>, pub kernel: Option<KernelState>, read_kernel: Box<dyn Fn() -> Option<KernelState>>, kernel_disputed: bool, watcher: Option<Watcher>, pub selected: usize, pub sched_selected: usize, pub args: Option<Input>, pub all_warned: bool, pub message: Option<Message>, last_action: Option<Instant>, pub view: View, pub log_previous_boot: bool, pub log_lines: Vec<LogLine>, pub log_scroll: usize, pub log_page: usize, pending_action: Option<PendingAction>, should_quit: bool,
}

Fields§

§backend: Box<dyn Backend>§listing: Option<Listing>

Last successful listing. Stays None after a failed read, with the failure in listing_error, so the panel shows “unknown” plus the reason instead of a stale snapshot.

§listing_error: Option<String>§kernel: Option<KernelState>

The kernel’s own view, re-read every tick.

§read_kernel: Box<dyn Fn() -> Option<KernelState>>§kernel_disputed: bool§watcher: Option<Watcher>§selected: usize§sched_selected: usize§args: Option<Input>

The options field of the full list, when open. While it is open it owns every key press, so global shortcuts cannot fire from typed text.

§all_warned: bool

The full list’s warning is shown once per session.

§message: Option<Message>§last_action: Option<Instant>§view: View§log_previous_boot: bool§log_lines: Vec<LogLine>§log_scroll: usize§log_page: usize§pending_action: Option<PendingAction>§should_quit: bool

Implementations§

Source§

impl App

Source

pub fn new(backend: Box<dyn Backend>) -> Self

Source

pub fn backend_label(&self) -> String

Source

pub fn recommended(&self) -> &[Pick]

Source

pub fn all(&self) -> &[Installed]

Source

pub fn selected_pick(&self) -> Option<&Pick>

Source

pub fn selected_scheduler(&self) -> Option<&Installed>

Source

pub fn run(&mut self, terminal: DefaultTerminal) -> Result<()>

Source

fn start_watching(&mut self)

Source

fn run_monitor(&mut self, terminal: &mut DefaultTerminal) -> Result<()>

Hands the terminal over to scxtop and takes it back afterwards.

Source

fn queue(&mut self, action: PendingAction)

Source

fn privileged( &mut self, terminal: &mut DefaultTerminal, call: impl FnOnce(&dyn Backend) -> Result<String>, ) -> Result<Result<String>>

Runs a privileged scxcli command. When it goes through pkexec the terminal is handed over for the duration, because pkexec may prompt for a password on it (a text agent when the session has no graphical one); with the shipped policy starting a scheduler from the list prompts for nothing and the hand-over is a flicker.

Source

fn run_action( &mut self, action: PendingAction, terminal: &mut DefaultTerminal, ) -> Result<()>

Source

fn on_key(&mut self, key: KeyEvent)

Source

fn on_key_args(&mut self, key: KeyEvent)

Source

fn submit_args(&mut self)

Source

fn on_key_all(&mut self, key: KeyEvent)

Source

fn on_key_logs(&mut self, key: KeyEvent)

Source

fn open_all(&mut self)

Source

fn open_logs(&mut self)

Source

fn reload_logs(&mut self)

Source

fn sync_selection_to_running(&mut self)

Aligns the selections with what runs, so the first Enter acts on what the user sees. Only on startup, never on a refresh, which must not fight the user’s own selection.

Source

fn action_allowed(&mut self) -> bool

Source

fn start_selected_pick(&mut self)

Enter in the recommended list: scxcli start ID. The same call whether the entry is stopped, failed or running something else; scxcli rewrites the file and restarts the unit either way.

Source

fn stop_running(&mut self)

s: stop the unit and keep the selection, so it comes back on the next start or boot. Not start default, which forgets it.

Source

fn refresh(&mut self)

A failed read clears the snapshot and records why.

Source

pub fn kernel_warning(&self) -> Option<String>

The panel’s warning; the event loop reuses it as a tripwire.

Source

fn reconcile_kernel_dispute(&mut self) -> bool

Edge-triggered: re-asks once per new dispute.

Source

pub fn warn(&mut self, text: &str)

An error-styled message that stays until replaced, for a condition found before the loop starts.

Source

fn info(&mut self, text: &str)

Source

fn error(&mut self, text: &str)

Auto Trait Implementations§

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl !UnwindSafe for App

§

impl Freeze for App

§

impl Unpin for App

§

impl UnsafeUnpin 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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.