diff --git a/src/action/client.h b/src/action/client.h index adddbbbc..876284cd 100644 --- a/src/action/client.h +++ b/src/action/client.h @@ -105,6 +105,11 @@ void client_add_jump_label_node(Client *c) { } void client_add_tab_bar_node(Client *c) { + + if (config.tab_bar_height <= 0) { + return; + } + MangoNodeData *mangonodedata = ecalloc(1, sizeof(MangoNodeData)); mangonodedata->node_data = c; mangonodedata->type = MANGO_TITLE_NODE; diff --git a/src/animation/client.h b/src/animation/client.h index 0e21f236..832caa0b 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -289,11 +289,15 @@ void apply_shield(Client *c, struct wlr_box clip_box) { } } -void global_draw_titlebar(Client *c, int32_t x, int32_t y, int32_t width, - int32_t height) { +void global_draw_tab_bar(Client *c, int32_t x, int32_t y, int32_t width, + int32_t height) { if (!c->tab_bar_node) return; + if (height <= 0) { + wlr_scene_node_set_enabled(&c->tab_bar_node->scene_buffer->node, false); + } + wlr_scene_node_set_position(&c->tab_bar_node->scene_buffer->node, x, y); wlr_scene_node_set_enabled(&c->tab_bar_node->scene_buffer->node, true); mango_tab_bar_node_set_size(c->tab_bar_node, width, height); diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 35c6c8ce..733990bd 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -3480,7 +3480,7 @@ void override_config(void) { config.scratchpad_height_ratio = CLAMP_FLOAT(config.scratchpad_height_ratio, 0.1f, 1.0f); config.borderpx = CLAMP_INT(config.borderpx, 0, 200); - config.tab_bar_height = CLAMP_INT(config.tab_bar_height, 5, 500); + config.tab_bar_height = CLAMP_INT(config.tab_bar_height, 0, 500); config.smartgaps = CLAMP_INT(config.smartgaps, 0, 1); config.focused_opacity = CLAMP_FLOAT(config.focused_opacity, 0.0f, 1.0f); config.unfocused_opacity = diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index 49afc8ec..96c0ed54 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -546,7 +546,7 @@ void deck(Monitor *m) { } void monocle(Monitor *m) { - Client *c, *fc; + Client *c = NULL, *fc = NULL; struct wlr_box geom; int32_t cur_gappov = enablegaps ? m->gappov : 0; int32_t cur_gappoh = enablegaps ? m->gappoh : 0; @@ -580,19 +580,24 @@ void monocle(Monitor *m) { return; } - int titlebar_height = config.tab_bar_height; - int title_y = m->w.y + cur_gappov; - int main_y = title_y + titlebar_height + cur_gapiv; - int main_height = - m->w.height - 2 * cur_gappov - cur_gapiv - titlebar_height; + int tab_bar_height = config.tab_bar_height; - int title_area_width = m->w.width - 2 * cur_gappoh; + int tab_bar_inner_gap_height = + config.tab_bar_height > 0 ? 2 * cur_gapiv : 0; + int tab_bar_y_offset = config.tab_bar_height > 0 ? cur_gapiv : 0; + + int tab_y = m->w.y + cur_gappov; + int main_y = tab_y + tab_bar_height + tab_bar_y_offset; + int main_height = m->w.height - 2 * cur_gappov - tab_bar_inner_gap_height - + tab_bar_height; + + int tab_area_width = m->w.width - 2 * cur_gappoh; int total_gaps = (n - 1) * cur_gapih; - int base_width = (title_area_width - total_gaps) / n; - int remainder = (title_area_width - total_gaps) % n; + int base_width = (tab_area_width - total_gaps) / n; + int remainder = (tab_area_width - total_gaps) % n; - int title_x = m->w.x + cur_gappoh; + int tab_x = m->w.x + cur_gappoh; int idx = 0; wl_list_for_each(c, &clients, link) { @@ -612,9 +617,9 @@ void monocle(Monitor *m) { client_tile_resize(c, geom, 0); int tw = base_width + (idx < remainder ? 1 : 0); - global_draw_titlebar(c, title_x, title_y, tw, titlebar_height); + global_draw_tab_bar(c, tab_x, tab_y, tw, tab_bar_height); - title_x += tw + cur_gapih; + tab_x += tw + cur_gapih; idx++; } }