[][src]Struct bitbar::ContentItem

pub struct ContentItem {
    pub text: String,
    pub extra: Option<Extra>,
    pub href: Option<Url>,
    pub color: Option<Color>,
    pub font: Option<String>,
    pub command: Option<Command>,
    pub refresh: bool,
    pub image: Option<Image>,
}

A menu item that's not a separator.

Fields

text: String

This menu item's main content text.

Any | in the text will be displayed as ¦, and any newlines will be displayed as spaces.

extra: Option<Extra>

This menu item's alternate-mode menu item or submenu.

href: Option<Url>

Corresponds to BitBar's href= parameter.

color: Option<Color>

Corresponds to BitBar's color= parameter.

font: Option<String>

Corresponds to BitBar's font= parameter.

command: Option<Command>

Corresponds to BitBar's bash=, terminal=, param1=, etc. parameters.

refresh: bool

Corresponds to BitBar's refresh= parameter.

image: Option<Image>

Corresponds to BitBar's image= or templateImage= parameter.

Methods

impl ContentItem[src]

pub fn new(text: impl ToString) -> ContentItem[src]

Returns a new menu item with the given text.

Any | in the text will be displayed as ¦, and any newlines will be displayed as spaces.

pub fn sub(self, items: impl IntoIterator<Item = MenuItem>) -> Self[src]

Adds a submenu to this menu item.

pub fn href(self, href: impl IntoUrl) -> Result<Self, ParseError>[src]

Adds a clickable link to this menu item.

pub fn color(self, color: impl IntoColor) -> Result<Self, ColorParseError>[src]

Sets this menu item's text color. Alpha channel is ignored.

pub fn font(self, font: impl ToString) -> Self[src]

Sets this menu item's text font.

pub fn command(self, cmd: impl Into<Command>) -> Self[src]

Make this menu item run the given command when clicked.

pub fn refresh(self) -> Self[src]

Causes the BitBar plugin to be refreshed when this menu item is clicked.

pub fn alt(self, alt: impl Into<ContentItem>) -> Self[src]

Adds an alternate menu item, which is shown instead of this one as long as the option key ⌥ is held.

pub fn template_image<T: TryInto<Image>>(self, img: T) -> Result<Self, T::Error>[src]

Adds a template image to this menu item.

pub fn image<T: TryInto<Image>>(self, img: T) -> Result<Self, T::Error>[src]

Adds an image to this menu item. The image will not be considered a template image unless specified as such by the img parameter.

Trait Implementations

impl Debug for ContentItem[src]

impl Default for ContentItem[src]

impl Display for ContentItem[src]

impl From<ContentItem> for MenuItem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err