mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-30 22:16:44 +02:00
Add notification counters to bottom tab
A counter now increments in the bottom bar for unfocused windows showing how many unread messages are pending. Tabs with no pending messages show [*] instead of their index (showing the index is useless and somewhat confusing)
This commit is contained in:
@ -502,14 +502,22 @@ static void draw_window_tab(ToxWindow *toxwin, bool active_window)
|
||||
attron(COLOR_PAIR(toxwin->alert));
|
||||
}
|
||||
|
||||
unsigned int pending_messages = toxwin->pending_messages;
|
||||
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
||||
clrtoeol();
|
||||
|
||||
if (active_window || toxwin->index <= 1) {
|
||||
WINDOW_TYPE type = toxwin->type;
|
||||
|
||||
if (active_window || (type == WINDOW_TYPE_PROMPT || type == WINDOW_TYPE_FRIEND_LIST)) {
|
||||
printw(" [%s]", toxwin->name);
|
||||
} else {
|
||||
printw(" [%u]", toxwin->index - 1);
|
||||
if (pending_messages > 0) {
|
||||
printw(" [%u]", pending_messages);
|
||||
} else {
|
||||
printw(" [*]");
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
@ -673,6 +681,7 @@ void draw_active_window(Tox *m)
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
a->alert = WINDOW_ALERT_NONE;
|
||||
a->pending_messages = 0;
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
||||
draw_bar();
|
||||
|
Reference in New Issue
Block a user