1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Add option to hilight unread rooms in /wins command

In the theme we can now set `cmd.wins.unread` to hvae a special color
for the lines of the `/wins` output that have unread messages.

Fix https://github.com/profanity-im/profanity/issues/895
This commit is contained in:
Michael Vetter 2019-10-12 13:03:14 +02:00
parent 559c143587
commit 5c53e02d86
4 changed files with 9 additions and 1 deletions

View File

@ -150,6 +150,7 @@ theme_init(const char *const theme_name)
g_hash_table_insert(defaults, strdup("roster.room.mention"), strdup("green")); g_hash_table_insert(defaults, strdup("roster.room.mention"), strdup("green"));
g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow")); g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("untrusted"), strdup("red")); g_hash_table_insert(defaults, strdup("untrusted"), strdup("red"));
g_hash_table_insert(defaults, strdup("cmd.wins.unread"), strdup("white"));
_load_preferences(); _load_preferences();
} }
@ -756,6 +757,7 @@ theme_attrs(theme_item_t attrs)
case THEME_ROSTER_ROOM_MENTION: _theme_prep_fgnd("roster.room.mention", lookup_str, &bold); break; case THEME_ROSTER_ROOM_MENTION: _theme_prep_fgnd("roster.room.mention", lookup_str, &bold); break;
case THEME_OCCUPANTS_HEADER: _theme_prep_fgnd("occupants.header", lookup_str, &bold); break; case THEME_OCCUPANTS_HEADER: _theme_prep_fgnd("occupants.header", lookup_str, &bold); break;
case THEME_UNTRUSTED: _theme_prep_fgnd("untrusted", lookup_str, &bold); break; case THEME_UNTRUSTED: _theme_prep_fgnd("untrusted", lookup_str, &bold); break;
case THEME_CMD_WINS_UNREAD: _theme_prep_fgnd("cmd.wins.unread", lookup_str, &bold); break;
case THEME_WHITE: g_string_append(lookup_str, "white"); bold = FALSE; break; case THEME_WHITE: g_string_append(lookup_str, "white"); bold = FALSE; break;
case THEME_WHITE_BOLD: g_string_append(lookup_str, "white"); bold = TRUE; break; case THEME_WHITE_BOLD: g_string_append(lookup_str, "white"); bold = TRUE; break;
case THEME_GREEN: g_string_append(lookup_str, "green"); bold = FALSE; break; case THEME_GREEN: g_string_append(lookup_str, "green"); bold = FALSE; break;

View File

@ -137,6 +137,7 @@ typedef enum {
THEME_MAGENTA, THEME_MAGENTA,
THEME_MAGENTA_BOLD, THEME_MAGENTA_BOLD,
THEME_TEXT_HISTORY, THEME_TEXT_HISTORY,
THEME_CMD_WINS_UNREAD,
} theme_item_t; } theme_item_t;
void theme_init(const char *const theme_name); void theme_init(const char *const theme_name);

View File

@ -498,7 +498,11 @@ cons_show_wins(gboolean unread)
GSList *curr = window_strings; GSList *curr = window_strings;
while (curr) { while (curr) {
win_println(console, THEME_DEFAULT, '-', "%s", curr->data); if (g_strstr_len(curr->data, strlen(curr->data), " unread") > 0) {
win_println(console, THEME_CMD_WINS_UNREAD, '-', "%s", curr->data);
} else {
win_println(console, THEME_DEFAULT, '-', "%s", curr->data);
}
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }
g_slist_free_full(window_strings, free); g_slist_free_full(window_strings, free);

View File

@ -79,6 +79,7 @@ roster.room.mention=
occupants.header= occupants.header=
receipt.sent= receipt.sent=
untrusted= untrusted=
cmd.wins.unread=
[ui] [ui]
beep= beep=