Ariver
2026-06-08 4f5d7c13209555a114761f5027299f3ba1b42217
Apptag/ApptagApp.swift
@@ -210,6 +210,15 @@
        setupLaunchAtLogin()
        suppressReopenUntil = Date().addingTimeInterval(1.0)
        configureApplicationMenuWhenAvailable(retries: 200)
        warmAppIndexInBackground()
        relocalizeDefaultAppNotesForCurrentLanguageAsync()
    }
    /// Pre-scan application folders so the first App Grid open can hydrate from cache quickly.
    private func warmAppIndexInBackground() {
        DispatchQueue.global(qos: .utility).async {
            _ = AppIndexer.scan(useCache: true)
        }
    }
    func applicationDidBecomeActive(_ notification: Notification) {
@@ -430,7 +439,11 @@
        }
        if isQuickSearchOpen {
            NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
            NotificationCenter.default.post(
                name: .tagLauncherQuickSearchDismissRequested,
                object: nil,
                userInfo: ["source": QuickSearchDismissSource.programmatic]
            )
        }
        if !requiresForegroundOwnership {
@@ -446,6 +459,19 @@
        ) { [weak self] _ in
            self?.setupMenuBar()
            self?.configureApplicationMenuWhenAvailable()
            self?.relocalizeDefaultAppNotesForCurrentLanguageAsync()
        }
    }
    private func relocalizeDefaultAppNotesForCurrentLanguageAsync() {
        DispatchQueue.global(qos: .utility).async {
            let apps = AppIndexer.scan(useCache: true)
            let appleChanged = AppleDefaultAppCatalog.relocalizeDefaultNotesForCurrentLanguage(apps: apps)
            let smartStartChanged = SmartStartService.relocalizeDefaultNotesForCurrentLanguage(apps: apps)
            guard appleChanged || smartStartChanged else { return }
            DispatchQueue.main.async {
                NotificationCenter.default.post(name: .tagLauncherDataDidChange, object: nil)
            }
        }
    }
@@ -987,7 +1013,11 @@
        isQuickSearchOpen = false
        removeQuickSearchExternalMouseMonitor()
        updateOverlayLevelForTextInput()
        NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
        NotificationCenter.default.post(
            name: .tagLauncherQuickSearchDismissRequested,
            object: nil,
            userInfo: ["source": QuickSearchDismissSource.keyboard]
        )
        if shouldHideOverlayAfterDismiss {
            quickSearchShouldHideOverlayOnClose = false
            quickSearchOnlyOverlaySession = false
@@ -1526,7 +1556,11 @@
        ) { [weak self] _ in
            DispatchQueue.main.async {
                guard self?.isQuickSearchOpen == true else { return }
                NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
                NotificationCenter.default.post(
                    name: .tagLauncherQuickSearchDismissRequested,
                    object: nil,
                    userInfo: ["source": QuickSearchDismissSource.mouse]
                )
            }
        }
    }
@@ -1538,7 +1572,11 @@
        ) { [weak self] event in
            guard let self, self.isQuickSearchOpen else { return event }
            if event.window === self.overlayWindow {
                NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
                NotificationCenter.default.post(
                    name: .tagLauncherQuickSearchDismissRequested,
                    object: nil,
                    userInfo: ["source": QuickSearchDismissSource.mouse]
                )
                return nil
            }
            return event
@@ -1633,7 +1671,11 @@
        updateOverlayLevelForTextInput()
        quickSearchShouldHideOverlayOnClose = false
        quickSearchOnlyOverlaySession = false
        NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
        NotificationCenter.default.post(
            name: .tagLauncherQuickSearchDismissRequested,
            object: nil,
            userInfo: ["source": QuickSearchDismissSource.programmatic]
        )
    }
    @objc private func switchLanguage(_ sender: NSMenuItem) {
@@ -1695,7 +1737,11 @@
        }
        if hit == self {
            if quickSearchSuppressesBackdropDismiss {
                NotificationCenter.default.post(name: .tagLauncherQuickSearchDismissRequested, object: nil)
                NotificationCenter.default.post(
                    name: .tagLauncherQuickSearchDismissRequested,
                    object: nil,
                    userInfo: ["source": QuickSearchDismissSource.backdrop]
                )
                return
            }
            if suppressBackdropDismiss {