Merge pull request #8707 from FeroTheFox/master

This commit is contained in:
Eugene 2023-07-16 23:02:58 +02:00 committed by GitHub
commit ddab79d3ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 80 additions and 23 deletions

View File

@ -92,8 +92,11 @@ export class Window {
if (this.configStore.appearance?.frame === 'native') { if (this.configStore.appearance?.frame === 'native') {
bwOptions.frame = true bwOptions.frame = true
} else { } else {
if (process.platform === 'darwin') { bwOptions.titleBarStyle = 'hidden'
bwOptions.titleBarStyle = 'hidden' if (process.platform === 'win32') {
bwOptions.titleBarOverlay = {
color: '#00000000',
}
} }
} }
@ -384,6 +387,21 @@ export class Window {
this.setVibrancy(enabled, type) this.setVibrancy(enabled, type)
}) })
ipcMain.on('window-set-window-controls-color', (event, theme) => {
if (!this.window || event.sender !== this.window.webContents) {
return
}
const symbolColor: string = theme.foreground
this.window.setTitleBarOverlay(
{
symbolColor: symbolColor,
height: 32,
},
)
})
ipcMain.on('window-set-title', (event, title) => { ipcMain.on('window-set-title', (event, title) => {
if (!this.window || event.sender !== this.window.webContents) { if (!this.window || event.sender !== this.window.webContents) {
return return

View File

@ -39,7 +39,7 @@
"cross-env": "7.0.3", "cross-env": "7.0.3",
"css-loader": "^6.7.3", "css-loader": "^6.7.3",
"deep-equal": "2.0.5", "deep-equal": "2.0.5",
"electron": "22.3.1", "electron": "^25.3.0",
"electron-builder": "^24.0.0-alpha.1", "electron-builder": "^24.0.0-alpha.1",
"electron-download": "^4.1.1", "electron-download": "^4.1.1",
"electron-installer-snap": "^5.1.0", "electron-installer-snap": "^5.1.0",

View File

@ -1,16 +1,20 @@
title-bar( title-bar(
*ngIf='ready && !hostWindow.isFullscreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"', *ngIf='ready && !hostWindow.isFullscreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"',
(dblclick)='hostWindow.toggleMaximize()', (dblclick)='hostWindow.toggleMaximize()',
[hideControls]='hostApp.platform !== Platform.Linux && !hostWindow.isFullscreen',
[class.inset]='hostApp.platform == Platform.macOS && !hostWindow.isFullscreen' [class.inset]='hostApp.platform == Platform.macOS && !hostWindow.isFullscreen'
) )
.content( .content(
*ngIf='ready', *ngIf='ready',
[class.tabs-on-top]='config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left"', [class.tabs-on-top]='config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left"',
[class.tabs-on-side]='hasVerticalTabs()', [class.tabs-on-left]='hasVerticalTabs() && config.store.appearance.tabsLocation == "left"',
[class.tabs-titlebar-enabled]='config.store.appearance.frame == "full"',
[class.tabs-on-right]='hasVerticalTabs() && config.store.appearance.tabsLocation == "right"',
) )
.tab-bar( .tab-bar(
*ngIf='!hostWindow.isFullscreen || config.store.appearance.tabsInFullscreen', *ngIf='!hostWindow.isFullscreen || config.store.appearance.tabsInFullscreen',
[class.tab-bar-no-controls-overlay]='hostApp.platform == Platform.macOS',
(dblclick)='hostWindow.toggleMaximize()' (dblclick)='hostWindow.toggleMaximize()'
) )
.inset.background(*ngIf='hostApp.platform == Platform.macOS \ .inset.background(*ngIf='hostApp.platform == Platform.macOS \
@ -81,9 +85,12 @@ title-bar(
window-controls.background( window-controls.background(
*ngIf='config.store.appearance.frame == "thin" \ *ngIf='config.store.appearance.frame == "thin" \
&& (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)', && (hostApp.platform == Platform.Linux)',
) )
div.window-controls-spacer(
*ngIf='config.store.appearance.frame == "thin" && (hostApp.platform == Platform.Windows) && (config.store.appearance.tabsLocation == "top")',
)
.content .content
start-page.content-tab.content-tab-active(*ngIf='ready && app.tabs.length == 0') start-page.content-tab.content-tab-active(*ngIf='ready && app.tabs.length == 0')

View File

@ -35,17 +35,16 @@ $tab-border-radius: 4px;
flex-direction: column; flex-direction: column;
} }
&.tabs-on-side { &.tabs-on-right {
flex-direction: row-reverse; flex-direction: row-reverse;
&.tabs-on-top {
flex-direction: row;
}
} }
&.tabs-on-left {
flex-direction: row;
}
} }
.content.tabs-on-side > .tab-bar { .content.tabs-on-left > .tab-bar, .content.tabs-on-right > .tab-bar {
height: 100%; height: 100%;
width: var(--side-tab-width); width: var(--side-tab-width);
overflow-y: auto; overflow-y: auto;
@ -76,6 +75,18 @@ $tab-border-radius: 4px;
} }
} }
.content.tabs-on-left > .tab-bar.tab-bar-no-controls-overlay, .content.tabs-titlebar-enabled {
.tabs {
padding-top: 0 !important;
}
}
.content.tabs-on-right > .tab-bar {
.tabs {
// Account for WCO on Windows.
padding-top: 36px;
}
}
.tab-bar { .tab-bar {
flex: none; flex: none;
@ -125,10 +136,17 @@ $tab-border-radius: 4px;
} }
&.persistent { &.persistent {
min-width: 72px; // 2 x 36 px height, ie 2 squares // min-width: 72px; // 2 x 36 px height, ie 2 squares
// Given WCO on Windows, the min-width of the window buttons is about 138px.
min-width: 138px;
} }
} }
&>.window-controls-spacer {
min-width: 138px;
height: 100%;
}
& > .inset { & > .inset {
width: calc(70px + 15px * var(--spaciness)); width: calc(70px + 15px * var(--spaciness));
height: var(--tabs-height); height: var(--tabs-height);

View File

@ -1,2 +1,2 @@
.title((dblclick)='hostWindow.toggleMaximize()') Tabby .title((dblclick)='hostWindow.toggleMaximize()') Tabby
window-controls window-controls(*ngIf="!hideControls")

View File

@ -1,4 +1,4 @@
import { Component } from '@angular/core' import { Component, Input } from '@angular/core'
import { HostWindowService } from '../api' import { HostWindowService } from '../api'
/** @hidden */ /** @hidden */
@ -8,5 +8,7 @@ import { HostWindowService } from '../api'
styleUrls: ['./titleBar.component.scss'], styleUrls: ['./titleBar.component.scss'],
}) })
export class TitleBarComponent { export class TitleBarComponent {
@Input() hideControls: boolean
constructor (public hostWindow: HostWindowService) { } constructor (public hostWindow: HostWindowService) { }
} }

