Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Window Controls Overlay #8707

Merged
merged 12 commits into from
Jul 16, 2023
Prev Previous commit
Next Next commit
fix: WCO color, settings icon position
  • Loading branch information
ferothefox committed Jul 14, 2023
commit e38b826fd69d30f6116a6805ad4205176db09e5d
21 changes: 18 additions & 3 deletions app/lib/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@
bwOptions.titleBarStyle = 'hidden'
// If not macOS and native appearance is not toggled, use WCO.
} else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does WCO work on Linux? This code path implies it does, the comment in titleBar.component.scss implies it doesn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, but good catch, will fix

bwOptions.titleBarStyle = 'hidden',
bwOptions.titleBarStyle = 'hidden'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be moved out of the if

bwOptions.titleBarOverlay = {
color: '#00000000',
symbolColor: '#ffffff',
height: 32,
}
}
}
Expand Down Expand Up @@ -394,6 +392,23 @@
this.setVibrancy(enabled, type)
})

ipcMain.on('window-set-window-controls-color', (event, theme) => {
if (!this.window || event.sender !== this.window.webContents) {
return
}

// let color: string = theme.backgroundMore
let symbolColor: string = theme.foreground

Check failure on line 401 in app/lib/window.ts

View workflow job for this annotation

GitHub Actions / Lint

'symbolColor' is never reassigned. Use 'const' instead

this.window.setTitleBarOverlay(
{
// color: '#00000000',
symbolColor: symbolColor,
height: 32,
}

Check failure on line 408 in app/lib/window.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing trailing comma
)
})

ipcMain.on('window-set-title', (event, title) => {
if (!this.window || event.sender !== this.window.webContents) {
return
Expand Down
5 changes: 5 additions & 0 deletions tabby-core/src/components/appRoot.component.pug
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ title-bar(
&& (hostApp.platform == Platform.Linux)',
)

div.window-controls-spacer(
*ngIf='config.store.appearance.frame == "thin" \
&& (hostApp.platform == Platform.Windows)',
)

.content
start-page.content-tab.content-tab-active(*ngIf='ready && app.tabs.length == 0')

Expand Down
5 changes: 5 additions & 0 deletions tabby-core/src/components/appRoot.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ $tab-border-radius: 4px;
}
}

&>.window-controls-spacer {
min-width: 138px;
height: 100%;
}

& > .inset {
width: calc(70px + 15px * var(--spaciness));
height: var(--tabs-height);
Expand Down
12 changes: 12 additions & 0 deletions tabby-electron/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
})
this.registerGlobalHotkey()
this.updateVibrancy()
this.updateWindowControlsColor()
})

config.changed$.subscribe(() => {
Expand Down Expand Up @@ -131,6 +132,8 @@

config.changed$.subscribe(() => this.updateVibrancy())

config.changed$.subscribe(() => this.updateWindowControlsColor())

config.ready$.toPromise().then(() => {
dockMenu.update()
})
Expand Down Expand Up @@ -169,6 +172,15 @@

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") {

Check failure on line 178 in tabby-electron/src/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected '===' and instead saw '=='

Check failure on line 178 in tabby-electron/src/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Strings must use singlequote
return
}

this.electron.ipcRenderer.send('window-set-window-controls-color', this.config.store.terminal.colorScheme)
}
}

export { ElectronHostWindow, ElectronHostAppService, ElectronService }
Loading