Remove focusWindow function
Not needed -- win.show() automatically focuses, unminimizes, and shows the window.
This commit is contained in:
@@ -106,7 +106,7 @@ function onOpen (e, torrentId) {
|
||||
// The confirmation dialog Chrome shows causes Chrome to steal back the focus.
|
||||
// Electron issue: https://github.com/atom/electron/issues/4338
|
||||
setTimeout(function () {
|
||||
windows.main.focus()
|
||||
windows.main.show()
|
||||
}, 100)
|
||||
} else {
|
||||
argv.push(torrentId)
|
||||
@@ -119,7 +119,7 @@ function onAppOpen (newArgv) {
|
||||
|
||||
if (app.ipcReady) {
|
||||
log('Second app instance opened, but was prevented:', newArgv)
|
||||
windows.main.focus()
|
||||
windows.main.show()
|
||||
|
||||
processArgv(newArgv)
|
||||
} else {
|
||||
|
||||
@@ -65,6 +65,7 @@ function init () {
|
||||
})
|
||||
|
||||
ipcMain.on('openItem', function (e, path) {
|
||||
ipc.on('show', (e, ...args) => windows.main.show(...args))
|
||||
log('open item: ' + path)
|
||||
electron.shell.openItem(path)
|
||||
})
|
||||
@@ -87,10 +88,6 @@ function init () {
|
||||
shortcuts.onPlayerOpen()
|
||||
})
|
||||
|
||||
ipcMain.on('focusWindow', function (e, windowName) {
|
||||
windows.focusWindow(windows[windowName])
|
||||
})
|
||||
|
||||
ipcMain.on('downloadFinished', function (e, filePath) {
|
||||
if (app.dock) {
|
||||
// Bounces the Downloads stack if the filePath is inside the Downloads folder.
|
||||
|
||||
@@ -3,14 +3,12 @@ var about = module.exports = {
|
||||
win: null
|
||||
}
|
||||
|
||||
var electron = require('electron')
|
||||
|
||||
var config = require('../../config')
|
||||
var util = require('./util')
|
||||
var electron = require('electron')
|
||||
|
||||
function create () {
|
||||
if (about.win) {
|
||||
return util.focusWindow(about.win)
|
||||
return about.win.show()
|
||||
}
|
||||
|
||||
var win = about.win = new electron.BrowserWindow({
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var main = module.exports = {
|
||||
create,
|
||||
focus,
|
||||
hide,
|
||||
send,
|
||||
show,
|
||||
@@ -16,14 +15,13 @@ var config = require('../../config')
|
||||
var log = require('../log')
|
||||
var menu = require('../menu')
|
||||
var tray = require('../tray')
|
||||
var util = require('./util')
|
||||
|
||||
var HEADER_HEIGHT = 37
|
||||
var TORRENT_HEIGHT = 100
|
||||
|
||||
function create () {
|
||||
if (main.win) {
|
||||
return util.focusWindow(main.win)
|
||||
return main.win.show()
|
||||
}
|
||||
var win = main.win = new electron.BrowserWindow({
|
||||
backgroundColor: '#1E1E1E',
|
||||
@@ -109,7 +107,4 @@ function hide () {
|
||||
main.win.hide()
|
||||
}
|
||||
|
||||
function focus () {
|
||||
if (!main.win) return
|
||||
util.focusWindow(main.win)
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
module.exports = {
|
||||
focusWindow
|
||||
}
|
||||
|
||||
function focusWindow (win) {
|
||||
if (win.isMinimized()) {
|
||||
// TODO: can this be removed?
|
||||
win.restore()
|
||||
}
|
||||
win.show() // shows and gives focus
|
||||
}
|
||||
@@ -1320,7 +1320,7 @@ function showDoneNotification (torrent) {
|
||||
})
|
||||
|
||||
notif.onclick = function () {
|
||||
ipcRenderer.send('focusWindow', 'main')
|
||||
ipcRenderer.send('show')
|
||||
}
|
||||
|
||||
sound.play('DONE')
|
||||
|
||||
Reference in New Issue
Block a user