less sync ipc

This commit is contained in:
Eugene Pankov
2021-09-25 18:11:35 +02:00
parent 1852486818
commit e3e01558b2
3 changed files with 31 additions and 7 deletions

View File

@@ -59,10 +59,10 @@ export default class ElectronModule {
themeService.themeChanged$.subscribe(theme => {
if (hostApp.platform === Platform.macOS) {
hostWindow.getWindow().setTrafficLightPosition({
x: theme.macOSWindowButtonsInsetX ?? 14,
y: theme.macOSWindowButtonsInsetY ?? 11,
})
hostWindow.setTrafficLightPosition(
theme.macOSWindowButtonsInsetX ?? 14,
theme.macOSWindowButtonsInsetY ?? 11,
)
}
})
@@ -73,9 +73,9 @@ export default class ElectronModule {
return
}
if (progress !== null) {
hostWindow.getWindow().setProgressBar(progress / 100.0, { mode: 'normal' })
hostWindow.setProgressBar(progress / 100.0)
} else {
hostWindow.getWindow().setProgressBar(-1, { mode: 'none' })
hostWindow.setProgressBar(-1)
}
lastProgress = progress
})
@@ -116,7 +116,7 @@ export default class ElectronModule {
document.body.classList.toggle('vibrant', this.config.store.appearance.vibrancy)
this.electron.ipcRenderer.send('window-set-vibrancy', this.config.store.appearance.vibrancy, vibrancyType)
this.hostWindow.getWindow().setOpacity(this.config.store.appearance.opacity)
this.hostWindow.setOpacity(this.config.store.appearance.opacity)
}
}

View File

@@ -97,6 +97,18 @@ export class ElectronHostWindow extends HostWindowService {
this.getWindow().setTouchBar(touchBar)
}
setTrafficLightPosition (x: number, y: number): void {
this.electron.ipcRenderer.send('window-set-traffic-light-position', x, y)
}
setOpacity (opacity: number): void {
this.electron.ipcRenderer.send('window-set-opacity', opacity)
}
setProgressBar (value: number): void {
this.electron.ipcRenderer.send('window-set-progress-bar', value)
}
bringToFront (): void {
this.electron.ipcRenderer.send('window-bring-to-front')
}