ApplicationEntry

Struct ApplicationEntry 

Source
pub struct ApplicationEntry { /* private fields */ }

Implementations§

Source§

impl ApplicationEntry

Source

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

Get the application name

Source

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

Get the desktop file ID according to the freedesktop specification

The desktop file ID is computed by making the file path relative to the XDG_DATA_DIRS component, removing “applications/” prefix, and converting ‘/’ to ‘-’. For example: /usr/share/applications/foo/bar.desktop → foo-bar.desktop

Source

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

Get the executable command

Source

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

Get the icon name or path

Source

pub fn get_string(&self, key: &str) -> Option<String>

Get a string value from the Desktop Entry group

Source

pub fn get_localized_string( &self, key: &str, locale: Option<&str>, ) -> Option<String>

Get a localized string value from the Desktop Entry group

Source

pub fn get_bool(&self, key: &str) -> Option<bool>

Get a boolean value from the Desktop Entry group

Source

pub fn get_numeric(&self, key: &str) -> Option<f64>

Get a numeric value from the Desktop Entry group

Source

pub fn get_vec(&self, key: &str) -> Option<Vec<String>>

Get a vector of strings from the Desktop Entry group

Source

pub fn path(&self) -> &Path

Get the file path of this desktop entry

Source

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

Get the entry type (Application, Link, Directory)

Source

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

Get generic name (e.g., “Web Browser”)

Source

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

Get comment/description

Source

pub fn should_show(&self) -> bool

Source

pub fn is_hidden(&self) -> bool

Check if entry should be hidden

Source

pub fn no_display(&self) -> bool

Check if entry should not be displayed in menus

Source

pub fn mime_types(&self) -> Option<Vec<String>>

Get supported MIME types

Source

pub fn categories(&self) -> Option<Vec<String>>

Get categories

Source

pub fn keywords(&self) -> Option<Vec<String>>

Get keywords for searching

Source

pub fn terminal(&self) -> bool

Check if application runs in terminal

Source

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

Get working directory

Source

pub fn execute(&self) -> Result<(), ExecuteError>

Execute this application with no files

Source

pub fn execute_with_files(&self, files: &[&str]) -> Result<(), ExecuteError>

Execute this application with the given files

Source

pub fn execute_with_urls(&self, urls: &[&str]) -> Result<(), ExecuteError>

Execute this application with the given URLs

Source

pub fn prepare_command( &self, files: &[&str], urls: &[&str], ) -> Result<(String, Vec<String>), ExecuteError>

Prepare the command for execution without actually executing it (for testing)

Source§

impl ApplicationEntry

Source

pub fn all() -> Vec<ApplicationEntry>

Get all application entries from standard directories

Source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>

Create an ApplicationEntry from a path

Source

pub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>

Try to create an ApplicationEntry from a path, returning Result

Source

pub fn from_id(id: &str) -> Result<Self, FindError>

Find an ApplicationEntry by its desktop file ID

The desktop file ID follows the freedesktop specification format. For example: “foo-bar.desktop” would look for files like:

  • /usr/share/applications/foo/bar.desktop
  • /usr/share/applications/foo-bar.desktop

Trait Implementations§

Source§

impl Debug for ApplicationEntry

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ApplicationEntry

Source§

fn default() -> ApplicationEntry

Returns the “default value” for a type. Read more

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, 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.