From cb7f1aa9168c40d0872d713ce444b7000c7b0c9b Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 14 Aug 2015 16:30:19 +0100 Subject: [PATCH] ctrl-alt-num to change rooms --- src/controllers/pages/MatrixChat.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 7c32a66d..08cc652d 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -174,6 +174,19 @@ module.exports = { }); this.notifyNewScreen('room/'+allRooms[roomIndex].roomId); break; + case 'view_indexed_room': + var allRooms = RoomListSorter.mostRecentActivityFirst( + MatrixClientPeg.get().getRooms() + ); + var roomIndex = payload.roomIndex; + if (allRooms[roomIndex]) { + this.focusComposer = true; + this.setState({ + currentRoom: allRooms[roomIndex].roomId + }); + this.notifyNewScreen('room/'+allRooms[roomIndex].roomId); + } + break; case 'view_user_settings': this.setState({ page_type: this.PageTypes.UserSettings, @@ -247,6 +260,15 @@ module.exports = { onKeyDown: function(ev) { if (ev.altKey) { + if (ev.ctrlKey && ev.keyCode > 48 && ev.keyCode < 58) { + dis.dispatch({ + action: 'view_indexed_room', + roomIndex: ev.keyCode - 49, + }); + ev.stopPropagation(); + ev.preventDefault(); + return; + } switch (ev.keyCode) { case 38: dis.dispatch({action: 'view_prev_room'});