[−][src]Struct bitbar::ContentItem
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]
fn default() -> ContentItem
[src]
impl Display for ContentItem
[src]
impl From<ContentItem> for MenuItem
[src]
fn from(i: ContentItem) -> MenuItem
[src]
Auto Trait Implementations
impl RefUnwindSafe for ContentItem
impl Send for ContentItem
impl Sync for ContentItem
impl Unpin for ContentItem
impl UnwindSafe for ContentItem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,