From cba722f8a207982ade9e941eca3e6070e8705749 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 20 Jun 2026 13:01:49 +0800
Subject: [PATCH] Commit single-window app shortcuts on first key
---
C1.source/Sources/Aligner/QuickSwitchRootView.swift | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index e3811f7..3b0a67e 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -1790,11 +1790,21 @@
if focusAppShelfItemForKeyboard(indexSymbol: symbol, commandLabel: recordedCommand),
let ordinal = Self.appShelfIndexSymbols.firstIndex(of: symbol),
ordinal < appShelfItems.count {
- setWindowIndexKeyPending(
- appSymbol: symbol,
- appGroupIndex: appShelfItems[ordinal].item.appGroupIndex,
- startedAt: now
- )
+ let appGroupIndex = appShelfItems[ordinal].item.appGroupIndex
+ if let card = singleVisibleWaterfallCard(appGroupIndex: appGroupIndex) {
+ recordKeyboardCommand("windowSingle:\(symbol)")
+ lastWindowIndexKeyCommand = "windowSingle:\(symbol)"
+ lastWindowIndexKeyCommitCode = symbol
+ lastWindowShortcutPreCommitFilterSnapshot = nil
+ clearWindowIndexKeyPending()
+ commitKeyboardWindowCard(card, trigger: "windowIndexSingleApp")
+ } else {
+ setWindowIndexKeyPending(
+ appSymbol: symbol,
+ appGroupIndex: appGroupIndex,
+ startedAt: now
+ )
+ }
} else {
selectionChangedByLastCommand = false
clearWindowIndexKeyPending()
@@ -6426,6 +6436,11 @@
waterfallColumns.flatMap(\.cards)
}
+ private func singleVisibleWaterfallCard(appGroupIndex: Int) -> WaterfallCardLayers? {
+ let cards = visibleWaterfallCards.filter { $0.item.appGroupIndex == appGroupIndex }
+ return cards.count == 1 ? cards[0] : nil
+ }
+
private var windowShortcutFilterDimOpacity: Float {
resolvedTheme == .dark ? 0.44 : 0.38
}
--
Gitblit v1.9.3