diff options
| -rw-r--r-- | src/bar.rs | 2 | ||||
| -rw-r--r-- | src/config.rs | 2 | ||||
| -rw-r--r-- | src/tags.rs | 14 |
3 files changed, 10 insertions, 8 deletions
@@ -126,7 +126,7 @@ impl Bar { // TODO make configurable for text in ["1", "2", "3", "4", "5", "6", "7", "8", "9"] { self.tags_computed - .push(compute_tag_label(text, &ss.config.font, &cairo_ctx)); + .push(compute_tag_label(text, &ss.config, &cairo_ctx)); } } self.tags_btns.clear(); diff --git a/src/config.rs b/src/config.rs index a5b05d0..a20f60e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,6 +27,7 @@ pub struct Config { pub height: u32, pub separator_width: f64, pub tags_r: f64, + pub tags_padding: f64, pub blocks_r: f64, pub blocks_overlap: f64, // command @@ -56,6 +57,7 @@ impl Default for Config { height: 24, separator_width: 2.0, tags_r: 0.0, + tags_padding: 25.0, blocks_r: 0.0, blocks_overlap: 0.0, command: None, diff --git a/src/tags.rs b/src/tags.rs index d22853d..e3b87ab 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -1,7 +1,7 @@ +use crate::config::Config; use crate::text::{Attributes, ComputedText}; -use cairo::Context; -use pango::FontDescription; -use pangocairo::{cairo, pango}; + +use pangocairo::cairo::Context; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TagState { @@ -32,13 +32,13 @@ impl TagsInfo { } } -pub fn compute_tag_label(label: &str, font: &FontDescription, context: &Context) -> ComputedText { +pub fn compute_tag_label(label: &str, config: &Config, context: &Context) -> ComputedText { ComputedText::new( label, Attributes { - font, - padding_left: 25.0, - padding_right: 25.0, + font: &config.font.0, + padding_left: config.tags_padding, + padding_right: config.tags_padding, min_width: None, align: Default::default(), markup: false, |
