display channel name in title

This commit is contained in:
hippoz 2022-09-24 17:07:50 +03:00
parent 28ed386228
commit 52cc76f676
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -606,13 +606,20 @@ selectedChannel.watch((newSelectedChannel) => {
} }
}); });
unreadStore.subscribe(() => {
const updateTitle = () => {
let totalUnreads = 0; let totalUnreads = 0;
unreadStore.value.forEach(count => totalUnreads += count); unreadStore.value.forEach(count => totalUnreads += count);
let channelSuffix = "";
if (selectedChannel.value && selectedChannel.value.id !== -1 && selectedChannel.value.name) {
channelSuffix = ` | #${selectedChannel.value.name}`;
}
if (totalUnreads > 0) { if (totalUnreads > 0) {
window.document.title = `(${totalUnreads}) waffle`; window.document.title = `(${totalUnreads}) waffle${channelSuffix}`;
} else { } else {
window.document.title = "waffle"; window.document.title = `waffle${channelSuffix}`;
} }
}); };
unreadStore.subscribe(updateTitle);
selectedChannel.subscribe(updateTitle);