pub struct Line { /* private fields */ }
Expand description
Line holds the content, styling and behaviour of a line in a Bitbar menu, both in the menu and submenus
Implementations§
Source§impl Line
impl Line
Sourcepub fn new<T: Into<String>>(text: T) -> Self
pub fn new<T: Into<String>>(text: T) -> Self
Function to create empty line
Examples found in repository?
3fn main() {
4 let mut pl = Plugin::new();
5 let mut line = Line::new("first line");
6 line.set_color("red").set_href("http://google.com");
7
8 let mut sub_menu = SubMenu::new();
9 sub_menu.add_line(line);
10
11 let status_line = Line::new("🍺🍺🍺");
12 pl.set_status_line(status_line).set_sub_menu(sub_menu);
13
14 pl.render();
15}
Sourcepub fn set_style(&mut self, style: Style) -> &mut Self
pub fn set_style(&mut self, style: Style) -> &mut Self
Style provides a alternate method for setting the text style related options.
Sourcepub fn set_command(&mut self, cmd: Cmd) -> &mut Self
pub fn set_command(&mut self, cmd: Cmd) -> &mut Self
command provides a alternate method for setting the bash script and params along with some related flags via a Cmd struct.
Sourcepub fn set_href<T: Into<String>>(&mut self, href: T) -> &mut Self
pub fn set_href<T: Into<String>>(&mut self, href: T) -> &mut Self
href adds a URL to the line and makes it clickable.
Examples found in repository?
3fn main() {
4 let mut pl = Plugin::new();
5 let mut line = Line::new("first line");
6 line.set_color("red").set_href("http://google.com");
7
8 let mut sub_menu = SubMenu::new();
9 sub_menu.add_line(line);
10
11 let status_line = Line::new("🍺🍺🍺");
12 pl.set_status_line(status_line).set_sub_menu(sub_menu);
13
14 pl.render();
15}
Sourcepub fn set_color<T: Into<String>>(&mut self, color: T) -> &mut Self
pub fn set_color<T: Into<String>>(&mut self, color: T) -> &mut Self
Color sets the lines font color, can take a name or hex value.
Examples found in repository?
3fn main() {
4 let mut pl = Plugin::new();
5 let mut line = Line::new("first line");
6 line.set_color("red").set_href("http://google.com");
7
8 let mut sub_menu = SubMenu::new();
9 sub_menu.add_line(line);
10
11 let status_line = Line::new("🍺🍺🍺");
12 pl.set_status_line(status_line).set_sub_menu(sub_menu);
13
14 pl.render();
15}
Sourcepub fn set_bash<T: Into<String>>(&mut self, bash: T) -> &mut Self
pub fn set_bash<T: Into<String>>(&mut self, bash: T) -> &mut Self
Bash makes makes the line clickable and adds a script that will be run on click.
Sourcepub fn set_params(&mut self, params: Vec<String>) -> &mut Self
pub fn set_params(&mut self, params: Vec<String>) -> &mut Self
Params adds arguments which are passed to the script specified by line.bash()
Sourcepub fn set_terminal(&mut self, terminal: bool) -> &mut Self
pub fn set_terminal(&mut self, terminal: bool) -> &mut Self
Terminal sets a flag which controls whether a Terminal is opened when the bash script is run.
Sourcepub fn set_refresh(&mut self, refresh: bool) -> &mut Self
pub fn set_refresh(&mut self, refresh: bool) -> &mut Self
Refresh controls whether clicking the line results in the plugin being refreshed. If the line has a bash script attached then the plugin is refreshed after the script finishes.
Sourcepub fn set_drop_down(&mut self, drop_down: bool) -> &mut Self
pub fn set_drop_down(&mut self, drop_down: bool) -> &mut Self
DropDown sets a flag which controls whether the line only appears and cycles in the status bar but not in the dropdown.
Sourcepub fn set_length(&mut self, length: i64) -> &mut Self
pub fn set_length(&mut self, length: i64) -> &mut Self
Length truncates the line after the specified number of characters. An elipsis will be added to any truncated strings, as well as a tooltip displaying the full string.
Sourcepub fn set_trim(&mut self, trim: bool) -> &mut Self
pub fn set_trim(&mut self, trim: bool) -> &mut Self
Trim sets a flag to control whether leading/trailing whitespace is trimmed from the
title. Defaults to true
.
Sourcepub fn set_alternate(&mut self, alternate: bool) -> &mut Self
pub fn set_alternate(&mut self, alternate: bool) -> &mut Self
Alternate sets a flag to mark a line as an alternate to the previous one for when the Option key is pressed in the dropdown.
Sourcepub fn set_emojize(&mut self, emojize: bool) -> &mut Self
pub fn set_emojize(&mut self, emojize: bool) -> &mut Self
Emojize sets a flag to control parsing of github style :mushroom: into 🍄.