From 00d66fcdb928754e5a8c69a3b4ccab7832af5b54 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 18 May 2026 20:12:20 +0800
Subject: [PATCH] Stabilize menu bar item identity for Thaw

---
 Apptag/ApptagApp.swift |   14 ++++++++++++--
 Apptag/Info.plist      |    4 ++--
 CHANGELOG.md           |    7 +++++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Apptag/ApptagApp.swift b/Apptag/ApptagApp.swift
index f108c83..3737c9b 100644
--- a/Apptag/ApptagApp.swift
+++ b/Apptag/ApptagApp.swift
@@ -29,6 +29,9 @@
 
 final class AppDelegate: NSObject, NSApplicationDelegate {
     private static let showDockIconKey = "showDockIcon"
+    private static let statusItemAutosaveName = "com.apptag.launcher.statusItem"
+    private static let statusItemButtonIdentifier = NSUserInterfaceItemIdentifier("TagLauncherStatusItemButton")
+    private static let statusItemAccessibilityLabel = "TagLauncher"
     private static let showAppListMenuItemIdentifier = NSUserInterfaceItemIdentifier("TagLauncherShowAppListMenuItem")
     private static let showAppListShortcutGlyphs = "⌥⇧␣"
     private static let overlayDefaultLevel = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.maximumWindow)))
@@ -192,12 +195,19 @@
     // MARK: - Menu Bar
 
     private func setupMenuBar() {
-        removeMenuBarItem()
-        statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
+        if statusItem == nil {
+            statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
+        } else {
+            statusItem?.length = NSStatusItem.squareLength
+        }
         guard let statusItem else { return }
+        statusItem.autosaveName = Self.statusItemAutosaveName
         statusItem.isVisible = true
 
         if let button = statusItem.button {
+            button.identifier = Self.statusItemButtonIdentifier
+            button.setAccessibilityIdentifier(Self.statusItemAutosaveName)
+            button.setAccessibilityLabel(Self.statusItemAccessibilityLabel)
             button.image = makeMenuBarIcon()
             button.imageScaling = .scaleProportionallyDown
             button.imagePosition = .imageOnly
diff --git a/Apptag/Info.plist b/Apptag/Info.plist
index 0e5117b..fc5cc64 100644
--- a/Apptag/Info.plist
+++ b/Apptag/Info.plist
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>7.3.4</string>
+	<string>7.3.5</string>
 	<key>CFBundleVersion</key>
-	<string>743</string>
+	<string>744</string>
 	<key>LSMinimumSystemVersion</key>
 	<string>15.0</string>
 	<key>NSHighResolutionCapable</key>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6415b88..db40728 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 # Apptag Changelog
 
+## [7.3.5] — 2026-05-18
+
+- 为菜单栏图标设置稳定 `NSStatusItem.autosaveName`,让 macOS 与 Thaw 更容易识别为同一个菜单栏项
+- 菜单栏刷新时复用已有 `NSStatusItem`,避免语言刷新等场景反复删除重建导致位置记忆失效
+- 为菜单栏按钮补充稳定 identifier 与 accessibility 标识,提升第三方菜单栏管理工具识别稳定性
+- 版本号更新为 `7.3.5`,Build 更新为 `744`
+
 ## [7.3.4] — 2026-05-18
 
 - 优化应用列表打开速度:覆盖层窗口不再每次显示都销毁重建,减少重复初始化

--
Gitblit v1.9.3