diff --git a/swayr/src/config.rs b/swayr/src/config.rs index bc6ec98..ddae236 100644 --- a/swayr/src/config.rs +++ b/swayr/src/config.rs @@ -167,6 +167,17 @@ impl Config { .expect("No focus.lockin_delay defined."), ) } + + pub fn get_focus_sequence_timeout(&self) -> Option { + self.focus + .as_ref() + .and_then(|f| f.sequence_timeout) + .or_else(|| Focus::default().sequence_timeout) + .and_then(|d| match d { + 0 => None, + _ => Some(Duration::from_millis(d)), + }) + } } #[derive(Debug, Serialize, Deserialize)] @@ -214,6 +225,7 @@ impl Layout { #[derive(Debug, Serialize, Deserialize)] pub struct Focus { lockin_delay: Option, + sequence_timeout: Option, } impl Default for Menu { @@ -311,6 +323,7 @@ impl Default for Focus { fn default() -> Self { Self { lockin_delay: Some(750), + sequence_timeout: None, } } }