Ariver
2026-05-06 e64cdcb8e172e212bd38b8bd5cec06befa337f7c
checkpoint: v3.1.1 — 修复语言勾选+图标消失bug +新增Dock显示开关
4 files modified
25 ■■■■ changed files
Apptag/ApptagApp.swift 14 ●●●● patch | view | raw | blame | history
Apptag/Info.plist 2 ●●● patch | view | raw | blame | history
Apptag/L10n.swift 3 ●●●● patch | view | raw | blame | history
CHANGELOG.md 6 ●●●●● patch | view | raw | blame | history
Apptag/ApptagApp.swift
@@ -25,7 +25,8 @@
    func applicationDidFinishLaunching(_ notification: Notification) {
        L10n.setup()
        NSApp.setActivationPolicy(.accessory)
        let showDock = UserDefaults.standard.bool(forKey: "showDockIcon")
        NSApp.setActivationPolicy(showDock ? .regular : .accessory)
        setupMenuBar()
        registerHotkey()
        observeOtherWindows()
@@ -35,6 +36,10 @@
    // MARK: - Menu Bar
    private func setupMenuBar() {
        // Remove old status item if re-creating (language switch, etc.)
        if let existing = statusItem {
            NSStatusBar.system.removeStatusItem(existing)
        }
        statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
        if let button = statusItem.button {
@@ -80,7 +85,7 @@
        // Language submenu
        let langMenu = NSMenu()
        let currentLang = UserDefaults.standard.string(forKey: "appLanguage") ?? "en"
        let currentLang = L10n.currentCode
        for (code, name) in L10n.supported {
            let item = NSMenuItem(title: name, action: #selector(switchLanguage(_:)), keyEquivalent: "")
            item.representedObject = code
@@ -343,6 +348,7 @@
    @AppStorage("defaultGroupName") private var defaultGroupName = "Other"
    @AppStorage("displayMode") private var displayMode = "flat"
    @AppStorage("hideAppNames") private var hideAppNames = false
    @AppStorage("showDockIcon") private var showDockIcon = false
    @State private var allApps: [AppInfo] = []
    @State private var tagColors: [String: Int] = [:]
@@ -468,6 +474,10 @@
                }
                Section {
                    Toggle("Show in Dock", isOn: $showDockIcon)
                }
                Section {
                    Toggle("Hide app names", isOn: $hideAppNames)
                }
            }
Apptag/Info.plist
@@ -19,7 +19,7 @@
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>3.1.0</string>
    <string>3.1.1</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSMinimumSystemVersion</key>
Apptag/L10n.swift
@@ -4,6 +4,7 @@
enum L10n {
    static var current: [String: String] = [:]
    private(set) static var currentCode = "en"
    /// Call once at startup to load the saved or system language.
    static func setup() {
@@ -33,7 +34,6 @@
            forResource: code, withExtension: "json",
            subdirectory: "Localization"
        ) else {
            // Fallback to bundled English
            if code != "en" { load("en") }
            return
        }
@@ -41,6 +41,7 @@
              let dict = try? JSONSerialization.jsonObject(with: data) as? [String: String]
        else { return }
        current = dict
        currentCode = code
    }
    private static func fallbackCode() -> String {
CHANGELOG.md
@@ -1,5 +1,11 @@
# Apptag Changelog
## [3.1.1] — 2026-05-06
- 修复语言菜单勾选与实际语言不一致(`L10n.currentCode` 替代 UserDefaults)
- 修复 `setupMenuBar` 重复调用导致图标消失(先移除旧 statusItem)
- Preferences → General 新增「Show in Dock」Toggle
## [3.1.0] — 2026-05-06
- 国际化:支持 9 种语言(英/简中/繁中/日/韩/俄/法/意/西)