Skip to content

Commit e30cfdf

Browse files
committed
fix focusing bug
1 parent b07fb92 commit e30cfdf

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

browser/finder/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ const { remote } = electron
1515
const { Menu } = remote
1616

1717
function hideFinder () {
18-
if (process.platform === 'win32') {
19-
remote.getCurrentWindow().minimize()
20-
return
18+
let finderWindow = remote.getCurrentWindow()
19+
if (global.process.platform === 'win32') {
20+
finderWindow.blur()
21+
finderWindow.hide()
2122
}
22-
if (process.platform === 'darwin') {
23+
if (global.process.platform === 'darwin') {
2324
Menu.sendActionToFirstResponder('hide:')
2425
}
2526
remote.getCurrentWindow().hide()
@@ -48,6 +49,7 @@ class FinderMain extends React.Component {
4849
}
4950

5051
componentDidMount () {
52+
this.refs.search.focus()
5153
window.addEventListener('focus', this.focusHandler)
5254
window.addEventListener('blur', this.blurHandler)
5355
}

browser/finder/ipcClient.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@ function toggleFinder () {
3030
finderWindow.show()
3131
}
3232
} else {
33-
if (!finderWindow.isMinimized()) {
34-
finderWindow.minimize()
33+
if (finderWindow.isVisible()) {
34+
finderWindow.blur()
35+
finderWindow.hide()
3536
} else {
3637
nodeIpc.of.node.emit('request-data')
37-
finderWindow.restore()
38+
finderWindow.show()
39+
finderWindow.focus()
3840
}
41+
// if (!finderWindow.isMinimized()) {
42+
// finderWindow.minimize()
43+
// } else {
44+
// nodeIpc.of.node.emit('request-data')
45+
// finderWindow.restore()
46+
// finderWindow.focus()
47+
// }
3948
}
4049
}
4150

0 commit comments

Comments
 (0)