pub struct ApplicationEntry { /* private fields */ }
Implementations§
Source§impl ApplicationEntry
impl ApplicationEntry
Sourcepub fn id(&self) -> Option<String>
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
Sourcepub fn get_string(&self, key: &str) -> Option<String>
pub fn get_string(&self, key: &str) -> Option<String>
Get a string value from the Desktop Entry group
Sourcepub fn get_localized_string(
&self,
key: &str,
locale: Option<&str>,
) -> Option<String>
pub fn get_localized_string( &self, key: &str, locale: Option<&str>, ) -> Option<String>
Get a localized string value from the Desktop Entry group
Sourcepub fn get_bool(&self, key: &str) -> Option<bool>
pub fn get_bool(&self, key: &str) -> Option<bool>
Get a boolean value from the Desktop Entry group
Sourcepub fn get_numeric(&self, key: &str) -> Option<f64>
pub fn get_numeric(&self, key: &str) -> Option<f64>
Get a numeric value from the Desktop Entry group
Sourcepub fn get_vec(&self, key: &str) -> Option<Vec<String>>
pub fn get_vec(&self, key: &str) -> Option<Vec<String>>
Get a vector of strings from the Desktop Entry group
Sourcepub fn entry_type(&self) -> Option<String>
pub fn entry_type(&self) -> Option<String>
Get the entry type (Application, Link, Directory)
Sourcepub fn generic_name(&self) -> Option<String>
pub fn generic_name(&self) -> Option<String>
Get generic name (e.g., “Web Browser”)
pub fn should_show(&self) -> bool
Check if entry should be hidden
Sourcepub fn no_display(&self) -> bool
pub fn no_display(&self) -> bool
Check if entry should not be displayed in menus
Sourcepub fn mime_types(&self) -> Option<Vec<String>>
pub fn mime_types(&self) -> Option<Vec<String>>
Get supported MIME types
Sourcepub fn categories(&self) -> Option<Vec<String>>
pub fn categories(&self) -> Option<Vec<String>>
Get categories
Sourcepub fn execute(&self) -> Result<(), ExecuteError>
pub fn execute(&self) -> Result<(), ExecuteError>
Execute this application with no files
Sourcepub fn execute_with_files(&self, files: &[&str]) -> Result<(), ExecuteError>
pub fn execute_with_files(&self, files: &[&str]) -> Result<(), ExecuteError>
Execute this application with the given files
Sourcepub fn execute_with_urls(&self, urls: &[&str]) -> Result<(), ExecuteError>
pub fn execute_with_urls(&self, urls: &[&str]) -> Result<(), ExecuteError>
Execute this application with the given URLs
Sourcepub fn prepare_command(
&self,
files: &[&str],
urls: &[&str],
) -> Result<(String, Vec<String>), ExecuteError>
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
impl ApplicationEntry
Sourcepub fn all() -> Vec<ApplicationEntry>
pub fn all() -> Vec<ApplicationEntry>
Get all application entries from standard directories
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>
Create an ApplicationEntry from a path
Sourcepub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>
pub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>
Try to create an ApplicationEntry from a path, returning Result
Sourcepub fn from_id(id: &str) -> Result<Self, FindError>
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