diff --git a/app.js b/app.js index 902591d8..7cf1c650 100644 --- a/app.js +++ b/app.js @@ -124,3 +124,7 @@ ipc.on('reloadCurrentService', function(e) { var tab = Ext.cq1('app-main').getActiveTab(); if ( tab.id !== 'ramboxTab' ) tab.reloadService(); }); +// Focus the current service when Alt + Tab or click in webviews textfields +window.addEventListener('focus', function() { + if(Ext.cq1("app-main")) Ext.cq1("app-main").getActiveTab().down('component').el.dom.focus(); +}); diff --git a/electron/main.js b/electron/main.js index f0fd5ca7..f613a45c 100644 --- a/electron/main.js +++ b/electron/main.js @@ -184,10 +184,7 @@ function createWindow () { // Navigate the window forward when the user hits their mouse forward button if ( cmd === 'browser-forward' ) mainWindow.webContents.executeJavaScript('if(Ext.cq1("app-main")) Ext.cq1("app-main").getActiveTab().goForward();'); }); - mainWindow.on('focus', (e) => { - // Make focus on current service when user use Alt + Tab to activate Rambox - mainWindow.webContents.executeJavaScript('if(Ext.cq1("app-main")) Ext.cq1("app-main").fireEvent("tabchange", Ext.cq1("app-main"), Ext.cq1("app-main").getActiveTab());'); - }); + // Emitted when the window is closed. mainWindow.on('close', function(e) { if ( !isQuitting ) {