mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Show number of highlights in window title
Co-authored-by: Simon Ser <contact@emersion.fr> Closes: https://todo.sr.ht/~emersion/gamja/134
This commit is contained in:
parent
8faff95631
commit
0b7726819d
2 changed files with 26 additions and 2 deletions
|
@ -493,7 +493,9 @@ export default class App extends Component {
|
||||||
|
|
||||||
let stored = this.bufferStore.get({ name, server: client.params });
|
let stored = this.bufferStore.get({ name, server: client.params });
|
||||||
if (client.caps.enabled.has("draft/chathistory") && stored) {
|
if (client.caps.enabled.has("draft/chathistory") && stored) {
|
||||||
this.setBufferState({ server: serverID, name }, { unread: stored.unread });
|
this.setBufferState({ server: serverID, name }, { unread: stored.unread }, () => {
|
||||||
|
this.updateDocumentTitle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bufferStore.put({
|
this.bufferStore.put({
|
||||||
|
@ -603,6 +605,8 @@ export default class App extends Component {
|
||||||
this.sendReadReceipt(client, stored);
|
this.sendReadReceipt(client, stored);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateDocumentTitle();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +621,13 @@ export default class App extends Component {
|
||||||
bouncerNetwork = this.state.bouncerNetworks.get(server.bouncerNetID);
|
bouncerNetwork = this.state.bouncerNetworks.get(server.bouncerNetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let numUnread = 0;
|
||||||
|
for (let buffer of this.state.buffers.values()) {
|
||||||
|
if (Unread.compare(buffer.unread, Unread.HIGHLIGHT) >= 0) {
|
||||||
|
numUnread++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let parts = [];
|
let parts = [];
|
||||||
if (buf && buf.type !== BufferType.SERVER) {
|
if (buf && buf.type !== BufferType.SERVER) {
|
||||||
parts.push(buf.name);
|
parts.push(buf.name);
|
||||||
|
@ -626,7 +637,13 @@ export default class App extends Component {
|
||||||
}
|
}
|
||||||
parts.push(this.baseTitle);
|
parts.push(this.baseTitle);
|
||||||
|
|
||||||
document.title = parts.join(" · ");
|
let title = "";
|
||||||
|
if (numUnread > 0) {
|
||||||
|
title = `(${numUnread}) `;
|
||||||
|
}
|
||||||
|
title += parts.join(" · ");
|
||||||
|
|
||||||
|
document.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareChatMessage(serverID, msg) {
|
prepareChatMessage(serverID, msg) {
|
||||||
|
@ -774,6 +791,10 @@ export default class App extends Component {
|
||||||
this.sendReadReceipt(client, stored);
|
this.sendReadReceipt(client, stored);
|
||||||
}
|
}
|
||||||
return { unread, prevReadReceipt };
|
return { unread, prevReadReceipt };
|
||||||
|
}, () => {
|
||||||
|
if (msgUnread === Unread.HIGHLIGHT) {
|
||||||
|
this.updateDocumentTitle();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,6 +1271,7 @@ export default class App extends Component {
|
||||||
closed,
|
closed,
|
||||||
receipts: { [ReceiptType.READ]: readReceipt },
|
receipts: { [ReceiptType.READ]: readReceipt },
|
||||||
});
|
});
|
||||||
|
this.updateDocumentTitle();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -40,6 +40,8 @@ export const keybindings = [
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return { buffers };
|
return { buffers };
|
||||||
|
}, () => {
|
||||||
|
app.updateDocumentTitle();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue