Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
Add keyboard shortcut for closing active conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
BHSPitMonkey committed Jun 29, 2016
1 parent bad6c91 commit 337d081
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Downloads are available on the [Releases](https://github.com/BHSPitMonkey/hipcha
* `Ctrl`+`N`: Start a new chat
* `Ctrl`+`PgUp`: Navigate up one room
* `Ctrl`+`PgDn`: Navigate down one room
* `Ctrl`+`W`: Close the active conversation
* `Ctrl`+`G`: Go to next room with unread messages
* `Ctrl`+`Q`: Quit application

Expand Down
7 changes: 6 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ app.on('ready', function() {
mainWindow.webContents.send('jump-to-unread');
}

// Close the currently active room or chat
function closeRoom() {
mainWindow.webContents.send('close-room');
}

// Spawn a new chat
function newChat() {
showAndFocusWindow();
Expand Down Expand Up @@ -215,6 +220,7 @@ app.on('ready', function() {
{ label: "New Chat", accelerator: 'CmdOrCtrl+N', click: newChat },
{ label: "Invite to Room", click: function() { sendKeyboardShortcut('I', true); } },
{ label: "Go To Unread Message", accelerator: 'CmdOrCtrl+G', click: goToUnread },
{ label: "Close Room", accelerator: 'CmdOrCtrl+W', click: closeRoom },
{ label: "Previous Room", visible: false, accelerator: 'CmdOrCtrl+PageUp', click: function() { sendKeyboardShortcut('Up', true, true); } },
{ label: "Previous Room", visible: false, accelerator: 'CmdOrCtrl+Shift+Tab', click: function() { sendKeyboardShortcut('Up', true, true); } },
{ label: "Next Room", visible: false, accelerator: 'CmdOrCtrl+PageDown', click: function() { sendKeyboardShortcut('Down', true, true); } },
Expand Down Expand Up @@ -316,7 +322,6 @@ app.on('ready', function() {
},
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
]
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "HipChat Electron",
"description": "An unofficial HipChat client based on the web client and Electron.",
"author": "Stephen Eisenhauer <bhs2007@gmail.com> (http://stepheneisenhauer.com)",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://github.com/BHSPitMonkey/hipchat-electron",
"license": "MIT",
"main": "main.js",
Expand Down
6 changes: 6 additions & 0 deletions app/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ electron.ipcRenderer.on('jump-to-unread', function(event, message) {

refreshMentionCount();
});

// Handle close-room command from main process
electron.ipcRenderer.on('close-room', function(event, message) {
// Click the close icon in the selected nav entry
$('.aui-nav-selected').find('.hc-close-icon').click()
});

0 comments on commit 337d081

Please sign in to comment.