Skip to main content

TrayItem

Struct TrayItem 

Source
pub struct TrayItem {
    pub id: String,
    pub app_id: String,
    pub title: String,
    pub status: TrayStatus,
    pub icon_name: String,
    pub icon_pixmaps: Vec<IconPixels>,
    pub attention_icon_name: String,
    pub icon_theme_path: String,
    pub tooltip: String,
    pub item_is_menu: bool,
    pub menu: String,
}
Expand description

One app’s tray icon, as its StatusNotifierItem describes it.

Fields§

§id: String

Unique while the item is registered: its bus name and object path, such as :1.42/StatusNotifierItem. The key to give children_keyed, and what TrayHost::activate and the rest take.

§app_id: String

The app’s name for itself, such as nm-applet. Two copies of one app share it.

§title: String

A name for the item, such as Network.

§status: TrayStatus

Whether it wants to be seen.

§icon_name: String

A freedesktop icon name, or empty.

§icon_pixmaps: Vec<IconPixels>

The icon as raw pixels, in each size the app sent, for an item with no icon name. Each side is at most 512 px.

§attention_icon_name: String

The icon name to show while it needs attention, or empty.

§icon_theme_path: String

A directory where the app keeps its own icon files, or empty.

§tooltip: String

The tooltip’s title, or empty.

§item_is_menu: bool

Whether the item offers only its menu, so a left click opens the menu instead of calling TrayHost::activate.

§menu: String

Where its menu is on the bus, or empty for none. Open it with TrayHost::open_menu.

Implementations§

Source§

impl TrayItem

Source

pub fn icon(&self, size: u32) -> Option<IconSource>

What to draw at size physical pixels, the icon’s logical size times the output’s scale. That is the attention icon while the item needs attention and has one, otherwise its icon name, as a file in icon_theme_path if one is there. An app with an icon_theme_path that lacks the file keeps its icons apart from the theme, so its pixmaps, if it sent any, come before the name. With no name, it is the pixmap closest to size. None when there is nothing to draw.

Trait Implementations§

Source§

impl Clone for TrayItem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TrayItem

Source§

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

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

impl Default for TrayItem

Source§

fn default() -> Self

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

impl PartialEq for TrayItem

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TrayItem

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> NoneValue for T
where T: Default,

Source§

type NoneType = T

The type of the none-equivalent value that NoneValue::null_value produces.
Source§

fn null_value() -> T

The none-equivalent value.
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more