Add custom macOS-style title bar (#1404)

Introduces a custom MacOSTitleBar component for macOS, updates the Electron window to use 'hiddenInset' titleBarStyle, and adjusts App.vue to conditionally render the new title bar and add appropriate padding. This improves the native look and feel on macOS platforms.
This commit is contained in:
玺朽
2025-10-15 01:22:23 +08:00
committed by GitHub
parent 2be998a270
commit bed76e0ad8
3 changed files with 131 additions and 0 deletions

View File

@@ -1,9 +1,13 @@
<template>
<!DOCTYPE html>
<el-config-provider :locale="currentLocale">
<!-- macOS Custom Title Bar -->
<MacOSTitleBar></MacOSTitleBar>
<div
id="x-app"
class="x-app"
:class="{ 'with-macos-titlebar': isMacOS }"
ondragenter="event.preventDefault()"
ondragover="event.preventDefault()"
ondrop="event.preventDefault()">
@@ -106,6 +110,7 @@
import Login from './views/Login/Login.vue';
import NavMenu from './components/NavMenu.vue';
import MacOSTitleBar from './components/TitleBar/MacOSTitleBar.vue';
import Sidebar from './views/Sidebar/Sidebar.vue';
import Feed from './views/Feed/Feed.vue';
import GameLog from './views/GameLog/GameLog.vue';
@@ -148,6 +153,11 @@
console.log(`isLinux: ${LINUX}`);
// Simple macOS detection
const isMacOS = computed(() => {
return navigator.platform.indexOf('Mac') > -1;
});
const { locale } = useI18n();
initNoty();
@@ -200,4 +210,9 @@
:deep(.el-splitter-bar__dragger) {
width: 4px !important;
}
/* Add title bar spacing for macOS */
.x-app.with-macos-titlebar {
padding-top: 28px;
}
</style>