diff options
| author | Max Verevkin <34583604+MaxVerevkin@users.noreply.github.com> | 2022-11-27 21:25:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-27 21:25:15 +0200 |
| commit | d28693c9d293ea7c348c0e9e1a4e89ccff6dcae4 (patch) | |
| tree | 0794e56251e223388463a84d09616ef47a918bb4 /src/tags.rs | |
| parent | 9ddde2d2ee9833412e39afbd1ed907cdea22f08f (diff) | |
| parent | d45a4ef408c0f5a2071194d4c3285f0b7cb27dd0 (diff) | |
| download | i3bar-mango-d28693c9d293ea7c348c0e9e1a4e89ccff6dcae4.tar.gz | |
Merge pull request #1 from MaxVerevkin/next
Rewrite using latest walayd libs & implement HiDPI
Diffstat (limited to 'src/tags.rs')
| -rw-r--r-- | src/tags.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/tags.rs b/src/tags.rs index 8114a74..d22853d 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -1,19 +1,21 @@ -use crate::text::{Attributes, ComputedText, Text}; +use crate::text::{Attributes, ComputedText}; use cairo::Context; use pango::FontDescription; use pangocairo::{cairo, pango}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TagState { + Urgent, Focused, + Active, Inactive, - Urgent, } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] pub struct TagsInfo { pub focused: u32, pub urgent: u32, + pub active: u32, } impl TagsInfo { @@ -22,15 +24,18 @@ impl TagsInfo { 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: String, font: FontDescription, context: &Context) -> ComputedText { - let text = Text { - attr: Attributes { +pub fn compute_tag_label(label: &str, font: &FontDescription, context: &Context) -> ComputedText { + ComputedText::new( + label, + Attributes { font, padding_left: 25.0, padding_right: 25.0, @@ -38,7 +43,6 @@ pub fn compute_tag_label(label: String, font: FontDescription, context: &Context align: Default::default(), markup: false, }, - text: label, - }; - text.compute(context) + context, + ) } |
