Skip to main content

ScxcliBackend

Struct ScxcliBackend 

Source
pub(crate) struct ScxcliBackend {
    root: bool,
    scxcli: PathBuf,
}

Fields§

§root: bool§scxcli: PathBuf

The absolute path scxcli resolved to, passed as such to pkexec: polkit matches the action on the program’s path, so the name is resolved here, once, in the trusted search path, not by pkexec against whatever PATH it has.

Implementations§

Source§

impl ScxcliBackend

Source

pub fn connect() -> Result<Self>

Checks that scxcli is installed, so startup fails fast with a plain message instead of the first key press.

Source

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

A warning for startup when scxcli is not where the policy expects it, since every privileged action then prompts.

Source

fn privileged(&self, args: &[&str]) -> Result<Command>

A privileged scxcli command: direct as root, else via pkexec. Both are resolved in systemd’s default search path, not scxtui’s PATH.

Source

fn write(&self, args: &[&str]) -> Result<String>

Trait Implementations§

Source§

impl Backend for ScxcliBackend

Source§

fn label(&self) -> String

Short description for the header line.
Source§

fn list(&self) -> Result<Listing>

scxcli list --json.
Source§

fn start(&self, id: &str) -> Result<String>

scxcli start ID: default, or a scheduler by name with its defaults. Returns scxcli’s one-line report; the state comes back through Self::list.
Source§

fn run(&self, sched: &str, args: &[String]) -> Result<String>

scxcli run SCHED ARGS....
Source§

fn stop(&self) -> Result<String>

scxcli stop: the unit stops, the selection stays.
Source§

fn escalates(&self) -> bool

Whether the privileged commands go through pkexec, which may prompt on the terminal and so needs it handed over.

Auto Trait Implementations§

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.