mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-19 10:59:54 +00:00
reconfigure terminals on DPI change (fixes #576)
This commit is contained in:
parent
100436f511
commit
329d0448d3
@ -1,4 +1,5 @@
|
|||||||
import { app, ipcMain, Menu, Tray, shell } from 'electron'
|
import { app, ipcMain, Menu, Tray, shell } from 'electron'
|
||||||
|
import * as electron from 'electron'
|
||||||
import { loadConfig } from './config'
|
import { loadConfig } from './config'
|
||||||
import { Window, WindowOptions } from './window'
|
import { Window, WindowOptions } from './window'
|
||||||
|
|
||||||
@ -21,6 +22,10 @@ export class Application {
|
|||||||
app.commandLine.appendSwitch('lang', 'EN')
|
app.commandLine.appendSwitch('lang', 'EN')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init () {
|
||||||
|
electron.screen.on('display-metrics-changed', () => this.broadcast('host:display-metrics-changed'))
|
||||||
|
}
|
||||||
|
|
||||||
async newWindow (options?: WindowOptions): Promise<Window> {
|
async newWindow (options?: WindowOptions): Promise<Window> {
|
||||||
let window = new Window(options)
|
let window = new Window(options)
|
||||||
this.windows.push(window)
|
this.windows.push(window)
|
||||||
|
@ -58,5 +58,6 @@ app.on('ready', () => {
|
|||||||
}
|
}
|
||||||
]))
|
]))
|
||||||
}
|
}
|
||||||
|
application.init()
|
||||||
application.newWindow({ hidden: argv.hidden })
|
application.newWindow({ hidden: argv.hidden })
|
||||||
})
|
})
|
||||||
|
@ -31,6 +31,7 @@ export class HostAppService {
|
|||||||
private configChangeBroadcast = new Subject<void>()
|
private configChangeBroadcast = new Subject<void>()
|
||||||
private windowCloseRequest = new Subject<void>()
|
private windowCloseRequest = new Subject<void>()
|
||||||
private windowMoved = new Subject<void>()
|
private windowMoved = new Subject<void>()
|
||||||
|
private displayMetricsChanged = new Subject<void>()
|
||||||
private logger: Logger
|
private logger: Logger
|
||||||
private windowId: number
|
private windowId: number
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ export class HostAppService {
|
|||||||
get configChangeBroadcast$ (): Observable<void> { return this.configChangeBroadcast }
|
get configChangeBroadcast$ (): Observable<void> { return this.configChangeBroadcast }
|
||||||
get windowCloseRequest$ (): Observable<void> { return this.windowCloseRequest }
|
get windowCloseRequest$ (): Observable<void> { return this.windowCloseRequest }
|
||||||
get windowMoved$ (): Observable<void> { return this.windowMoved }
|
get windowMoved$ (): Observable<void> { return this.windowMoved }
|
||||||
|
get displayMetricsChanged$ (): Observable<void> { return this.displayMetricsChanged }
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
@ -86,6 +88,10 @@ export class HostAppService {
|
|||||||
this.zone.run(() => this.windowMoved.next())
|
this.zone.run(() => this.windowMoved.next())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
electron.ipcRenderer.on('host:display-metrics-changed', () => {
|
||||||
|
this.zone.run(() => this.displayMetricsChanged.next())
|
||||||
|
})
|
||||||
|
|
||||||
electron.ipcRenderer.on('host:second-instance', (_$event, argv: any, cwd: string) => this.zone.run(() => {
|
electron.ipcRenderer.on('host:second-instance', (_$event, argv: any, cwd: string) => this.zone.run(() => {
|
||||||
this.logger.info('Second instance', argv)
|
this.logger.info('Second instance', argv)
|
||||||
const op = argv._[0]
|
const op = argv._[0]
|
||||||
|
@ -265,6 +265,10 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
this.hostApp.windowMoved$.subscribe(() => setTimeout(() => {
|
this.hostApp.windowMoved$.subscribe(() => setTimeout(() => {
|
||||||
this.configure()
|
this.configure()
|
||||||
}, 250)),
|
}, 250)),
|
||||||
|
|
||||||
|
this.hostApp.displayMetricsChanged$.subscribe(() => setTimeout(() => {
|
||||||
|
this.configure()
|
||||||
|
}, 250)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user