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
//! Crate for easily creating system bars/panels/docks.
//!
//! The goal of this crate is to make it as simple as possible to create complex bars/panels/docks
//! for linux without having to worry about anything but rendering.
//!
//! To get started with the crate, a new bar needs to be created. This is done using the [`load`]
//! method in the [`Bar`]. Once this is acquired the [`recv`], [`try_recv`] and [`lock`] methods
//! should be all that is required to receive events and render the bar.
//!
//! [`Bar`]: struct.Bar.html
//! [`load`]: struct.Bar.html#method.load
//! [`recv`]: struct.Bar.html#method.recv
//! [`try_recv`]: struct.Bar.html#method.try_recv
//! [`lock`]: struct.Bar.html#method.lock
//!
//! # Examples
//!
//! ```no_run
//! use std::io::Cursor;
//!
//! use bar_config::Bar;
//!
//! fn main() {
//!     let input = Cursor::new(String::from(
//!         "\
//!          height: 30\n\
//!          monitors:\n\
//!          - { name: \"DVI-1\" }\n\
//!          left:\n\
//!          - { text: \"Hello, World!\" }\n\
//!          center:\n\
//!          - { name: \"clock\" }\n\
//!          right:\n\
//!          - { text: \"VOLUME\" }",
//!     ));
//!
//!     let mut bar = Bar::load(input).unwrap();
//!
//!     print_bar(&bar);
//!     loop {
//!         let _ = bar.recv();
//!         print_bar(&bar);
//!     }
//! }
//!
//! fn print_bar(bar: &Bar) {
//!     let config = bar.lock();
//!     for comp in config
//!         .left
//!         .iter()
//!         .chain(&config.center)
//!         .chain(&config.right)
//!     {
//!         if let Some(text) = comp.text() {
//!             print!("{}\t", text);
//!         }
//!     }
//!     println!("");
//! }
//! ```

#[macro_use]
extern crate serde_derive;

mod bar;
mod components;
pub mod config;
pub mod event;

pub use crate::bar::*;