1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! Leechbar is a crate for creating your own bar/panel/dock.
//!
//! The goal of leechbar is to provide a library that allows creating a completely custom bar.
//! The purpose is not simplicity. So if you don't plan on using more than just simple text,
//! you might want to look at something like [lemonbar](https://github.com/LemonBoy/bar) instead.
//!
//! # Usage
//!
//! This crate can be installed through [crates.io](https://crates.io/crates/leechbar) and can be
//! used by adding it to your `Cargo.toml`.
//!
//! ```toml
//! [dependencies]
//! leechbar = "0.2.1"
//! ```
//!
//! # Examples
//!
//! These snippets just touch the basics of using leechbar, for more complete examples you can take
//! a look at the [github repository](https://github.com/chrisduerr/leechbar/tree/master/examples).
//!
//! The first thing that needs to be done for using leechbar, is setting up the bar configuration
//! itself. This is done using the [`BarBuilder`] struct.
//!
//! ```rust,no_run
//! use leechbar::{BarBuilder, Color};
//!
//! // All method calls that take parameters are optional
//! BarBuilder::new()
//! .background_color(Color::new(255, 0, 255, 255))
//! .font("Fira Mono Medium 14")
//! .output("DVI-1")
//! .height(30)
//! .spawn()
//! .unwrap();
//! ```
//!
//! After creating a configuration using [`BarBuilder`], you have to add your components to the
//! bar. This is a little more complicated, because you need to implement the [`Component`] trait.
//!
//! ```rust,no_run
//! use leechbar::{Bar, BarBuilder, Component, Text, Foreground};
//!
//! struct MyComponent {
//! bar: Bar,
//! }
//!
//! // You can define your own custom components like this
//! impl Component for MyComponent {
//! // Print "Hello, World!" as text
//! fn foreground(&self) -> Foreground {
//! Text::new(&self.bar, "Hello, World", None, None).unwrap().into()
//! }
//! }
//!
//! // Create a new bar
//! let mut bar = BarBuilder::new().spawn().unwrap();
//!
//! // Create an instance of the component
//! let comp = MyComponent { bar: bar.clone() };
//!
//! // Add an instance of your component to your bar
//! bar.add(comp);
//!
//! // Start the event loop that handles all X events
//! bar.start_event_loop();
//! ```
//!
//! # Logging
//!
//! This crate supports [`log`], if you want to enable this logging, you can add [`env_logger`] to
//! your binary.
//!
//! ```rust
//! extern crate env_logger;
//!
//! fn main() {
//! env_logger::init();
//! // All the cool bar stuff
//! }
//! ```
//!
//! [`log`]: https://docs.rs/log
//! [`env_logger`]: http://rust-lang-nursery.github.io/log/env_logger
//! [`BarBuilder`]: struct.BarBuilder.html
//! [`Component`]: component/trait.Component.html
extern crate cairo;
extern crate cairo_sys;
extern crate chan;
extern crate error_chain;
extern crate image;
extern crate log;
extern crate pango;
extern crate pangocairo;
extern crate xcb;
pub use ;
pub use Foreground;
pub use Background;
pub use Alignment;
pub use ;
pub use Width;
pub use Text;
pub use Image;
pub use Component;
pub use BarBuilder;
pub use Color;
pub use Bar;