Add keybinds for previous/next unread/mention room
This commit is contained in:
parent
200f0c33a8
commit
974478f576
2
TODO.md
2
TODO.md
|
@ -1,7 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- add account number binds
|
- add account number binds
|
||||||
- next room with unread/mention keybinds
|
|
||||||
- revise pane collapse mode
|
- revise pane collapse mode
|
||||||
|
|
||||||
- fix escape keybinds (filter rooms, message selection)
|
- fix escape keybinds (filter rooms, message selection)
|
||||||
|
@ -12,7 +11,6 @@
|
||||||
- account delegates refactor
|
- account delegates refactor
|
||||||
- lag when switching accounts
|
- lag when switching accounts
|
||||||
- update glass theme
|
- update glass theme
|
||||||
- improve room highlight
|
|
||||||
|
|
||||||
- if last room event is a membership change, it won't be visible in timeline
|
- if last room event is a membership change, it won't be visible in timeline
|
||||||
- use uiState instead of open_room
|
- use uiState instead of open_room
|
||||||
|
|
|
@ -266,13 +266,18 @@ class UISettings(JSONDataFile):
|
||||||
"addNewChat": ["Alt+C"],
|
"addNewChat": ["Alt+C"],
|
||||||
"toggleFocusMainPane": ["Alt+F"],
|
"toggleFocusMainPane": ["Alt+F"],
|
||||||
"clearRoomFilter": ["Alt+Shift+F"],
|
"clearRoomFilter": ["Alt+Shift+F"],
|
||||||
|
"toggleCollapseAccount": [ "Alt+O"],
|
||||||
|
|
||||||
"goToLastPage": ["Ctrl+Tab"],
|
"goToLastPage": ["Ctrl+Tab"],
|
||||||
"goToPreviousAccount": ["Alt+Shift+N"],
|
"goToPreviousAccount": ["Alt+Shift+N"],
|
||||||
"goToNextAccount": ["Alt+N"],
|
"goToNextAccount": ["Alt+N"],
|
||||||
"goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"],
|
"goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"],
|
||||||
"goToNextRoom": ["Alt+Shift+Down", "Alt+Shift+J"],
|
"goToNextRoom": ["Alt+Shift+Down", "Alt+Shift+J"],
|
||||||
"toggleCollapseAccount": [ "Alt+O"],
|
"goToPreviousUnreadRoom": ["Alt+Shift+U"],
|
||||||
|
"goToNextUnreadRoom": ["Alt+U"],
|
||||||
|
"goToPreviousMentionedRoom": ["Alt+Shift+M"],
|
||||||
|
"goToNextMentionedRoom": ["Alt+M"],
|
||||||
|
|
||||||
"focusRoomAtIndex": {
|
"focusRoomAtIndex": {
|
||||||
"01": f"{alt_or_cmd()}+1",
|
"01": f"{alt_or_cmd()}+1",
|
||||||
"02": f"{alt_or_cmd()}+2",
|
"02": f"{alt_or_cmd()}+2",
|
||||||
|
|
|
@ -102,6 +102,26 @@ HListView {
|
||||||
showItemAtIndex(accountIndice[currentUserId] + 1 + index)
|
showItemAtIndex(accountIndice[currentUserId] + 1 + index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cycleUnreadRooms(forward=true, mentions=false) {
|
||||||
|
const prop = mentions ? "mentions" : "unreads"
|
||||||
|
const start = currentIndex === -1 ? 0 : currentIndex
|
||||||
|
let index = start
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
index += forward ? 1 : -1
|
||||||
|
|
||||||
|
if (index < 0) index = model.count - 1
|
||||||
|
if (index > model.count - 1) index = 0
|
||||||
|
if (index === start) return false
|
||||||
|
|
||||||
|
const item = model.get(index)
|
||||||
|
|
||||||
|
if (item.type === "Room" && item[prop]) {
|
||||||
|
currentIndex = index
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setCorrectCurrentItem() {
|
function setCorrectCurrentItem() {
|
||||||
if (! currentShouldBeRoom && ! currentShouldBeAccount) {
|
if (! currentShouldBeRoom && ! currentShouldBeAccount) {
|
||||||
|
@ -165,6 +185,27 @@ HListView {
|
||||||
onActivated: { incrementCurrentIndex(); showItemLimiter.restart() }
|
onActivated: { incrementCurrentIndex(); showItemLimiter.restart() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HShortcut {
|
||||||
|
sequences: window.settings.keys.goToPreviousUnreadRoom
|
||||||
|
onActivated: { cycleUnreadRooms(false) && showItemLimiter.restart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
HShortcut {
|
||||||
|
sequences: window.settings.keys.goToNextUnreadRoom
|
||||||
|
onActivated: { cycleUnreadRooms(true) && showItemLimiter.restart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
HShortcut {
|
||||||
|
sequences: window.settings.keys.goToPreviousMentionedRoom
|
||||||
|
onActivated: cycleUnreadRooms(false, true) && showItemLimiter.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
HShortcut {
|
||||||
|
sequences: window.settings.keys.goToNextMentionedRoom
|
||||||
|
onActivated: cycleUnreadRooms(true, true) && showItemLimiter.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Object.keys(window.settings.keys.focusRoomAtIndex)
|
model: Object.keys(window.settings.keys.focusRoomAtIndex)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user