Merge remote-tracking branch 'origin/pull/4231'

This commit is contained in:
Reto Brunner 2024-02-19 13:50:00 +01:00
commit be3e27aa19
2 changed files with 49 additions and 0 deletions

View file

@ -179,6 +179,26 @@
</div>
</div>
<div class="help-item">
<div class="subject">
<span v-if="!isApple"><kbd>Alt</kbd> <kbd>Ctrl</kbd> <kbd></kbd></span>
<span v-else><kbd></kbd> <kbd></kbd> <kbd></kbd></span>
</div>
<div class="description">
<p>Switch to the next window with unread messages in the channel list.</p>
</div>
</div>
<div class="help-item">
<div class="subject">
<span v-if="!isApple"><kbd>Alt</kbd> <kbd>Ctrl</kbd> <kbd></kbd></span>
<span v-else><kbd></kbd> <kbd></kbd> <kbd></kbd></span>
</div>
<div class="description">
<p>Switch to the previous window with unread messages in the channel list.</p>
</div>
</div>
<div class="help-item">
<div class="subject">
<span v-if="!isApple"><kbd>Alt</kbd> <kbd>A</kbd></span>

View file

@ -83,6 +83,35 @@ Mousetrap.bind(["alt+shift+up", "alt+shift+down"], function (e, keys) {
return false;
});
// Switch to the next/previous unread chat
Mousetrap.bind(["alt+mod+up", "alt+mod+down"], function (e, keys) {
if (isIgnoredKeybind(e)) {
return true;
}
const channels = store.state.networks
.map((net) =>
net.channels.filter(
(chan) => chan.unread || chan === store.state.activeChannel?.channel
)
)
.flat();
if (channels.length === 0) {
return;
}
let index = channels.findIndex((chan) => chan === store.state.activeChannel?.channel);
const length = channels.length;
const direction = keys.split("+").pop() === "up" ? -1 : 1;
index = (((index + direction) % length) + length) % length;
jumpToChannel(channels[index]);
return false;
});
// Jump to the first window with a highlight in it, or the first with unread
// activity if there are none with highlights.
Mousetrap.bind(["alt+a"], function (e) {