From 09c85e806927099d7874b74fb1352f166a61d514 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sat, 2 Jul 2016 10:53:39 -0700 Subject: [PATCH] hyperterm: add `ctrl+c` for closing instead of `cmd+w` (#2) --- app/hyperterm.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/hyperterm.js b/app/hyperterm.js index 4d2d3fa8..69ecc8bb 100644 --- a/app/hyperterm.js +++ b/app/hyperterm.js @@ -103,16 +103,16 @@ export default class HyperTerm extends Component { closeTab () { if (this.state.sessions.length) { const uid = this.state.sessions[this.state.active]; + this.rpc.emit('exit', { uid }); + } + } - if (this.state.urls[uid]) { - // if we have a url loaded, closing a tab - // instead closes the url - const urls = Object.assign({}, this.state.urls); - delete urls[uid]; - this.setState({ urls }); - } else { - this.rpc.emit('exit', { uid }); - } + closeBrowser () { + const uid = this.state.sessions[this.state.active]; + if (this.state.urls[uid]) { + const urls = Object.assign({}, this.state.urls); + delete urls[uid]; + this.setState({ urls }); } } @@ -225,6 +225,8 @@ export default class HyperTerm extends Component { Mousetrap.bind('command+8', this.moveTo.bind(this, 7)); Mousetrap.bind('command+9', this.moveTo.bind(this, 8)); + Mousetrap.bind('ctrl+c', this.closeBrowser.bind(this)); + Mousetrap.bind('command+shift+left', this.moveLeft); Mousetrap.bind('command+shift+right', this.moveRight);