mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Bring focus to main window when clicking preferences (#235)
This commit is contained in:
parent
08fc3311f9
commit
fa4033937e
2 changed files with 8 additions and 1 deletions
7
index.js
7
index.js
|
|
@ -41,10 +41,10 @@ app.on('window-all-closed', () => {
|
|||
});
|
||||
|
||||
let winCount = 0;
|
||||
|
||||
app.on('ready', () => {
|
||||
function createWindow (fn) {
|
||||
const cfg = plugins.getDecoratedConfig();
|
||||
|
||||
const win = new BrowserWindow({
|
||||
width: 540,
|
||||
height: 380,
|
||||
|
|
@ -59,6 +59,7 @@ app.on('ready', () => {
|
|||
// is ready for user input
|
||||
show: process.env.HYPERTERM_DEBUG || isDev
|
||||
});
|
||||
|
||||
winCount++;
|
||||
win.loadURL(url);
|
||||
|
||||
|
|
@ -72,6 +73,7 @@ app.on('ready', () => {
|
|||
|
||||
rpc.on('init', () => {
|
||||
win.show();
|
||||
if (fn) fn(win);
|
||||
|
||||
// auto updates
|
||||
if (!isDev) {
|
||||
|
|
@ -112,6 +114,7 @@ app.on('ready', () => {
|
|||
// on Session and focus/blur to subscribe
|
||||
rpc.on('focus', ({ uid }) => {
|
||||
const session = sessions.get(uid);
|
||||
|
||||
if (session) {
|
||||
session.focus();
|
||||
} else {
|
||||
|
|
@ -121,6 +124,7 @@ app.on('ready', () => {
|
|||
|
||||
rpc.on('blur', ({ uid }) => {
|
||||
const session = sessions.get(uid);
|
||||
|
||||
if (session) {
|
||||
session.blur();
|
||||
} else {
|
||||
|
|
@ -218,6 +222,7 @@ app.on('ready', () => {
|
|||
plugins.updatePlugins({ force: true });
|
||||
}
|
||||
}));
|
||||
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(tpl));
|
||||
};
|
||||
|
||||
|
|
|
|||
2
menu.js
2
menu.js
|
|
@ -23,6 +23,8 @@ module.exports = function createMenu ({ createWindow, updatePlugins }) {
|
|||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.rpc.emit('preferences');
|
||||
} else {
|
||||
createWindow(win => win.rpc.emit('preferences'));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue