From 9a5a210fe574f89a118143324c33f43d4641e54c Mon Sep 17 00:00:00 2001 From: WanderingPenwing Date: Tue, 6 Aug 2024 01:58:49 +0200 Subject: [PATCH] added pretty suspend tab --- config.def.h | 3 +++ surf.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 874183d..a2c256c 100644 --- a/config.def.h +++ b/config.def.h @@ -217,3 +217,6 @@ static Button buttons[] = { { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 }, }; + + +const char *suspended_html = "⏾"; diff --git a/surf.c b/surf.c index 17618c7..9374778 100644 --- a/surf.c +++ b/surf.c @@ -573,7 +573,7 @@ void tab_mouse_pos_index(GdkEvent *e, Client *c, int *index, bool *close_tab) { if (close_tab != NULL) { int x_width = MIN(get_font_size(c->tab_bar) * 5 / 2, tab_width / 4); - *close_tab = (x - *index * tab_width > tab_width - x_width); + *close_tab = (x - *index * tab_width > tab_width - x_width && *index < n_tabs); } } @@ -1003,6 +1003,12 @@ loaduri(Client *c, const Arg *a) if (g_strcmp0(uri, "") == 0) return; + + Tab *selected_tab = g_list_nth_data(c->tabs, c->selected_tab); + if (selected_tab->suspended) { + webkit_web_view_load_alternate_html(c->view, suspended_html, uri, NULL); + return; + } if (g_str_has_prefix(uri, "http://") || g_str_has_prefix(uri, "https://") ||