Struct leechbar::BarBuilder [−][src]
pub struct BarBuilder { /* fields omitted */ }
The bar configuration.
This is used to configure the bar. After configuration, the bar can be created using the
spawn
method.
Examples
Basic usage:
use leechbar::{BarBuilder, Color}; // All method calls that take parameters are optional BarBuilder::new() .background_color(Color::new(255, 0, 255, 255)) .foreground_color(Color::new(0, 255, 0, 255)) .font("Fira Mono Medium 14") .output("DVI-1") .name("MyBar") .height(30) .spawn() .unwrap();
Methods
impl BarBuilder
[src]
impl BarBuilder
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new instance of the BarBuilder
with default parameters.
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new();
pub fn foreground_color(self, color: Color) -> Self
[src]
pub fn foreground_color(self, color: Color) -> Self
Change the default foreground color.
Default: White (255, 255, 255, 255)
Examples
use leechbar::{BarBuilder, Color}; let color = Color::new(255, 0, 255, 0); let builder = BarBuilder::new().foreground_color(color);
pub fn background_color(self, color: Color) -> Self
[src]
pub fn background_color(self, color: Color) -> Self
Change the default background color.
Default: Black (0, 0, 0, 255)
Examples
use leechbar::{BarBuilder, Color}; let color = Color::new(255, 0, 255, 0); let builder = BarBuilder::new().background_color(color);
pub fn background_image(self, image: DynamicImage) -> Self
[src]
pub fn background_image(self, image: DynamicImage) -> Self
Change the default background image.
This takes an image and sets it as the default background for the bar. The image is not resized or modified in any way, so it is required to manually adjust it to fit the specified bar geometry.
Default: No background image.
Examples
extern crate image; use leechbar::BarBuilder; let image = image::open("./img.png").unwrap(); let builder = BarBuilder::new().background_image(image);
pub fn name<T: Into<String>>(self, name: T) -> Self
[src]
pub fn name<T: Into<String>>(self, name: T) -> Self
Change the default name of the bar.
This name is used by your Window Manager.
Default: leechbar
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new().name("Leechbar");
pub fn font<T: Into<String>>(self, font: T) -> Self
[src]
pub fn font<T: Into<String>>(self, font: T) -> Self
Change the default font of the bar.
This font is used for each block unless manually overwritten.
Default: Default pango font.
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new().font("Fira Sans Medium 13");
pub fn height(self, height: u16) -> Self
[src]
pub fn height(self, height: u16) -> Self
Change the default height of the bar.
This specifies the vertical height used in pixels.
Default: 30
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new().height(25);
pub fn output<T: Into<String>>(self, output: T) -> Self
[src]
pub fn output<T: Into<String>>(self, output: T) -> Self
Change the default output the bar should be displayed on.
This uses RANDR to get the output with the specified name. An example value for a DVI
output would be DVI-0
.
If not specified the primary output is selected.
Default: Primary output.
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new().output("DVI-0");
pub fn text_yoffset(self, text_yoffset: i16) -> Self
[src]
pub fn text_yoffset(self, text_yoffset: i16) -> Self
Change the default vertical text offset of the bar. Positive values move the text downwards.
This is overridden by the component's vertical offset if present.
Default: 0
Examples
use leechbar::BarBuilder; let builder = BarBuilder::new().text_yoffset(-4);
pub fn spawn(self) -> Result<Bar, BarError>
[src]
pub fn spawn(self) -> Result<Bar, BarError>
Spawn the bar with the currently configured settings.
This creates a window and registers it as a bar on Xorg.
Examples
use leechbar::BarBuilder; let bar = BarBuilder::new().spawn().unwrap();
Trait Implementations
impl Clone for BarBuilder
[src]
impl Clone for BarBuilder
fn clone(&self) -> BarBuilder
[src]
fn clone(&self) -> BarBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for BarBuilder
[src]
impl Default for BarBuilder
Auto Trait Implementations
impl Send for BarBuilder
impl Send for BarBuilder
impl Sync for BarBuilder
impl Sync for BarBuilder