all repos — tint2 @ 040f6479bf32a64b8b1de445a94ade12a259d672

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Fix regression in resizing logic (taskbar_distribute_size now works correctly when the taskbar is completely empty)
o9000 mrovi9000@gmail.com
commit

040f6479bf32a64b8b1de445a94ade12a259d672

parent

ce0acdbd5b492c8311805e3f2d8d1601bb77fef8

1 files changed, 24 insertions(+), 11 deletions(-)

jump to
M src/panel.csrc/panel.c

@@ -490,21 +490,34 @@ }

} // Distribute the remaining size between tasks - int task_size = total_size / MAX(num_tasks, 1); - for (int i = 0; i < panel->num_desktops; i++) { - Taskbar *taskbar = &panel->taskbar[i]; - if (!taskbar->area.on_screen) - continue; - for (GList *l = taskbar->area.children; l; l = l->next) { - Area *child = (Area *)l->data; - if (!child->on_screen) + if (num_tasks > 0) { + int task_size = total_size / num_tasks; + for (int i = 0; i < panel->num_desktops; i++) { + Taskbar *taskbar = &panel->taskbar[i]; + if (!taskbar->area.on_screen) continue; - if (taskbarname_enabled && l == taskbar->area.children) + for (GList *l = taskbar->area.children; l; l = l->next) { + Area *child = (Area *)l->data; + if (!child->on_screen) + continue; + if (taskbarname_enabled && l == taskbar->area.children) + continue; + if (panel_horizontal) + taskbar->area.width += task_size; + else + taskbar->area.height += task_size; + } + } + } else { + // No tasks => expand the first visible taskbar + for (int i = 0; i < panel->num_desktops; i++) { + Taskbar *taskbar = &panel->taskbar[i]; + if (!taskbar->area.on_screen) continue; if (panel_horizontal) - taskbar->area.width += task_size; + taskbar->area.width += total_size; else - taskbar->area.height += task_size; + taskbar->area.height += total_size; } } for (int i = 0; i < panel->num_desktops; i++) {