bar_config/lib.rs
1//! Crate for easily creating system bars/panels/docks.
2//!
3//! The goal of this crate is to make it as simple as possible to create complex bars/panels/docks
4//! for linux without having to worry about anything but rendering.
5//!
6//! To get started with the crate, a new bar needs to be created. This is done using the [`load`]
7//! method in the [`Bar`]. Once this is acquired the [`recv`], [`try_recv`] and [`lock`] methods
8//! should be all that is required to receive events and render the bar.
9//!
10//! [`Bar`]: struct.Bar.html
11//! [`load`]: struct.Bar.html#method.load
12//! [`recv`]: struct.Bar.html#method.recv
13//! [`try_recv`]: struct.Bar.html#method.try_recv
14//! [`lock`]: struct.Bar.html#method.lock
15//!
16//! # Examples
17//!
18//! ```no_run
19//! use std::io::Cursor;
20//!
21//! use bar_config::Bar;
22//!
23//! fn main() {
24//! let input = Cursor::new(String::from(
25//! "\
26//! height: 30\n\
27//! monitors:\n\
28//! - { name: \"DVI-1\" }\n\
29//! left:\n\
30//! - { text: \"Hello, World!\" }\n\
31//! center:\n\
32//! - { name: \"clock\" }\n\
33//! right:\n\
34//! - { text: \"VOLUME\" }",
35//! ));
36//!
37//! let mut bar = Bar::load(input).unwrap();
38//!
39//! print_bar(&bar);
40//! loop {
41//! let _ = bar.recv();
42//! print_bar(&bar);
43//! }
44//! }
45//!
46//! fn print_bar(bar: &Bar) {
47//! let config = bar.lock();
48//! for comp in config
49//! .left
50//! .iter()
51//! .chain(&config.center)
52//! .chain(&config.right)
53//! {
54//! if let Some(text) = comp.text() {
55//! print!("{}\t", text);
56//! }
57//! }
58//! println!("");
59//! }
60//! ```
61
62#[macro_use]
63extern crate serde_derive;
64
65mod bar;
66mod components;
67pub mod config;
68pub mod event;
69
70pub use crate::bar::*;