Add native titlebar setting (#837)

This commit is contained in:
Evan Simkowitz 2024-09-24 22:05:38 -07:00 committed by GitHub
parent 8de1c53c1e
commit 0f09a70836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 10 deletions

View File

@ -96,7 +96,7 @@ tasks:
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
GO_ENV_VARS:
sh: echo "CC=\"zig cc -target {{if eq "arm" ARCH}}aarch64{{else}}x86_64{{end}}-linux-gnu.2.23\""
sh: echo "CC=\"zig cc -target {{if eq "arm" ARCH}}aarch64-linux-gnu{{else}}x86_64-linux-gnu.2.23{{end}}\""
build:server:internal:
requires:

View File

@ -336,8 +336,10 @@ function createBrowserWindow(clientId: string, waveWindow: WaveWindow, fullConfi
height: winHeight,
};
winBounds = ensureBoundsAreVisible(winBounds);
const settings = fullConfig?.settings;
const winOpts: Electron.BrowserWindowConstructorOptions = {
titleBarStyle: unamePlatform === "darwin" ? "hiddenInset" : "hidden",
titleBarStyle:
unamePlatform === "darwin" ? "hiddenInset" : settings["window:nativetitlebar"] ? "default" : "hidden",
titleBarOverlay:
unamePlatform !== "darwin"
? {
@ -362,7 +364,6 @@ function createBrowserWindow(clientId: string, waveWindow: WaveWindow, fullConfi
show: false,
autoHideMenuBar: true,
};
const settings = fullConfig?.settings;
const isTransparent = settings?.["window:transparent"] ?? false;
const isBlur = !isTransparent && (settings?.["window:blur"] ?? false);
if (isTransparent) {
@ -652,6 +653,10 @@ if (unamePlatform !== "darwin") {
const fac = new FastAverageColor();
electron.ipcMain.on("update-window-controls-overlay", async (event, rect: Dimensions) => {
// Bail out if the user requests the native titlebar
const fullConfig = await services.FileService.GetFullConfig();
if (fullConfig.settings["window:nativetitlebar"]) return;
const zoomFactor = event.sender.getZoomFactor();
const electronRect: Electron.Rectangle = {
x: rect.left * zoomFactor,

View File

@ -439,6 +439,7 @@ declare global {
"window:bgcolor"?: string;
"window:reducedmotion"?: boolean;
"window:tilegapsize"?: number;
"window:nativetitlebar"?: boolean;
"telemetry:*"?: boolean;
"telemetry:enabled"?: boolean;
};

View File

@ -46,6 +46,7 @@ const (
ConfigKey_WindowBgColor = "window:bgcolor"
ConfigKey_WindowReducedMotion = "window:reducedmotion"
ConfigKey_WindowTileGapSize = "window:tilegapsize"
ConfigKey_WindowNativeTitleBar = "window:nativetitlebar"
ConfigKey_TelemetryClear = "telemetry:*"
ConfigKey_TelemetryEnabled = "telemetry:enabled"

View File

@ -80,6 +80,7 @@ type SettingsType struct {
WindowBgColor string `json:"window:bgcolor,omitempty"`
WindowReducedMotion bool `json:"window:reducedmotion,omitempty"`
WindowTileGapSize *int64 `json:"window:tilegapsize,omitempty"`
WindowNativeTitleBar bool `json:"window:nativetitlebar,omitempty"`
TelemetryClear bool `json:"telemetry:*,omitempty"`
TelemetryEnabled bool `json:"telemetry:enabled,omitempty"`