Commit Diff


commit - fe2262ad3dcb66d88a03596bc884bd0d7e7af6e4
commit + e8a766656410c9dddec2d2d52503e07b49fa71eb
blob - a80fefd07819e4efc32f5c6a15929d2d8932dd72
blob + 8aa25d05c20943b9104193262145453470f005b4
--- ChangeLog
+++ ChangeLog
@@ -3,6 +3,7 @@
 	* ui.c (handle_resize): debounce resize event
 	(cmd_forward_char): unbreak forward-char
 	added aliases for tab-{next,new,previous}
+	(redraw_tabline): display a `!' when a non-focused tab gets loaded
 
 2021-04-30  Omar Polo  <op@omarpolo.com>
 
blob - 47f122b526bd916d3b444e48e4ccab5df2347ed7
blob + 37b06480d075ac61d8980db5ea3277a5f5286f19
--- ui.c
+++ ui.c
@@ -45,6 +45,7 @@
 #include <unistd.h>
 
 #define TAB_CURRENT	0x1
+#define TAB_URGENT	0x2
 
 #define NEW_TAB_URL	"about:new"
 
@@ -782,6 +783,7 @@ cmd_tab_next(struct window *window)
 	if ((t = TAILQ_NEXT(tab, tabs)) == NULL)
 		t = TAILQ_FIRST(&tabshead);
 	t->flags |= TAB_CURRENT;
+	t->flags &= ~TAB_URGENT;
 }
 
 static void
@@ -795,6 +797,7 @@ cmd_tab_previous(struct window *window)
 	if ((t = TAILQ_PREV(tab, tabshead, tabs)) == NULL)
 		t = TAILQ_LAST(&tabshead, tabshead);
 	t->flags |= TAB_CURRENT;
+	t->flags &= ~TAB_URGENT;
 }
 
 static void
@@ -1510,7 +1513,11 @@ redraw_tabline(void)
 		if (*(title = tab->window.page.title) == '\0')
 			title = tab->hist_cur->h;
 
-		strlcpy(buf, " ", sizeof(buf));
+		if (tab->flags & TAB_URGENT)
+			strlcpy(buf, "!", sizeof(buf));
+		else
+			strlcpy(buf, " ", sizeof(buf));
+
                 if (strlcat(buf, title, sizeof(buf)) >= sizeof(buf)) {
 			/* truncation happens */
 			strlcpy(&buf[sizeof(buf)-4], "...", 4);
@@ -2058,7 +2065,8 @@ ui_on_tab_refresh(struct tab *tab)
 	if (tab->flags & TAB_CURRENT) {
 		restore_cursor(&tab->window);
 		redraw_tab(tab);
-	}
+	} else
+		tab->flags |= TAB_URGENT;
 }
 
 void