pub struct DesktopApp {
pub id: String,
pub name: String,
pub exec: String,
pub terminal: bool,
pub mime_types: Vec<String>,
pub path: PathBuf,
pub icon: Option<String>,
}Expand description
A program, as its desktop entry describes it.
Fields§
§id: StringThe desktop file id (org.gnome.TextEditor.desktop): the entry’s path below
applications, folders joined with -. mimeapps.list names programs by it.
name: StringThe program’s name in the person’s language when the entry has one.
exec: StringThe Exec line, with the key file’s escapes resolved.
terminal: boolWhether the program runs inside a terminal.
mime_types: Vec<String>The kinds the program says it opens.
path: PathBufWhere the desktop entry is.
icon: Option<String>The program’s icon name, when it has one.
Implementations§
Source§impl DesktopApp
impl DesktopApp
Source§impl DesktopApp
impl DesktopApp
Sourcepub fn can_start(&self, graphical: bool) -> bool
pub fn can_start(&self, graphical: bool) -> bool
Whether this program can start here: a terminal program always can, a graphical one only
in a graphical session (see graphical_session). A menu shows the others dimmed.
Sourcepub fn launch<Msg: Send + 'static>(
&self,
file: &Path,
graphical: bool,
on_done: impl FnOnce(Launched) -> Msg + Send + 'static,
) -> Result<Command<Msg>, LaunchError>
pub fn launch<Msg: Send + 'static>( &self, file: &Path, graphical: bool, on_done: impl FnOnce(Launched) -> Msg + Send + 'static, ) -> Result<Command<Msg>, LaunchError>
The command that opens file with this program, delivering on_done with how it ended.
A terminal program (Terminal=true) goes through a Handoff: the application steps
aside, the program owns the terminal, and the screen comes back when it ends. A graphical
one goes through Open::program and starts quietly beside the application. graphical
says whether there is a graphical session; without one a graphical program is refused
instead of tried. The arguments are those of DesktopApp::command, so no shell is
involved.
Either way the program runs in the file’s folder, as desktop file managers start it: relative paths, “Save as” and a shell opened from the program begin beside the file, not wherever the application happened to be started. A file given without a folder leaves the application’s own.
In a Harness nothing runs: the handoff or the opening is
recorded, and a test reads it, folder included, from handoffs() or opens().
§Errors
LaunchError::NoGraphicalSession for a graphical program without a graphical session,
LaunchError::NoCommand when the Exec line gives no command.
Trait Implementations§
Source§impl Clone for DesktopApp
impl Clone for DesktopApp
Source§impl Debug for DesktopApp
impl Debug for DesktopApp
impl Eq for DesktopApp
Source§impl PartialEq for DesktopApp
impl PartialEq for DesktopApp
impl StructuralPartialEq for DesktopApp
Auto Trait Implementations§
impl Freeze for DesktopApp
impl RefUnwindSafe for DesktopApp
impl Send for DesktopApp
impl Sync for DesktopApp
impl Unpin for DesktopApp
impl UnsafeUnpin for DesktopApp
impl UnwindSafe for DesktopApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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