A full-featured download manager.
fix: send command no effect when no focused window
Dr_rOot71f3fb601bd9
diff --git a/src/main/Application.js b/src/main/Application.jsindex 7b8da609..4763a063 100644--- a/src/main/Application.js+++ b/src/main/Application.js@@ -83,6 +83,22 @@ export default class Application extends EventEmitter {this.touchBarManager.setup(page, win)}+ show (page = 'index') {+ this.showPage(page)+ }++ hide (page) {+ if (page) {+ this.windowManager.hideWindow(page)+ } else {+ this.windowManager.hideAllWindow()+ }+ }++ toggle (page = 'index') {+ this.windowManager.toggleWindow(page)+ }+closePage (page) {this.windowManager.destroyWindow(page)}@@ -126,8 +142,10 @@ export default class Application extends EventEmitter {if (is.dev() || is.mas()) {return}++ this.show()+this.protocolManager.handle(url)- this.showPage('index')}handleFile (path) {@@ -138,6 +156,8 @@ export default class Application extends EventEmitter {return}+ this.show()+const fileName = basename(path)fs.readFile(path, (err, data) => {if (err) {@@ -146,7 +166,7 @@ export default class Application extends EventEmitter {}const file = Buffer.from(data).toString('base64')const args = [fileName, file]- this.sendCommand('application:new-bt-task-with-file', ...args)+ this.sendCommandToAll('application:new-bt-task-with-file', ...args)})}@@ -210,8 +230,12 @@ export default class Application extends EventEmitter {app.exit()})- this.on('application:show', (page = 'index') => {- this.showPage(page)+ this.on('application:show', (page) => {+ this.show(page)+ })++ this.on('application:hide', (page) => {+ this.hide(page)})this.on('application:reset', () => {diff --git a/src/main/utils/menu.js b/src/main/utils/menu.jsindex c928b24b..7173f9b0 100644--- a/src/main/utils/menu.js+++ b/src/main/utils/menu.js@@ -96,7 +96,7 @@ export function handleCommand (item) {? [item.command, item['command-arg']]: [item.command]- global.application.sendCommand(...args)+ global.application.sendCommandAll(...args)handleCommandAfter(item)}@@ -108,7 +108,7 @@ function handleCommandBefore (item) {}const [ command, ...args ] = item['command-before'].split(',')console.log('handleCommandBefore==2=>', command, ...args)- global.application.sendCommand(command, ...args)+ global.application.sendCommandAll(command, ...args)}function handleCommandAfter (item) {@@ -118,7 +118,7 @@ function handleCommandAfter (item) {}const [ command, ...args ] = item['command-after'].split(',')console.log('handleCommandAfter==2=>', command, ...args)- global.application.sendCommand(command, ...args)+ global.application.sendCommandAll(command, ...args)}function acceleratorForCommand (command, keystrokesByCommand) {