From fc1f0a58a0dcf022694f4769edf44d4f94c24ee5 Mon Sep 17 00:00:00 2001 From: Taeyeon Mori Date: Tue, 28 Jun 2022 13:23:51 +0200 Subject: [PATCH] Add focus.sequence_timeout config option --- swayr/src/config.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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, } } }