View File

@ -99,6 +99,7 @@ export default class ElectronModule {
}) })
this.registerGlobalHotkey() this.registerGlobalHotkey()
this.updateVibrancy() this.updateVibrancy()
this.updateWindowControlsColor()
}) })
config.changed$.subscribe(() => { config.changed$.subscribe(() => {
@ -131,6 +132,8 @@ export default class ElectronModule {
config.changed$.subscribe(() => this.updateVibrancy()) config.changed$.subscribe(() => this.updateVibrancy())
config.changed$.subscribe(() => this.updateWindowControlsColor())
config.ready$.toPromise().then(() => { config.ready$.toPromise().then(() => {
dockMenu.update() dockMenu.update()
}) })
@ -169,6 +172,15 @@ export default class ElectronModule {
this.hostWindow.setOpacity(this.config.store.appearance.opacity) this.hostWindow.setOpacity(this.config.store.appearance.opacity)
} }
private updateWindowControlsColor () {
// if windows and not using native frame, WCO does not exist, return.
if (this.hostApp.platform === Platform.Windows && this.config.store.appearance.frame === 'native') {
return
}
this.electron.ipcRenderer.send('window-set-window-controls-color', this.config.store.terminal.colorScheme)
}
} }
export { ElectronHostWindow, ElectronHostAppService, ElectronService } export { ElectronHostWindow, ElectronHostAppService, ElectronService }

View File

@ -829,10 +829,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.1.tgz#e8a83f1aa8b649377bb1fb5d7bac5cb90e784dfe" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.1.tgz#e8a83f1aa8b649377bb1fb5d7bac5cb90e784dfe"
integrity sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg== integrity sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==
"@types/node@^16.11.26": "@types/node@^18.11.18":
version "16.11.26" version "18.16.19"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.26.tgz#63d204d136c9916fb4dcd1b50f9740fe86884e47" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea"
integrity sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ== integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==
"@types/parse5@^5": "@types/parse5@^5":
version "5.0.3" version "5.0.3"
@ -3066,13 +3066,13 @@ electron-to-chromium@^1.4.284:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz#0e039de59135f44ab9a8ec9025e53a9135eba11f" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz#0e039de59135f44ab9a8ec9025e53a9135eba11f"
integrity sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ== integrity sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==
electron@22.3.1: electron@^25.3.0:
version "22.3.1" version "25.3.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.1.tgz#a09769e6592cadbf45d7629c9143ffa2ef8a3842" resolved "https://registry.yarnpkg.com/electron/-/electron-25.3.0.tgz#e818ab3ebd3e7a45f8fca0f47e607c9af2dc92c7"
integrity sha512-iDltL9j12bINK3aOp8ZoGq4NFBFjJhw1AYHelbWj93XUCAIT4fdA+PRsq0aaTHg3bthLLlLRvIZVgNsZPqWcqg== integrity sha512-cyqotxN+AroP5h2IxUsJsmehYwP5LrFAOO7O7k9tILME3Sa1/POAg3shrhx4XEnaAMyMqMLxzGvkzCVxzEErnA==
dependencies: dependencies:
"@electron/get" "^2.0.0" "@electron/get" "^2.0.0"
"@types/node" "^16.11.26" "@types/node" "^18.11.18"
extract-zip "^2.0.1" extract-zip "^2.0.1"
elliptic@^6.5.3: elliptic@^6.5.3: