mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-23 12:59:54 +00:00
let themes specify macos titlebar buttons offset - fixes #3507
This commit is contained in:
parent
b93989d02b
commit
e07c5db0a8
@ -88,7 +88,7 @@ export class Window {
|
|||||||
bwOptions.frame = true
|
bwOptions.frame = true
|
||||||
} else {
|
} else {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
bwOptions.titleBarStyle = 'hiddenInset'
|
bwOptions.titleBarStyle = 'hidden'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,4 +10,7 @@ export abstract class Theme {
|
|||||||
css: string
|
css: string
|
||||||
|
|
||||||
terminalBackground: string
|
terminalBackground: string
|
||||||
|
|
||||||
|
macOSWindowButtonsInsetX?: number
|
||||||
|
macOSWindowButtonsInsetY?: number
|
||||||
}
|
}
|
||||||
|
@ -299,6 +299,10 @@ export class HostAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTrafficLightInset (x: number, y: number): void {
|
||||||
|
this.getWindow().setTrafficLightPosition({ x, y })
|
||||||
|
}
|
||||||
|
|
||||||
relaunch (): void {
|
relaunch (): void {
|
||||||
if (this.isPortable) {
|
if (this.isPortable) {
|
||||||
this.electron.app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE })
|
this.electron.app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE })
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Inject, Injectable } from '@angular/core'
|
import { Inject, Injectable } from '@angular/core'
|
||||||
import { ConfigService } from '../services/config.service'
|
import { ConfigService } from '../services/config.service'
|
||||||
import { Theme } from '../api/theme'
|
import { Theme } from '../api/theme'
|
||||||
|
import { HostAppService, Platform } from './hostApp.service'
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ThemesService {
|
export class ThemesService {
|
||||||
@ -9,6 +10,7 @@ export class ThemesService {
|
|||||||
/** @hidden */
|
/** @hidden */
|
||||||
private constructor (
|
private constructor (
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
|
private hostApp: HostAppService,
|
||||||
@Inject(Theme) private themes: Theme[],
|
@Inject(Theme) private themes: Theme[],
|
||||||
) {
|
) {
|
||||||
this.applyCurrentTheme()
|
this.applyCurrentTheme()
|
||||||
@ -33,6 +35,12 @@ export class ThemesService {
|
|||||||
}
|
}
|
||||||
this.styleElement.textContent = theme.css
|
this.styleElement.textContent = theme.css
|
||||||
document.querySelector('style#custom-css')!.innerHTML = this.config.store.appearance.css
|
document.querySelector('style#custom-css')!.innerHTML = this.config.store.appearance.css
|
||||||
|
if (this.hostApp.platform === Platform.macOS) {
|
||||||
|
this.hostApp.setTrafficLightInset(
|
||||||
|
theme.macOSWindowButtonsInsetX ?? 14,
|
||||||
|
theme.macOSWindowButtonsInsetY ?? 22,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyCurrentTheme (): void {
|
private applyCurrentTheme (): void {
|
||||||
|
@ -16,6 +16,10 @@ app-root {
|
|||||||
height: 14px;
|
height: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inset {
|
||||||
|
width: 70 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
terminaltab .content {
|
terminaltab .content {
|
||||||
|
@ -15,6 +15,8 @@ export class StandardCompactTheme extends Theme {
|
|||||||
name = 'Compact'
|
name = 'Compact'
|
||||||
css = require('./theme.compact.scss')
|
css = require('./theme.compact.scss')
|
||||||
terminalBackground = '#222a33'
|
terminalBackground = '#222a33'
|
||||||
|
macOSWindowButtonsInsetX = 8
|
||||||
|
macOSWindowButtonsInsetY = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user