From 65603d5138b54efc53c04e756631ab8eeddee7fb Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 10 Feb 2020 17:54:16 -0500 Subject: Show heat and other unread in title --- ui.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index 3f730d2..9a070a6 100644 --- a/ui.c +++ b/ui.c @@ -359,38 +359,45 @@ static void statusAdd(const char *str) { } static void statusUpdate(void) { + int otherUnread = 0; + enum Heat otherHeat = Cold; wmove(status, 0, 0); + int num; const struct Window *window; for (num = 0, window = windows.head; window; ++num, window = window->next) { if (!window->heat && window != windows.active) continue; - int unread; + if (window != windows.active) { + otherUnread += window->unreadCount; + if (window->heat > otherHeat) otherHeat = window->heat; + } + int trunc; char buf[256]; snprintf( buf, sizeof(buf), "\3%d%s %d %s %n(\3%02d%d\3%d) ", idColors[window->id], (window == windows.active ? "\26" : ""), num, idNames[window->id], - &unread, (window->heat > Warm ? White : idColors[window->id]), + &trunc, (window->heat > Warm ? White : idColors[window->id]), window->unreadCount, idColors[window->id] ); - if (!window->mark || !window->unreadCount) buf[unread] = '\0'; + if (!window->mark || !window->unreadCount) buf[trunc] = '\0'; statusAdd(buf); } wclrtoeol(status); + if (!to_status_line) return; - int unread; - char buf[256]; - snprintf( - buf, sizeof(buf), "%s %s%n (%d)", - self.network, idNames[windows.active->id], - &unread, windows.active->unreadCount - ); - if (!windows.active->mark || !windows.active->unreadCount) { - buf[unread] = '\0'; - } + window = windows.active; putp(to_status_line); - putp(buf); + printf("%s %s", self.network, idNames[window->id]); + if (window->mark && window->unreadCount) { + printf( + " (%d%s)", window->unreadCount, (window->heat > Warm ? "!" : "") + ); + } + if (otherUnread) { + printf(" (+%d%s)", otherUnread, (otherHeat > Warm ? "!" : "")); + } putp(from_status_line); fflush(stdout); } -- cgit 1.4.0 2.1&id=64905c6604164ce7d8e125e81b7acd84d5d40475&follow=1'>rc.d/calico (unfollow)
Commit message (Expand)Author
2019-11-10Request all supported caps from serverJune McEnroe
2019-11-10Filter ACCOUNT, AWAY, CHGHOST for incapable clientsJune McEnroe
2019-11-10Rename listen to localJune McEnroe
2019-11-09Remove extended-join and invite-notifyJune McEnroe
2019-11-09Maintain stateCaps and offer them to clientsJune McEnroe
2019-11-09Parse capabilitiesJune McEnroe
2019-11-09Avoid the reserved _A names with BIT macroJune McEnroe
2019-11-09Define macro for bit flag enumsJune McEnroe
2019-11-08Check that password is hashedJune McEnroe
2019-11-08Avoid calling getopt_long again after it returns -1June McEnroe
2019-11-08Only change AWAY status for registered clientsJune McEnroe
2019-11-07Just write the example normallyJune McEnroe
2019-11-07Include path in readlinkat errorJune McEnroe
2019-11-07Call clientConsume before clientRecvJune McEnroe
2019-11-06Use -l:filename in Linux.mkJune McEnroe
2019-11-06Fix compat.h for #defined strlcpyJune McEnroe
2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe
2019-11-06Document calico service configurationJune McEnroe
2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe
2019-11-06Document pounce service configurationJune McEnroe
2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe
2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe
2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe
2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe