all repos — tint2 @ 0d861ebd97cf128ce575dabce5eb8241d12883e0

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

Option to shrink panel: fix taskbar sizing
o9000 mrovi9000@gmail.com
commit

0d861ebd97cf128ce575dabce5eb8241d12883e0

parent

7c54f2acf710de2dae3ccb0c17b9fb79d684f2bf

3 files changed, 26 insertions(+), 0 deletions(-)

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

@@ -47,6 +47,7 @@ TaskbarSortMethod taskbar_sort_method;

Alignment taskbar_alignment; void taskbar_init_fonts(); +int taskbar_compute_desired_size(void *obj); // Removes the task with &win = key. The other args are ignored. void taskbar_remove_task(Window *win);

@@ -174,6 +175,7 @@ snprintf(panel->g_taskbar.area.name, sizeof(panel->g_taskbar.area.name), "Taskbar");

panel->g_taskbar.area.size_mode = LAYOUT_DYNAMIC; panel->g_taskbar.area.alignment = taskbar_alignment; panel->g_taskbar.area._resize = resize_taskbar; + panel->g_taskbar.area._compute_desired_size = taskbar_compute_desired_size; panel->g_taskbar.area._is_under_mouse = full_width_area_is_under_mouse; panel->g_taskbar.area.resize_needed = 1; panel->g_taskbar.area.on_screen = TRUE;

@@ -417,6 +419,22 @@ if (!get_task(win[i]))

add_task(win[i]); XFree(win); +} + +int taskbar_compute_desired_size(void *obj) +{ + Taskbar *taskbar = (Taskbar *)obj; + Panel *panel = (Panel *)taskbar->area.panel; + + if (taskbar_mode == MULTI_DESKTOP && !taskbar_distribute_size && !hide_taskbar_if_empty) { + int result = 0; + for (int i = 0; i < panel->num_desktops; i++) { + Taskbar *t = &panel->taskbar[i]; + result = MAX(result, container_compute_desired_size(&t->area)); + } + return result; + } + return container_compute_desired_size(&taskbar->area); } gboolean resize_taskbar(void *obj)
M src/util/area.csrc/util/area.c

@@ -224,6 +224,13 @@ if (a->_compute_desired_size)

return a->_compute_desired_size(a); if (a->size_mode == LAYOUT_FIXED) fprintf(stderr, YELLOW "Area %s does not set desired size!" RESET "\n", a->name); + return container_compute_desired_size(a); +} + +int container_compute_desired_size(Area *a) +{ + if (!a->on_screen) + return 0; int result = 2 * a->paddingxlr + (panel_horizontal ? left_right_border_width(a) : top_bottom_border_width(a)); int children_count = 0; for (GList *l = a->children; l != NULL; l = l->next) {
M src/util/area.hsrc/util/area.h

@@ -260,6 +260,7 @@ // If maximum_size > 0, it is an upper limit for the child size.

int relayout_with_constraint(Area *a, int maximum_size); int compute_desired_size(Area *a); +int container_compute_desired_size(Area *a); int left_border_width(Area *a); int right_border_width(Area *a);