tab bar spacer

This commit is contained in:
WanderingPenwing 2024-08-03 11:17:58 +02:00
parent 197e01d104
commit 1420954ac8

29
surf.c
View file

@ -388,17 +388,19 @@ void free_all_tabs(Client *client) {
} }
GtkWidget* create_tab_bar_view(GList *tabs) { GtkWidget* create_tab_bar_view(GList *tabs) {
GtkWidget *tab_bar_container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request(tab_bar_container, -1, tab_bar_height + tab_spacer_height);
GtkWidget *tab_bar = gtk_grid_new(); GtkWidget *tab_bar = gtk_grid_new();
GdkRGBA black = { 0.138, 0.138, 0.138, 1 }; GdkRGBA bg_color;
gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &black); gdk_rgba_parse(&bg_color, tab_bar_color[0]);
gtk_widget_set_size_request(tab_bar, -1, 16); // Set the height of the black bar gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &bg_color);
gtk_widget_set_size_request(tab_bar, -1, tab_bar_height); // Set the height of the black bar
gtk_grid_set_column_spacing(tab_bar, 10); gtk_grid_set_column_spacing(tab_bar, 10);
//int num_tabs = g_list_length(tabs); //int num_tabs = g_list_length(tabs);
//int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1)) //int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1))
//gtk_box_set_homogeneous(GTK_BOX(tab_bar), TRUE); // Make the box's children evenly spaced
// Add tabs to the tab bar // Add tabs to the tab bar
for (GList *l = tabs; l != NULL; l = l->next) { for (GList *l = tabs; l != NULL; l = l->next) {
Tab *tab = (Tab *)l->data; Tab *tab = (Tab *)l->data;
@ -418,11 +420,18 @@ GtkWidget* create_tab_bar_view(GList *tabs) {
gtk_grid_attach_next_to(GTK_GRID(tab_bar), new_tab, NULL, GTK_POS_RIGHT, 1, 1); gtk_grid_attach_next_to(GTK_GRID(tab_bar), new_tab, NULL, GTK_POS_RIGHT, 1, 1);
gtk_widget_show(new_tab); gtk_widget_show(new_tab);
// GtkWidget *spacer = gtk_label_new("+");
// gtk_attach_next_to(GTK_GRID(tab_bar), spacer, NULL, GTK_POS_RIGHT, 1, 1);
// gtk_widget_show(spacer);
return tab_bar; GdkRGBA fg_color;
gdk_rgba_parse(&fg_color, tab_bar_color[1]);
GtkWidget *spacer = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_override_background_color(spacer, GTK_STATE_FLAG_NORMAL, &fg_color);
gtk_widget_set_size_request(spacer, -1, tab_spacer_height);
gtk_widget_show(spacer);
gtk_box_pack_start(GTK_BOX(tab_bar_container), tab_bar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(tab_bar_container), spacer, FALSE, FALSE, 0);
return tab_bar_container;
} }
void void