mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 12:03:11 +00:00
Add keybind for cycling to the next unread window
This commit is contained in:
parent
b4eb538903
commit
c6b19d5144
2 changed files with 36 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
const $ = require("jquery");
|
||||
const Mousetrap = require("mousetrap");
|
||||
const utils = require("./utils");
|
||||
const {vueApp} = require("./vue");
|
||||
|
||||
Mousetrap.bind(["alt+up", "alt+down"], function(e, keys) {
|
||||
const sidebar = $("#sidebar");
|
||||
|
@ -70,6 +71,31 @@ Mousetrap.bind(["alt+shift+up", "alt+shift+down"], function(e, keys) {
|
|||
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() {
|
||||
let targetchan;
|
||||
|
||||
outer_loop: for (const network of vueApp.networks) {
|
||||
for (const chan of network.channels) {
|
||||
if (chan.highlight) {
|
||||
targetchan = chan;
|
||||
break outer_loop;
|
||||
}
|
||||
|
||||
if (chan.unread && !targetchan) {
|
||||
targetchan = chan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetchan) {
|
||||
$(`#sidebar .chan[data-id="${targetchan.id}"]`).trigger("click");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Ignored keys which should not automatically focus the input bar
|
||||
const ignoredKeys = {
|
||||
8: true, // Backspace
|
||||
|
|
|
@ -87,6 +87,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-item">
|
||||
<div class="subject">
|
||||
<span class="key-all"><kbd>Alt</kbd> <kbd>A</kbd></span>
|
||||
<span class="key-apple"><kbd>⌥</kbd> <kbd>A</kbd></span>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p>Switch to the first window with unread messages.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-item">
|
||||
<div class="subject">
|
||||
<span class="key-all"><kbd>Ctrl</kbd> <kbd>K</kbd></span>
|
||||
|
|
Loading…
Reference in a new issue