summaryrefslogtreecommitdiff
path: root/src/bar.rs
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-08-16 08:21:37 +0200
committercashmere <cashmere@autistici.org>2026-08-16 08:21:37 +0200
commit4901b5d77d73db59f0c1545719ec6d1404aad979 (patch)
tree0b3233e82387ffe7a9cd5c0934971a665e0575a9 /src/bar.rs
parent91b84d1f1bfbc5de2eb140a48185a5252b1b592e (diff)
downloadi3bar-mango-4901b5d77d73db59f0c1545719ec6d1404aad979.tar.gz
Run detached and reload config liveHEADmain
Diffstat (limited to 'src/bar.rs')
-rw-r--r--src/bar.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/bar.rs b/src/bar.rs
index 115641d..7530f2e 100644
--- a/src/bar.rs
+++ b/src/bar.rs
@@ -132,6 +132,21 @@ impl Bar {
self.focused_window_computed = None;
}
+ pub fn config_changed(&mut self, conn: &mut Connection<State>, shared_state: &SharedState) {
+ self.height = shared_state.config.height;
+ self.tags_computed.clear();
+ self.layout_name_computed = None;
+ self.mode_computed = None;
+ self.focused_window_computed = None;
+ self.tray_toggle_computed = None;
+ self.layer_surface
+ .set_layer(conn, shared_state.config.layer.into());
+ if !self.hidden {
+ self.hide(conn);
+ self.show(conn, shared_state);
+ }
+ }
+
pub fn click(
&mut self,
conn: &mut Connection<State>,
@@ -525,7 +540,10 @@ impl Bar {
let mut rendered = Vec::new();
if expanded {
for item in &visible {
- let label = match (cfg.show_name, cfg.show_description && !item.tooltip.is_empty()) {
+ let label = match (
+ cfg.show_name,
+ cfg.show_description && !item.tooltip.is_empty(),
+ ) {
(true, true) if item.tooltip != item.title => {
format!("{} \u{2014} {}", item.title, item.tooltip)
}
@@ -583,7 +601,10 @@ impl Bar {
let icon_w = icon.width() as f64 * scale;
let icon_h = icon.height() as f64 * scale;
context.save().unwrap();
- context.translate(item_x + (icon_size - icon_w) / 2.0, (full_height - icon_h) / 2.0);
+ context.translate(
+ item_x + (icon_size - icon_w) / 2.0,
+ (full_height - icon_h) / 2.0,
+ );
context.scale(scale, scale);
context.set_source_surface(icon, 0.0, 0.0).unwrap();
context.paint().unwrap();