1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-23 05:03:36 +03:00

fixed window-restore icon - fixes #2712

This commit is contained in:
Eugene Pankov 2021-06-28 21:50:16 +02:00
parent 63355d1a74
commit 30265699d4
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
5 changed files with 21 additions and 15 deletions

View File

@ -304,17 +304,6 @@ export class Window {
})
})
ipcMain.on('window-toggle-maximize', event => {
if (!this.window || event.sender !== this.window.webContents) {
return
}
if (this.window.isMaximized()) {
this.window.unmaximize()
} else {
this.window.maximize()
}
})
ipcMain.on('window-minimize', event => {
if (!this.window || event.sender !== this.window.webContents) {
return

View File

@ -24,6 +24,7 @@ export abstract class HostWindowService {
abstract setTitle (title?: string): void
abstract toggleFullscreen (): void
abstract minimize (): void
abstract isMaximized (): boolean
abstract toggleMaximize (): void
abstract close (): void

View File

@ -3,11 +3,15 @@ button.btn.btn-secondary.btn-minimize(
)
svg(version='1.1', width='10', height='10')
path(d='M 0,5 10,5 10,6 0,6 Z')
button.btn.btn-secondary.btn-maximize(
(click)='hostWindow.toggleMaximize()',
)
button.btn.btn-secondary.btn-maximize((click)='hostWindow.toggleMaximize()', *ngIf='!hostWindow.isMaximized()')
svg(version='1.1', width='10', height='10')
path(d='M 0,0 0,10 10,10 10,0 Z M 1,1 9,1 9,9 1,9 Z')
button.btn.btn-secondary.btn-maximize((click)='hostWindow.toggleMaximize()', *ngIf='hostWindow.isMaximized()')
svg(version='1.1', width='10', height='10', viewBox='0 0 512 512')
path(d="M464 0H144c-26.5 0-48 21.5-48 48v48H48c-26.5 0-48 21.5-48 48v320c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h48c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM32 144c0-8.8 7.2-16 16-16h320c8.8 0 16 7.2 16 16v80H32v-80zm352 320c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V256h352v208zm96-96c0 8.8-7.2 16-16 16h-48V144c0-26.5-21.5-48-48-48H128V48c0-8.8 7.2-16 16-16h320c8.8 0 16 7.2 16 16v320z")
button.btn.btn-secondary.btn-close(
(click)='closeWindow()'
)

View File

@ -71,8 +71,16 @@ export class ElectronHostWindow extends HostWindowService {
this.electron.ipcRenderer.send('window-minimize')
}
isMaximized (): boolean {
return this.getWindow().isMaximized()
}
toggleMaximize (): void {
this.electron.ipcRenderer.send('window-toggle-maximize')
if (this.getWindow().isMaximized()) {
this.getWindow().unmaximize()
} else {
this.getWindow().maximize()
}
}
close (): void {

View File

@ -31,6 +31,10 @@ export class WebHostWindow extends HostWindowService {
throw new Error('Unavailable')
}
isMaximized (): boolean {
return true
}
toggleMaximize (): void {
throw new Error('Unavailable')
}