Pārlūkot izejas kodu

Refine launcher glass UI and window presentation.

Tune tile spacing and hover polish, apply true macOS visual-effect blur background, and set the app window title and transparency settings for a glass-style launcher look.

Made-with: Cursor
huzaifahayat12 4 mēneši atpakaļ
vecāks
revīzija
fda17324a3

+ 5 - 1
google_apps/AppDelegate.swift

@@ -14,7 +14,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
 
 
     func applicationDidFinishLaunching(_ aNotification: Notification) {
-        // Insert code here to initialize your application
+        guard let window = NSApp.windows.first else { return }
+        window.title = "My Apps"
+        window.isOpaque = false
+        window.backgroundColor = .clear
+        window.titlebarAppearsTransparent = true
     }
 
     func applicationWillTerminate(_ aNotification: Notification) {

+ 9 - 7
google_apps/AppTileView.swift

@@ -9,26 +9,26 @@ struct AppTileView: View {
 
     var body: some View {
         Button(action: onTap) {
-            VStack(spacing: 10) {
-                AppIconView(app: app, size: 66)
-                    .shadow(color: .black.opacity(0.22), radius: 9, x: 0, y: 6)
+            VStack(spacing: 11) {
+                AppIconView(app: app, size: 64)
+                    .shadow(color: .black.opacity(0.2), radius: 8, x: 0, y: 5)
 
                 Text(app.name)
-                    .font(.system(size: 13.5, weight: .medium))
+                    .font(.system(size: 13, weight: .medium))
                     .foregroundStyle(.white.opacity(0.95))
                     .lineLimit(1)
                     .truncationMode(.tail)
                     .frame(maxWidth: .infinity)
             }
-            .padding(.horizontal, 8)
+            .padding(.horizontal, 7)
             .padding(.vertical, 10)
             .background(
                 RoundedRectangle(cornerRadius: 14, style: .continuous)
-                    .fill(isHovering ? Color.white.opacity(0.10) : Color.clear)
+                    .fill(isHovering ? Color.white.opacity(0.08) : Color.clear)
             )
             .overlay(
                 RoundedRectangle(cornerRadius: 14, style: .continuous)
-                    .stroke(isHovering ? Color.white.opacity(0.2) : Color.clear, lineWidth: 1)
+                    .stroke(isHovering ? Color.white.opacity(0.16) : Color.clear, lineWidth: 1)
             )
             .animation(.easeOut(duration: 0.15), value: isHovering)
         }
@@ -58,6 +58,8 @@ private struct AppIconView: View {
             } else {
                 RoundedRectangle(cornerRadius: 18, style: .continuous)
                     .fill(LinearGradient(colors: gradientColors, startPoint: .topLeading, endPoint: .bottomTrailing))
+                RoundedRectangle(cornerRadius: 18, style: .continuous)
+                    .stroke(Color.white.opacity(0.08), lineWidth: 1)
 
                 if let iconImage = NSImage(named: app.assetIconName) {
                     Image(nsImage: iconImage)

+ 38 - 8
google_apps/LauncherRootView.swift

@@ -1,11 +1,12 @@
 import SwiftUI
+import AppKit
 
 struct LauncherRootView: View {
     @State private var query = ""
     @State private var selectedApp: LauncherApp?
 
     private let apps = LauncherApp.sampleApps
-    private let columns = [GridItem(.adaptive(minimum: 122, maximum: 150), spacing: 24)]
+    private let columns = [GridItem(.adaptive(minimum: 120, maximum: 145), spacing: 22)]
 
     private var filteredApps: [LauncherApp] {
         let q = query.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -15,9 +16,12 @@ struct LauncherRootView: View {
 
     var body: some View {
         ZStack {
-            Color(red: 0.05, green: 0.06, blue: 0.09)
+            VisualEffectBlur(material: .hudWindow, blendingMode: .behindWindow)
                 .ignoresSafeArea()
 
+            Color.black.opacity(0.22)
+            .ignoresSafeArea()
+
             VStack(spacing: 16) {
                 SearchHeader(query: $query)
                     .padding(.top, 12)
@@ -46,7 +50,7 @@ struct LauncherRootView: View {
                     }
                 }
             }
-            .padding(.horizontal, 12)
+            .padding(.horizontal, 10)
             .padding(.bottom, 8)
         }
         .sheet(item: $selectedApp) { app in
@@ -69,10 +73,14 @@ private struct SearchHeader: View {
                     .foregroundStyle(.white.opacity(0.94))
             }
             .padding(.horizontal, 12)
-            .padding(.vertical, 9)
+            .padding(.vertical, 8)
             .background(
-                RoundedRectangle(cornerRadius: 16, style: .continuous)
-                    .fill(Color.white.opacity(0.08))
+                RoundedRectangle(cornerRadius: 15, style: .continuous)
+                    .fill(Color.black.opacity(0.28))
+            )
+            .overlay(
+                RoundedRectangle(cornerRadius: 15, style: .continuous)
+                    .stroke(Color.white.opacity(0.08), lineWidth: 1)
             )
 
             Spacer(minLength: 8)
@@ -112,11 +120,15 @@ private struct PromoBanner: View {
                         .fill(Color.blue.opacity(0.92))
                 )
         }
-        .padding(.horizontal, 12)
+        .padding(.horizontal, 11)
         .padding(.vertical, 8)
         .background(
             RoundedRectangle(cornerRadius: 12, style: .continuous)
-                .fill(Color.white.opacity(0.04))
+                .fill(Color.white.opacity(0.03))
+        )
+        .overlay(
+            RoundedRectangle(cornerRadius: 12, style: .continuous)
+                .stroke(Color.white.opacity(0.05), lineWidth: 1)
         )
     }
 }
@@ -124,3 +136,21 @@ private struct PromoBanner: View {
 #Preview {
     LauncherRootView()
 }
+
+private struct VisualEffectBlur: NSViewRepresentable {
+    let material: NSVisualEffectView.Material
+    let blendingMode: NSVisualEffectView.BlendingMode
+
+    func makeNSView(context: Context) -> NSVisualEffectView {
+        let view = NSVisualEffectView()
+        view.state = .active
+        view.material = material
+        view.blendingMode = blendingMode
+        return view
+    }
+
+    func updateNSView(_ nsView: NSVisualEffectView, context: Context) {
+        nsView.material = material
+        nsView.blendingMode = blendingMode
+    }
+}