Add keybinds to go to account at specific indice

This commit is contained in:
miruka 2020-05-14 02:48:48 -04:00
parent 6f1f82f82d
commit fd3fe06d15
3 changed files with 28 additions and 2 deletions

View File

@ -1,6 +1,5 @@
# TODO # TODO
- add account number binds
- revise pane collapse mode - revise pane collapse mode
- fix python getting stuck when loading large room - fix python getting stuck when loading large room

View File

@ -214,6 +214,10 @@ class UISettings(JSONDataFile):
async def default_data(self) -> JsonData: async def default_data(self) -> JsonData:
def ctrl_or_osx_ctrl() -> str:
# Meta in Qt corresponds to Ctrl on OSX
return "Meta" if platform.system() == "Darwin" else "Ctrl"
def alt_or_cmd() -> str: def alt_or_cmd() -> str:
# Ctrl in Qt corresponds to Cmd on OSX # Ctrl in Qt corresponds to Cmd on OSX
return "Ctrl" if platform.system() == "Darwin" else "Alt" return "Ctrl" if platform.system() == "Darwin" else "Alt"
@ -278,6 +282,19 @@ class UISettings(JSONDataFile):
"goToPreviousMentionedRoom": ["Alt+Shift+M"], "goToPreviousMentionedRoom": ["Alt+Shift+M"],
"goToNextMentionedRoom": ["Alt+M"], "goToNextMentionedRoom": ["Alt+M"],
"focusAccountAtIndex": {
"01": f"{ctrl_or_osx_ctrl()}+1",
"02": f"{ctrl_or_osx_ctrl()}+2",
"03": f"{ctrl_or_osx_ctrl()}+3",
"04": f"{ctrl_or_osx_ctrl()}+4",
"05": f"{ctrl_or_osx_ctrl()}+5",
"06": f"{ctrl_or_osx_ctrl()}+6",
"07": f"{ctrl_or_osx_ctrl()}+7",
"08": f"{ctrl_or_osx_ctrl()}+8",
"09": f"{ctrl_or_osx_ctrl()}+9",
"10": f"{ctrl_or_osx_ctrl()}+0",
},
# On OSX, alt+numbers if used for symbols, use cmd instead
"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",

View File

@ -69,7 +69,7 @@ HListView {
} }
function goToAccountNumber(num) { function goToAccountNumber(num) {
const index = Object.values(accountIndice).sort()[num] const index = Object.entries(accountIndice).sort()[num][1]
model.get(index + 1).type === "Room" ? model.get(index + 1).type === "Room" ?
currentIndex = index + 1 : currentIndex = index + 1 :
@ -205,6 +205,16 @@ HListView {
onActivated: cycleUnreadRooms(true, true) && showItemLimiter.restart() onActivated: cycleUnreadRooms(true, true) && showItemLimiter.restart()
} }
Repeater {
model: Object.keys(window.settings.keys.focusAccountAtIndex)
Item {
HShortcut {
sequence: window.settings.keys.focusAccountAtIndex[modelData]
onActivated: goToAccountNumber(parseInt(modelData - 1, 10))
}
}
}
Repeater { Repeater {
model: Object.keys(window.settings.keys.focusRoomAtIndex) model: Object.keys(window.settings.keys.focusRoomAtIndex)