提交 4426d482 编写于 作者: E Eugene Pankov

bring window to front when called from CLI (fixes #489)

上级 215ddf0e
...@@ -224,6 +224,17 @@ export class Window { ...@@ -224,6 +224,17 @@ export class Window {
this.window.setTitle(title) this.window.setTitle(title)
}) })
ipcMain.on('window-bring-to-front', event => {
if (event.sender !== this.window.webContents) {
return
}
if (this.window.isMinimized()) {
this.window.restore()
}
this.window.show()
this.window.moveTop()
})
this.window.webContents.on('new-window', event => event.preventDefault()) this.window.webContents.on('new-window', event => event.preventDefault())
} }
......
...@@ -180,6 +180,10 @@ export class HostAppService { ...@@ -180,6 +180,10 @@ export class HostAppService {
this.electron.ipcRenderer.send('app:ready') this.electron.ipcRenderer.send('app:ready')
} }
bringToFront () {
this.electron.ipcRenderer.send('window-bring-to-front')
}
quit () { quit () {
this.logger.info('Quitting') this.logger.info('Quitting')
this.electron.app.quit() this.electron.app.quit()
......
...@@ -163,6 +163,7 @@ export default class TerminalModule { ...@@ -163,6 +163,7 @@ export default class TerminalModule {
if (await fs.exists(directory)) { if (await fs.exists(directory)) {
if ((await fs.stat(directory)).isDirectory()) { if ((await fs.stat(directory)).isDirectory()) {
terminal.openTab(null, directory) terminal.openTab(null, directory)
hostApp.bringToFront()
} }
} }
}) })
...@@ -172,10 +173,12 @@ export default class TerminalModule { ...@@ -172,10 +173,12 @@ export default class TerminalModule {
command: command[0], command: command[0],
args: command.slice(1), args: command.slice(1),
}, null, true) }, null, true)
hostApp.bringToFront()
}) })
hostApp.cliPaste$.subscribe(text => { hostApp.cliPaste$.subscribe(text => {
if (app.activeTab instanceof TerminalTabComponent && app.activeTab.session) { if (app.activeTab instanceof TerminalTabComponent && app.activeTab.session) {
(app.activeTab as TerminalTabComponent).sendInput(text) (app.activeTab as TerminalTabComponent).sendInput(text)
hostApp.bringToFront()
} }
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册