diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-03-10 01:43:42 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-03-10 01:43:42 -0400 |
commit | 46f1b7df0031efbf7ddd05aef4c486bfd1ddaa71 (patch) | |
tree | 21d74fdee7d4735f04b43f08e57e7f128f1e8f6b /src | |
parent | 8630287676baad0f5b50ecf41dcde652128f6d00 (diff) |
Redid how we auto-set time if we have autohide on.
Diffstat (limited to 'src')
-rw-r--r-- | src/app.rs | 6 | ||||
-rw-r--r-- | src/options.rs | 8 |
2 files changed, 11 insertions, 3 deletions
@@ -246,7 +246,7 @@ impl Default for NetState { zoom_level: 100.0, display_time: constants::DEFAULT_TIME_MILLISECONDS, force_update: false, - display_time_instant: Some(Instant::now()), + display_time_instant: None, } } } @@ -269,7 +269,7 @@ impl Default for CpuState { core_show_vec: Vec::new(), display_time: constants::DEFAULT_TIME_MILLISECONDS, force_update: false, - display_time_instant: Some(Instant::now()), + display_time_instant: None, } } } @@ -294,7 +294,7 @@ impl Default for MemState { zoom_level: 100.0, display_time: constants::DEFAULT_TIME_MILLISECONDS, force_update: false, - display_time_instant: Some(Instant::now()), + display_time_instant: None, } } } diff --git a/src/options.rs b/src/options.rs index a5cd832e..654a9356 100644 --- a/src/options.rs +++ b/src/options.rs @@ -305,10 +305,18 @@ pub fn enable_hide_time(matches: &clap::ArgMatches<'static>, config: &Config, ap pub fn enable_autohide_time(matches: &clap::ArgMatches<'static>, config: &Config, app: &mut App) { if matches.is_present("AUTOHIDE_TIME") { app.app_config_fields.autohide_time = true; + let time = Some(std::time::Instant::now()); + app.cpu_state.display_time_instant = time; + app.mem_state.display_time_instant = time; + app.net_state.display_time_instant = time; } else if let Some(flags) = &config.flags { if let Some(autohide_time) = flags.autohide_time { if autohide_time { app.app_config_fields.autohide_time = true; + let time = Some(std::time::Instant::now()); + app.cpu_state.display_time_instant = time; + app.mem_state.display_time_instant = time; + app.net_state.display_time_instant = time; } } } |