From 8140d33412239eed7a6fbd8ad8ccfe7ab87ba9ce Mon Sep 17 00:00:00 2001
From: Ariver <ar@MacBook-Air.local>
Date: Wed, 06 May 2026 16:53:52 +0800
Subject: [PATCH] checkpoint: v3.0.6 — 新增标签行显示在列表最上面,确认后留在顶部(tagOrder 驱动排序)

---
 Apptag/ContentView.swift |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Apptag/ContentView.swift b/Apptag/ContentView.swift
index d5d8626..66c849e 100644
--- a/Apptag/ContentView.swift
+++ b/Apptag/ContentView.swift
@@ -212,6 +212,7 @@
     @AppStorage("tagPosition") private var tagPosition = "left"
     @State private var notchHeight: CGFloat = 0
     @AppStorage("displayMode") private var displayMode = "flat"
+    @AppStorage("hideAppNames") private var hideAppNames = false
 
     private var isSideLayout: Bool {
         tagPosition == "left" || tagPosition == "right"
@@ -271,10 +272,10 @@
         if phase != .none {
             NotificationCenter.default.post(name: .apptagEditModeChanged, object: nil, userInfo: ["active": true])
             NSApp.activate(ignoringOtherApps: true)
-            // Sync drag order from database when entering edit mode
-            if draggedTagNames.isEmpty {
-                draggedTagNames = TagEditor.orderedTagNames()
-            }
+            // Always sync tag list from database when entering edit mode
+            let store = TagDatabase.load()
+            tagColors = store.tags.mapValues { $0.color }
+            draggedTagNames = TagEditor.orderedTagNames()
         }
         editPhase = phase
         if phase == .none {
@@ -382,7 +383,8 @@
                             group: group,
                             onSelectApp: { app in openApp(app) },
                             tagFontSize: tagFontSize,
-                            iconSize: iconSize
+                            iconSize: iconSize,
+                            showNames: !hideAppNames
                         ).id(group.id)
                     }
                 }.padding(20)
@@ -445,6 +447,8 @@
                 Text(group.name)
                     .font(.system(size: tagFontSize, weight: .semibold))
                     .foregroundStyle(.secondary)
+                    .lineLimit(1)
+                    .truncationMode(.middle)
                     .padding(.horizontal, 10)
                 Rectangle().fill(.secondary.opacity(0.25)).frame(height: 1)
             }
@@ -454,7 +458,7 @@
                 spacing: 2
             ) {
                 ForEach(group.apps) { app in
-                    AppGridItem(app: app, iconSize: iconSize, onSelect: { openApp(app) })
+                    AppGridItem(app: app, iconSize: iconSize, showName: !hideAppNames, onSelect: { openApp(app) })
                 }
             }
         }

--
Gitblit v1.9.3