diff --git a/TODO.md b/TODO.md index b82fc07e..d18216e4 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,5 @@ # TODO -- add account number binds - revise pane collapse mode - fix python getting stuck when loading large room diff --git a/src/backend/user_files.py b/src/backend/user_files.py index 4e70ec9f..a5c77d74 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -214,6 +214,10 @@ class UISettings(JSONDataFile): 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: # Ctrl in Qt corresponds to Cmd on OSX return "Ctrl" if platform.system() == "Darwin" else "Alt" @@ -278,6 +282,19 @@ class UISettings(JSONDataFile): "goToPreviousMentionedRoom": ["Alt+Shift+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": { "01": f"{alt_or_cmd()}+1", "02": f"{alt_or_cmd()}+2", diff --git a/src/gui/MainPane/RoomList.qml b/src/gui/MainPane/RoomList.qml index 55b9e38d..51634ca8 100644 --- a/src/gui/MainPane/RoomList.qml +++ b/src/gui/MainPane/RoomList.qml @@ -69,7 +69,7 @@ HListView { } function goToAccountNumber(num) { - const index = Object.values(accountIndice).sort()[num] + const index = Object.entries(accountIndice).sort()[num][1] model.get(index + 1).type === "Room" ? currentIndex = index + 1 : @@ -205,6 +205,16 @@ HListView { 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 { model: Object.keys(window.settings.keys.focusRoomAtIndex)