Explorar el Código

Hide the native title bar and embed traffic lights in the app chrome.

Unified window styling lets the sidebar background extend under the controls for a cleaner, app-integrated look.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 hace 3 semanas
padre
commit
c994737b8e

+ 1 - 1
clone _of_clarus_ai_chat_bot/AppDelegate.swift

@@ -25,7 +25,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         window.minSize = NSSize(width: 960, height: 640)
         window.center()
         window.isOpaque = true
-        window.backgroundColor = NSColor(red: 1.0, green: 0.97, blue: 0.96, alpha: 1.0)
         window.appearance = NSAppearance(named: .aqua)
+        WindowConfigurator.applyUnifiedChrome(to: window)
     }
 }

+ 12 - 0
clone _of_clarus_ai_chat_bot/Utilities/WindowConfigurator.swift

@@ -0,0 +1,12 @@
+import Cocoa
+import SwiftUI
+
+enum WindowConfigurator {
+    static func applyUnifiedChrome(to window: NSWindow) {
+        window.styleMask.insert(.fullSizeContentView)
+        window.titlebarAppearsTransparent = true
+        window.titleVisibility = .hidden
+        window.isMovableByWindowBackground = true
+        window.backgroundColor = NSColor(AppTheme.pageBackground)
+    }
+}

+ 9 - 0
clone _of_clarus_ai_chat_bot/ViewController.swift

@@ -15,6 +15,15 @@ final class ViewController: NSViewController {
         let homeView = HomeView(viewModel: viewModel)
         let hostingView = NSHostingView(rootView: homeView)
         hostingView.autoresizingMask = [.width, .height]
+        hostingView.safeAreaRegions = .container
         self.view = hostingView
     }
+
+    override func viewDidAppear() {
+        super.viewDidAppear()
+
+        if let window = view.window {
+            WindowConfigurator.applyUnifiedChrome(to: window)
+        }
+    }
 }

+ 1 - 1
clone _of_clarus_ai_chat_bot/Views/HomeView.swift

@@ -9,7 +9,7 @@ struct HomeView: View {
             MainContentView(viewModel: viewModel)
         }
         .frame(maxWidth: .infinity, maxHeight: .infinity)
-        .background(AppTheme.pageBackground)
+        .background(AppTheme.pageBackground.ignoresSafeArea())
         .preferredColorScheme(.light)
     }
 }

+ 1 - 1
clone _of_clarus_ai_chat_bot/Views/MainContentView.swift

@@ -7,7 +7,7 @@ struct MainContentView: View {
         VStack(spacing: 0) {
             profileHeader
                 .padding(.horizontal, 32)
-                .padding(.top, 20)
+                .padding(.top, 8)
 
             Spacer(minLength: 20)
 

+ 5 - 2
clone _of_clarus_ai_chat_bot/Views/SidebarView.swift

@@ -32,11 +32,14 @@ struct SidebarView: View {
             upgradeButton
         }
         .padding(.horizontal, 20)
-        .padding(.top, 24)
+        .padding(.top, 8)
         .padding(.bottom, 20)
         .frame(width: AppTheme.sidebarWidth)
         .frame(maxHeight: .infinity)
-        .background(AppTheme.sidebarBackground)
+        .background {
+            AppTheme.sidebarBackground
+                .ignoresSafeArea(.container, edges: [.top, .leading])
+        }
     }
 
     private var brandHeader: some View {