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]

Create a new instance of the BarBuilder with default parameters.

Examples

use leechbar::BarBuilder;

let builder = BarBuilder::new();

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);

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);

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);

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");

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");

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);

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");

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);

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for BarBuilder
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for BarBuilder

impl Sync for BarBuilder