mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
add support for editing preferences with cmd+, (#52)
This commit is contained in:
parent
952c328e01
commit
d3322090a1
2 changed files with 25 additions and 0 deletions
|
|
@ -258,6 +258,7 @@ export default class HyperTerm extends Component {
|
|||
this.rpc.on('reset font size', this.resetFontSize);
|
||||
|
||||
this.rpc.on('update available', this.onUpdateAvailable);
|
||||
this.rpc.on('preferences', this.editPreferences.bind(this));
|
||||
}
|
||||
|
||||
clearCurrentTerm () {
|
||||
|
|
@ -273,6 +274,21 @@ export default class HyperTerm extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
editPreferences () {
|
||||
this.requestTab();
|
||||
const onsession = ({ uid: _uid }) => {
|
||||
const ondata = ({ uid }) => {
|
||||
if (uid !== _uid) return;
|
||||
this.rpc.removeListener('data', ondata);
|
||||
this.rpc.emit('data', { uid, data: '# Attempting to open ~/.hyperterm.js with your $EDITOR\n' +
|
||||
'# If this doesn\'t work, open it manually with your favorite editor!\n' +
|
||||
'$EDITOR ~/.hyperterm.js\n' });
|
||||
};
|
||||
this.rpc.on('data', ondata);
|
||||
};
|
||||
this.rpc.once('new session', onsession);
|
||||
}
|
||||
|
||||
moveTo (n) {
|
||||
if (this.state.sessions[n]) {
|
||||
this.setActive(n);
|
||||
|
|
|
|||
9
menu.js
9
menu.js
|
|
@ -15,6 +15,15 @@ module.exports = function createMenu ({ createWindow }) {
|
|||
{
|
||||
role: 'about'
|
||||
},
|
||||
{
|
||||
label: 'Preferences...',
|
||||
accelerator: 'Cmd+,',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.rpc.emit('preferences');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue