1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 11:24:24 +02:00

fix(bar): do not add start/center/end containers if empty

This commit is contained in:
Jake Stanger 2024-06-28 23:23:18 +01:00
parent 44a70d949b
commit 461bee8847
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -78,10 +78,6 @@ impl Bar {
let center = create_container("center", orientation);
let end = create_container("end", orientation);
content.add(&start);
content.set_center_widget(Some(&center));
content.pack_end(&end, false, false, 0);
window.add(&content);
window.connect_destroy_event(|_, _| {
@ -273,16 +269,22 @@ impl Bar {
let popup = Rc::new(popup);
if let Some(modules) = config.start {
self.content.add(&self.start);
let info = info!(ModuleLocation::Left);
add_modules(&self.start, modules, &info, &self.ironbar, &popup)?;
}
if let Some(modules) = config.center {
self.content.set_center_widget(Some(&self.center));
let info = info!(ModuleLocation::Center);
add_modules(&self.center, modules, &info, &self.ironbar, &popup)?;
}
if let Some(modules) = config.end {
self.content.pack_end(&self.end, false, true, 0);
let info = info!(ModuleLocation::Right);
add_modules(&self.end, modules, &info, &self.ironbar, &popup)?;
}