From bd792cd36d57b8f0741af9a6a64e59969cdce490 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sun, 14 Jun 2026 14:56:42 +0800
Subject: [PATCH] Prepare 7.9.1 build 20260614.1454

---
 src/Apptag/ApptagApp.swift |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/src/Apptag/ApptagApp.swift b/src/Apptag/ApptagApp.swift
index 1612504..e4efd6d 100644
--- a/src/Apptag/ApptagApp.swift
+++ b/src/Apptag/ApptagApp.swift
@@ -17,7 +17,7 @@
         Settings {
             PreferencesView()
         }
-        .defaultSize(width: 1000, height: 480)
+        .defaultSize(width: 1000, height: 640)
         .commands {
             CommandGroup(replacing: .systemServices) { }
             CommandGroup(replacing: .appVisibility) { }
@@ -42,7 +42,7 @@
     private static let launcherOverlayLevel = NSWindow.Level(rawValue: NSWindow.Level.mainMenu.rawValue - 1)
     private static let overlayDefaultLevel = launcherOverlayLevel
     private static let overlayTextInputLevel = launcherOverlayLevel
-    private static let settingsContentSize = NSSize(width: 1000, height: 480)
+    private static let settingsContentSize = NSSize(width: 1000, height: 640)
 
     private var statusItem: NSStatusItem?
     private var overlayKeyMonitor: Any?
@@ -251,12 +251,15 @@
             .combinedSessionState,
             eventType: .leftMouseUp
         )
-        let recentMouseClick = min(lastMouseDown, lastMouseUp) < 1.2
+        let recentMouseClick = min(lastMouseDown, lastMouseUp) < 0.9
         return recentMouseClick && isPointerNearDockArea()
     }
 
     private func isPointerNearDockArea() -> Bool {
         let mouse = NSEvent.mouseLocation
+        let dockOrientation = UserDefaults(suiteName: "com.apple.dock")?
+            .string(forKey: "orientation") ?? "bottom"
+        let hiddenDockEdgeTolerance: CGFloat = 96
         return NSScreen.screens.contains { screen in
             let frame = screen.frame
             let visible = screen.visibleFrame
@@ -270,7 +273,16 @@
             let rightDock = visible.maxX < frame.maxX
                 && mouse.x <= frame.maxX
                 && mouse.x >= visible.maxX - 24
-            return bottomDock || leftDock || rightDock
+            let hiddenDockFallback: Bool
+            switch dockOrientation {
+            case "left":
+                hiddenDockFallback = mouse.x <= frame.minX + hiddenDockEdgeTolerance
+            case "right":
+                hiddenDockFallback = mouse.x >= frame.maxX - hiddenDockEdgeTolerance
+            default:
+                hiddenDockFallback = mouse.y <= frame.minY + hiddenDockEdgeTolerance
+            }
+            return bottomDock || leftDock || rightDock || hiddenDockFallback
         }
     }
 
@@ -1739,7 +1751,13 @@
             super.mouseDown(with: event)
             return
         }
+        if routeUsageTipsMouseDownIfNeeded(event) {
+            return
+        }
         if hit == self {
+            if shouldSwallowUsageTipsBackdropClick(at: location) {
+                return
+            }
             if quickSearchSuppressesBackdropDismiss {
                 NotificationCenter.default.post(
                     name: .tagLauncherQuickSearchDismissRequested,
@@ -1774,6 +1792,32 @@
         super.mouseDown(with: event)
     }
 
+    private func routeUsageTipsMouseDownIfNeeded(_ event: NSEvent) -> Bool {
+        guard let appGridHost = findAppGridCollectionHost(in: self) else { return false }
+        return appGridHost.handleUsageTipsMouseDown(event)
+    }
+
+    private func findAppGridCollectionHost(in view: NSView) -> AppGridCollectionHostView? {
+        if let host = view as? AppGridCollectionHostView {
+            return host
+        }
+        for subview in view.subviews {
+            if let host = findAppGridCollectionHost(in: subview) {
+                return host
+            }
+        }
+        return nil
+    }
+
+    private func shouldSwallowUsageTipsBackdropClick(at location: NSPoint) -> Bool {
+        guard !UserDefaults.standard.bool(forKey: "hideUsageTips") else { return false }
+        let height = min(bounds.height, AppGridUsageTipsMetrics.reservedHeight)
+        guard height > 0 else { return false }
+        let y = isFlipped ? max(0, bounds.height - height) : 0
+        let region = NSRect(x: 0, y: y, width: bounds.width, height: height)
+        return region.contains(location)
+    }
+
     private func observeBackdropDismissSuppressionChanges() {
         modalInteractionObserver = NotificationCenter.default.addObserver(
             forName: .tagLauncherModalInteractionChanged,

--
Gitblit v1.9.3