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 ++++++++++++--
1 files changed, 12 insertions(+), 2 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
--
Gitblit v1.9.3