forked from wathiede/i3xs
Allow DateTimeWidget to use timezones and specify format.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use i3monkit::{I3Protocol, Header, WidgetCollection};
|
||||
use i3monkit::widgets::{NetworkSpeedWidget, CpuWidget};
|
||||
use i3monkit::widgets::{CpuWidget, NetworkSpeedWidget};
|
||||
use i3monkit::{Header, I3Protocol, WidgetCollection};
|
||||
|
||||
use num_cpus;
|
||||
|
||||
@@ -8,7 +8,7 @@ use structopt::StructOpt;
|
||||
use i3xs::widgets::DateTimeWidget;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(name="i3xs", about="Custom i3 status bar program.")]
|
||||
#[structopt(name = "i3xs", about = "Custom i3 status bar program.")]
|
||||
struct Opt {
|
||||
#[structopt(short, long)]
|
||||
nic: String,
|
||||
@@ -17,18 +17,21 @@ struct Opt {
|
||||
fn main() {
|
||||
let mut bar = WidgetCollection::new();
|
||||
|
||||
let opts=Opt::from_args();
|
||||
|
||||
// Realtime upload/download rate for a interface
|
||||
bar.push(NetworkSpeedWidget::new(&opts.nic));
|
||||
let opts = Opt::from_args();
|
||||
|
||||
//Display all the cpu usage for each core
|
||||
for i in 0..num_cpus::get() as u32 {
|
||||
bar.push(CpuWidget::new(i));
|
||||
}
|
||||
|
||||
bar.push(DateTimeWidget::new());
|
||||
bar.push(DateTimeWidget::new());
|
||||
// Realtime upload/download rate for a interface
|
||||
bar.push(NetworkSpeedWidget::new(&opts.nic));
|
||||
|
||||
bar.push(DateTimeWidget::tz(
|
||||
"%H:%M %Z".to_string(),
|
||||
"Europe/London".to_string(),
|
||||
));
|
||||
bar.push(DateTimeWidget::new("%m/%d %H:%M".to_string()));
|
||||
|
||||
// Then start updating the satus bar
|
||||
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
|
||||
|
||||
Reference in New Issue
Block a user