From e8c64f46d9a8e79afb13874813fa6a739025d28c Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Tue, 31 Jan 2023 23:39:16 +0200 Subject: abstract over tag and layout name provider --- src/tags.rs | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 src/tags.rs (limited to 'src/tags.rs') diff --git a/src/tags.rs b/src/tags.rs deleted file mode 100644 index e3b87ab..0000000 --- a/src/tags.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::config::Config; -use crate::text::{Attributes, ComputedText}; - -use pangocairo::cairo::Context; - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum TagState { - Urgent, - Focused, - Active, - Inactive, -} - -#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] -pub struct TagsInfo { - pub focused: u32, - pub urgent: u32, - pub active: u32, -} - -impl TagsInfo { - pub fn get_state(self, tag: usize) -> TagState { - if self.urgent >> tag & 1 == 1 { - TagState::Urgent - } else if self.focused >> tag & 1 == 1 { - TagState::Focused - } else if self.active >> tag & 1 == 1 { - TagState::Active - } else { - TagState::Inactive - } - } -} - -pub fn compute_tag_label(label: &str, config: &Config, context: &Context) -> ComputedText { - ComputedText::new( - label, - Attributes { - font: &config.font.0, - padding_left: config.tags_padding, - padding_right: config.tags_padding, - min_width: None, - align: Default::default(), - markup: false, - }, - context, - ) -} -- cgit v1.3.1