Struct bitbar::ContentItem
source · [−]pub struct ContentItem {
pub text: String,
pub extra: Option<Extra>,
pub href: Option<Url>,
pub color: Option<Color>,
pub font: Option<String>,
pub size: Option<usize>,
pub command: Option<Command>,
pub refresh: bool,
pub image: Option<Image>,
pub flavor_attrs: Option<Attrs>,
}
Expand description
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.
size: Option<usize>
Corresponds to BitBar’s size=
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.
flavor_attrs: Option<Attrs>
Parameters for flavor-specific features.
Implementations
sourceimpl ContentItem
impl ContentItem
sourcepub fn new(text: impl ToString) -> ContentItem
pub fn new(text: impl ToString) -> ContentItem
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.
sourcepub fn sub(self, items: impl IntoIterator<Item = MenuItem>) -> Self
pub fn sub(self, items: impl IntoIterator<Item = MenuItem>) -> Self
Adds a submenu to this menu item.
sourcepub fn href(self, href: impl IntoUrl) -> Result<Self, ParseError>
pub fn href(self, href: impl IntoUrl) -> Result<Self, ParseError>
Adds a clickable link to this menu item.
sourcepub fn color<C: TryInto<Color>>(self, color: C) -> Result<Self, C::Error>
pub fn color<C: TryInto<Color>>(self, color: C) -> Result<Self, C::Error>
Sets this menu item’s text color. Alpha channel is ignored.
sourcepub fn command<C: TryInto<Command>>(self, cmd: C) -> Result<Self, C::Error>
pub fn command<C: TryInto<Command>>(self, cmd: C) -> Result<Self, C::Error>
Make this menu item run the given command when clicked.
sourcepub fn refresh(self) -> Self
pub fn refresh(self) -> Self
Causes the BitBar plugin to be refreshed when this menu item is clicked.
sourcepub fn alt(self, alt: impl Into<ContentItem>) -> Self
pub fn alt(self, alt: impl Into<ContentItem>) -> Self
Adds an alternate menu item, which is shown instead of this one as long as the option key ⌥ is held.
Trait Implementations
sourceimpl Debug for ContentItem
impl Debug for ContentItem
sourceimpl Default for ContentItem
impl Default for ContentItem
sourcefn default() -> ContentItem
fn default() -> ContentItem
Returns the “default value” for a type. Read more
sourceimpl Display for ContentItem
impl Display for ContentItem
sourceimpl From<ContentItem> for MenuItem
impl From<ContentItem> for MenuItem
sourcefn from(i: ContentItem) -> MenuItem
fn from(i: ContentItem) -> MenuItem
Converts to this type from the input type.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> NoneValue for T where
T: Default,
impl<T> NoneValue for T where
T: Default,
type NoneType = T
fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more