Set colors for clock in work profile.

This commit is contained in:
Bill Thiede 2019-09-21 22:11:31 -07:00
parent 4cb50597e1
commit 14b58f766a
2 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,5 @@
use chrono::NaiveTime;
use i3monkit::widgets::CpuWidget;
use i3monkit::{ColorRGB, Header, I3Protocol, WidgetCollection};

View File

@ -1,11 +1,13 @@
use chrono::NaiveTime;
use i3monkit::widgets::CpuWidget;
use i3monkit::{Header, I3Protocol, WidgetCollection};
use i3monkit::{ColorRGB, Header, I3Protocol, WidgetCollection};
use num_cpus;
use structopt::StructOpt;
use i3xs::widgets::datetime::DateTimeWidget;
use i3xs::widgets::datetime::{DateTimeWidget, TimeColor};
use i3xs::widgets::network::NetworkSpeedWidget;
#[derive(Debug, StructOpt)]
@ -32,7 +34,18 @@ fn main() {
"%H:%M %Z".to_string(),
"Europe/London".to_string(),
));
bar.push(DateTimeWidget::new("%m/%d %H:%M".to_string()));
let mut dt = DateTimeWidget::new("%m/%d %H:%M".to_string());
dt.set_colors(&vec![
TimeColor {
start: NaiveTime::from_hms(13, 0, 0),
color: ColorRGB::yellow(),
},
TimeColor {
start: NaiveTime::from_hms(14, 0, 0),
color: ColorRGB::red(),
},
]);
bar.push(dt);
// Then start updating the status bar
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));