Struct DesktopEntry

Source
pub struct DesktopEntry {
    pub appid: String,
    pub groups: Groups,
    pub path: PathBuf,
    pub ubuntu_gettext_domain: Option<String>,
}

Fields§

§appid: String§groups: Groups§path: PathBuf§ubuntu_gettext_domain: Option<String>

Implementations§

Source§

impl DesktopEntry

Source

pub fn from_str<L>( path: impl Into<PathBuf>, input: &str, locales_filter: Option<&[L]>, ) -> Result<DesktopEntry, DecodeError>
where L: AsRef<str>,

Source

pub fn from_path<L>( path: impl Into<PathBuf>, locales_filter: Option<&[L]>, ) -> Result<DesktopEntry, DecodeError>
where L: AsRef<str>,

Return an owned DesktopEntry

Source§

impl DesktopEntry

Source

pub fn parse_exec(&self) -> Result<Vec<String>, ExecError>

Source

pub fn parse_exec_with_uris<L>( &self, uris: &[&str], locales: &[L], ) -> Result<Vec<String>, ExecError>
where L: AsRef<str>,

Macros like %f (cf .desktop spec) will be subtitued using the uris parameter.

Source

pub fn parse_exec_action( &self, action_name: &str, ) -> Result<Vec<String>, ExecError>

Source

pub fn parse_exec_action_with_uris<L>( &self, action_name: &str, uris: &[&str], locales: &[L], ) -> Result<Vec<String>, ExecError>
where L: AsRef<str>,

Source§

impl DesktopEntry

Source

pub fn from_appid(appid: String) -> DesktopEntry

Construct a new DesktopEntry from an appid. The name field will be set to that appid.

Source

pub fn matches_wm_class(&self, id: Ascii<&str>) -> bool

Entries with a matching StartupWMClass should be preferred over those that do not.

Source

pub fn matches_id(&self, id: Ascii<&str>) -> bool

Match entry by desktop entry file name

Source

pub fn matches_name(&self, name: Ascii<&str>) -> bool

Source§

impl DesktopEntry

Source

pub fn id(&self) -> &str

Source

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

A desktop entry field if any field under the [Desktop Entry] section.

Source

pub fn desktop_entry_localized<'a, L: AsRef<str>>( &'a self, key: &str, locales: &[L], ) -> Option<Cow<'a, str>>

Source

pub fn add_desktop_entry(&mut self, key: String, value: String)

Insert a new field to this DesktopEntry, in the [Desktop Entry] section, removing the previous value and locales in any.

Source

pub fn name<L: AsRef<str>>(&self, locales: &[L]) -> Option<Cow<'_, str>>

Source

pub fn generic_name<L: AsRef<str>>(&self, locales: &[L]) -> Option<Cow<'_, str>>

Source

pub fn full_name<L: AsRef<str>>(&self, locales: &[L]) -> Option<Cow<'_, str>>

Get the full name of an application, and fall back to the name if that fails.

Source

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

Source

pub fn comment<L: AsRef<str>>(&self, locales: &[L]) -> Option<Cow<'_, str>>

This is an human readable description of the desktop file.

Source

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

Source

pub fn try_exec(&self) -> Option<&str>

Path or name of an executable to check if app is really installed

Source

pub fn dbus_activatable(&self) -> bool

Source

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

Return categories

Source

pub fn keywords<L: AsRef<str>>( &self, locales: &[L], ) -> Option<Vec<Cow<'_, str>>>

Return keywords

Source

pub fn mime_type(&self) -> Option<Vec<&str>>

Return mime types

Source

pub fn implements(&self) -> Option<Vec<&str>>

List of D-Bus interfaces supported by this application

Source

pub fn no_display(&self) -> bool

Application exists but shouldn’t be shown in menus

Source

pub fn only_show_in(&self) -> Option<Vec<&str>>

Desktop environments that should display this application

Source

pub fn not_show_in(&self) -> Option<Vec<&str>>

Desktop environments that should not display this application

Source

pub fn hidden(&self) -> bool

Treat application as if it does not exist

Source

pub fn flatpak(&self) -> Option<&str>

Source

pub fn prefers_non_default_gpu(&self) -> bool

Source

pub fn startup_notify(&self) -> bool

Source

pub fn startup_wm_class(&self) -> Option<&str>

Source

pub fn terminal(&self) -> bool

Source

pub fn single_main_window(&self) -> bool

The app has a single main window only

Source

pub fn path(&self) -> Option<&str>

Working directory to run program in

Source

pub fn type_(&self) -> Option<&str>

Source

pub fn url(&self) -> Option<&str>

URL to access if entry type is Link

Source

pub fn version(&self) -> Option<&str>

Supported version of the Desktop Entry Specification

Source

pub fn actions(&self) -> Option<Vec<&str>>

Source

pub fn action_entry(&self, action: &str, key: &str) -> Option<&str>

An action is defined as [Desktop Action actions-name] where action-name is defined in the Actions field of [Desktop Entry]. Example: to get the Name field of this new-window action

[Desktop Action new-window]
Name=Open a New Window

you will need to call

entry.action_entry("new-window", "Name")
Source

pub fn action_entry_localized<L: AsRef<str>>( &self, action: &str, key: &str, locales: &[L], ) -> Option<Cow<'_, str>>

Source

pub fn action_name<L: AsRef<str>>( &self, action: &str, locales: &[L], ) -> Option<Cow<'_, str>>

Source

pub fn action_exec(&self, action: &str) -> Option<&str>

Source

pub fn localized_entry_splitted<'a, L: AsRef<str>>( &'a self, group: Option<&'a Group>, key: &str, locales: &[L], ) -> Option<Vec<Cow<'a, str>>>

Trait Implementations§

Source§

impl Clone for DesktopEntry

Source§

fn clone(&self) -> DesktopEntry

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DesktopEntry

Source§

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

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

impl Display for DesktopEntry

Source§

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

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

impl Hash for DesktopEntry

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for DesktopEntry

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for DesktopEntry

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for DesktopEntry

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for DesktopEntry

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.