Skip to content

Commit

Permalink
fix: bug where window didnt get focus after closing search
Browse files Browse the repository at this point in the history
  • Loading branch information
pdepip committed Apr 16, 2020
1 parent 05e76f7 commit aecdf30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, globalShortcut } from 'electron';
import { app, ipcMain, BrowserWindow, globalShortcut } from 'electron';
import log from 'electron-log';

import { EditorWindow } from '../windows/editor';
Expand Down Expand Up @@ -105,6 +105,14 @@ class App {
appUpdater();
}

ipcMain.on('kb::hide-search', () => {
if (this.editorWindow &&
this.editorWindow.browserWindow &&
!this.editorWindow.browserWindow.isVisible()) {
app.hide();
}
});

createTray()
};

Expand Down
4 changes: 4 additions & 0 deletions src/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ ipcRenderer.on('rnd::clear-search', (e) => {
store.dispatch(setQuery(""))
});

ipcRenderer.on('rnd::hide-search', (e) => {
ipcRenderer.send('kb::hide-search')
});


ReactDOM.render(<App store={store} history={history} />, mainElement);

0 comments on commit aecdf30

Please sign in to comment.