Refine Quick Switch app hover visuals
| | |
| | | <key>CFBundlePackageType</key> |
| | | <string>APPL</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>0.0.70</string> |
| | | <string>0.0.71</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>20260618.2044</string> |
| | | <string>20260618.2149</string> |
| | | <key>LSMinimumSystemVersion</key> |
| | | <string>26.0</string> |
| | | <key>NSHighResolutionCapable</key> |
| | |
| | | static let normalGap: CGFloat = 16 |
| | | static let minGap: CGFloat = 8 |
| | | static let maxRows = 2 |
| | | static let indexFontSize: CGFloat = 15 |
| | | static let compressedIndexFontSize: CGFloat = 13 |
| | | static let indexWidth: CGFloat = 16 |
| | | static let indexHeight: CGFloat = 18 |
| | | static let indexFontSize: CGFloat = 16 |
| | | static let compressedIndexFontSize: CGFloat = 14 |
| | | static let indexWidth: CGFloat = 18 |
| | | static let indexHeight: CGFloat = 24 |
| | | } |
| | | |
| | | private enum RootLayoutMetrics { |
| | |
| | | } |
| | | |
| | | private var appShelfIndexColor: NSColor { |
| | | NSColor.labelColor.withAlphaComponent(0.34) |
| | | NSColor.labelColor.withAlphaComponent(0.48) |
| | | } |
| | | |
| | | private var appShelfIndexHighlightedColor: NSColor { |
| | | NSColor.labelColor.withAlphaComponent(0.42) |
| | | NSColor.labelColor.withAlphaComponent(0.58) |
| | | } |
| | | |
| | | private func appShelfIndexFont(size: CGFloat) -> NSFont { |
| | |
| | | layer.font = appShelfIndexFont(size: fontSize) |
| | | layer.fontSize = fontSize |
| | | layer.foregroundColor = (highlighted ? appShelfIndexHighlightedColor : appShelfIndexColor).cgColor |
| | | layer.opacity = iconSize <= AppShelfMetrics.minIconSize + 1 ? 0.72 : 0.82 |
| | | layer.opacity = 1 |
| | | |
| | | let indexWidth = AppShelfMetrics.indexWidth |
| | | let indexHeight = AppShelfMetrics.indexHeight |
| | | let preferredX = iconFrame.minX - indexWidth - 1 |
| | | let clampedX = max(-6, min(itemBounds.width - indexWidth, preferredX)) |
| | | let preferredY = iconFrame.maxY - indexHeight + 4 |
| | | let preferredX = iconFrame.minX - indexWidth - 2 |
| | | let clampedX = max(-7, min(itemBounds.width - indexWidth, preferredX)) |
| | | let preferredY = iconFrame.maxY - indexHeight + 6 |
| | | let clampedY = max(0, min(itemBounds.height - indexHeight, preferredY)) |
| | | layer.frame = CGRect( |
| | | x: clampedX, |
| | |
| | | return item.item.windowCount > 1 ? "\(item.item.windowCount)" : "" |
| | | } |
| | | |
| | | private var waterfallAppHoverHeaderFillColor: NSColor { |
| | | NSColor.systemGray.withAlphaComponent(0.22) |
| | | } |
| | | |
| | | private var appShelfMaxScrollOffset: CGFloat { |
| | | max(0, appShelfContentWidth - shelfLayer.bounds.width) |
| | | } |
| | |
| | | column.countLayer.isHidden = true |
| | | |
| | | for card in column.cards { |
| | | card.containerLayer.transform = CATransform3DIdentity |
| | | if let frame = layout.cardFramesByWindowID[card.item.window.id] { |
| | | card.containerLayer.frame = frame |
| | | } else { |
| | |
| | | height: WaterfallMetrics.headerHeight |
| | | ) |
| | | column.headerLayer.backgroundColor = (isHovered |
| | | ? viewModeToggleBlueColor |
| | | ? waterfallAppHoverHeaderFillColor |
| | | : (isSpaceFocused |
| | | ? NSColor.systemFill.withAlphaComponent(0.10) |
| | | : NSColor.controlBackgroundColor.withAlphaComponent(0.52)) |
| | |
| | | width: max(1, bounds.width - WaterfallMetrics.columnHeaderTextInset * 2), |
| | | height: 16 |
| | | ) |
| | | column.appNameLayer.foregroundColor = (isHovered ? NSColor.white : NSColor.labelColor).cgColor |
| | | column.appNameLayer.foregroundColor = NSColor.labelColor.cgColor |
| | | column.countLayer.frame = CGRect( |
| | | x: bounds.width - 48, |
| | | y: bounds.height - 24, |
| | | width: 36, |
| | | height: 16 |
| | | ) |
| | | column.countLayer.foregroundColor = (isHovered ? NSColor.white : NSColor.secondaryLabelColor).cgColor |
| | | column.countLayer.foregroundColor = NSColor.secondaryLabelColor.cgColor |
| | | |
| | | let appGroupIndex = column.column.appGroupIndex |
| | | let verticalOffset = clampedWaterfallColumnOffset( |
| | |
| | | let y = firstCardTop |
| | | - WaterfallMetrics.cardHeight |
| | | - CGFloat(cardIndex) * (WaterfallMetrics.cardHeight + WaterfallMetrics.cardGap) |
| | | card.containerLayer.transform = CATransform3DIdentity |
| | | card.containerLayer.frame = CGRect( |
| | | x: WaterfallMetrics.columnHorizontalPadding, |
| | | y: y, |
| | |
| | | let bounds = card.containerLayer.bounds |
| | | let isSelected = card.item.window.id == effectiveSelection?.windowID |
| | | let isHovered = card.item.window.id == hoveredWindowID |
| | | let isAppLinked = isHorizontalMasonryMode |
| | | && card.item.appGroupIndex == appIconHoverLinkedAppGroupIndex |
| | | let isAppLinked = isWaterfallCardAppLinked(card) |
| | | applyWaterfallCardVisualState( |
| | | card, |
| | | selected: shouldShowSelectedVisual(isSelected: isSelected, isHovered: isHovered), |
| | |
| | | return card.item.primarySpaceID == activeSpaceFocusID |
| | | } |
| | | |
| | | private func isWaterfallCardAppLinked(_ card: WaterfallCardLayers) -> Bool { |
| | | guard card.item.appGroupIndex == appIconHoverLinkedAppGroupIndex else { return false } |
| | | |
| | | if isHorizontalMasonryMode { |
| | | return true |
| | | } |
| | | |
| | | return waterfallColumns |
| | | .first(where: { $0.column.appGroupIndex == card.item.appGroupIndex })? |
| | | .cards |
| | | .sorted { lhs, rhs in |
| | | if lhs.item.windowIndex != rhs.item.windowIndex { |
| | | return lhs.item.windowIndex < rhs.item.windowIndex |
| | | } |
| | | return lhs.item.window.id < rhs.item.window.id |
| | | } |
| | | .first? |
| | | .item.window.id == card.item.window.id |
| | | } |
| | | |
| | | private func waterfallColumnWidth() -> CGFloat { |
| | | guard waterfallColumns.count > 0 else { return WaterfallMetrics.columnWidth } |
| | | |
| | |
| | | "indexFrame": dictionary(from: item.indexLayer.frame), |
| | | "indexVisible": !item.indexLayer.isHidden && item.indexLayer.opacity > 0, |
| | | "indexFontSize": Double(item.indexLayer.fontSize), |
| | | "indexOpacity": Double(item.indexLayer.opacity), |
| | | "indexColor": colorDictionary(from: item.indexLayer.foregroundColor), |
| | | "labelFrame": dictionary(from: item.labelLayer.frame), |
| | | "labelTruncationMode": "middle", |
| | |
| | | var states: [String] = [] |
| | | let isSelected = card.item.window.id == effectiveSelection?.windowID |
| | | let isHovered = card.item.window.id == hoveredWindowID |
| | | let isAppLinked = isHorizontalMasonryMode |
| | | && card.item.appGroupIndex == appIconHoverLinkedAppGroupIndex |
| | | let isAppLinked = isWaterfallCardAppLinked(card) |
| | | if shouldShowSelectedVisual(isSelected: isSelected, isHovered: isHovered) { |
| | | states.append("selected") |
| | | } else if isSelected { |
| | |
| | | require(items[0].get("iconFrame", {}).get("width") == expected_icon_size, "non-hovered selected app icon must match normal fixture icon size") |
| | | require(items[hover_index].get("iconFrame", {}).get("width") == 68, "hovered app icon must be 68pt") |
| | | |
| | | blue_reference = {"red": 135 / 255, "green": 200 / 255, "blue": 1.0, "alpha": 1.0} |
| | | legacy_blue_reference = {"red": 135 / 255, "green": 200 / 255, "blue": 1.0, "alpha": 1.0} |
| | | hovered_title_color = columns[hover_index].get("appNameColor", {}) |
| | | hovered_header_color = columns[hover_index].get("headerBackgroundColor", {}) |
| | | hovered_count_color = columns[hover_index].get("countColor", {}) |
| | | for channel in ("red", "green", "blue"): |
| | | require( |
| | | abs(hovered_header_color.get(channel, -1) - blue_reference.get(channel, -2)) <= 0.002, |
| | | f"hovered column header must use #87C8FF for {channel}" |
| | | ) |
| | | require(hovered_header_color.get("alpha", 0) >= 0.98, "hovered column header blue fill must be opaque") |
| | | for color_name, color in (("title", hovered_title_color), ("count", hovered_count_color)): |
| | | for channel in ("red", "green", "blue", "alpha"): |
| | | require(abs(color.get(channel, -1) - 1.0) <= 0.002, f"hovered column {color_name} text must be pure white for {channel}") |
| | | |
| | | def is_legacy_blue(color): |
| | | return all(abs(color.get(channel, -1) - legacy_blue_reference[channel]) <= 0.01 for channel in ("red", "green", "blue")) |
| | | |
| | | hovered_header_channels = [hovered_header_color.get(channel, -1) for channel in ("red", "green", "blue")] |
| | | require(not is_legacy_blue(hovered_header_color), "hovered column header must no longer use the previous blue fill") |
| | | require(max(hovered_header_channels) - min(hovered_header_channels) <= 0.035, "hovered column header must use a neutral gray fill") |
| | | require(0.16 <= hovered_header_color.get("alpha", 0) <= 0.30, "hovered column header gray fill must stay lightweight") |
| | | require(hovered_title_color.get("alpha", 0) >= 0.8, "hovered column title must remain readable") |
| | | require(hovered_count_color.get("alpha", 0) >= 0.45, "hovered column count must remain readable") |
| | | hovered_cards = columns[hover_index].get("cards", []) |
| | | require(hovered_cards, "hovered column must include at least one card") |
| | | require("appLinked" in hovered_cards[0].get("visualStates", []), "hovered App column first card must expose appLinked visual state") |
| | | require(hovered_cards[0].get("closeButtonVisible") is False, "App-linked first card must not show close button unless directly hovered") |
| | | require(hovered_cards[0].get("shadowOpacity", 0) > 0, "App-linked first card must lift with a shadow") |
| | | require(hovered_cards[0].get("titleBarBackgroundColor", {}).get("alpha", 0) > 0.10, "App-linked first card title bar must expose a visible highlight") |
| | | require(all("appLinked" not in card.get("visualStates", []) for card in hovered_cards[1:]), "only the first vertical card in the hovered App column should expose appLinked") |
| | | for index, column in enumerate(columns): |
| | | if index == hover_index: |
| | | continue |
| | | require(column.get("isHovered") is False, "non-hovered columns must not be marked hovered") |
| | | require("hover" not in column.get("visualStates", []), "non-hovered columns must not expose hover visual state") |
| | | normal_header = column.get("headerBackgroundColor", {}) |
| | | require( |
| | | any(abs(normal_header.get(channel, -1) - blue_reference[channel]) > 0.05 for channel in ("red", "green", "blue")), |
| | | "non-hovered column headers must not use the hover blue fill" |
| | | ) |
| | | require(not is_legacy_blue(normal_header), "non-hovered column headers must not use the previous blue fill") |
| | | require(all("appLinked" not in card.get("visualStates", []) for card in column.get("cards", [])), "non-hovered columns must not expose appLinked cards") |
| | | |
| | | normal_items = [ |
| | | item for item in items |
| | |
| | | require(all(item.get("labelTruncationMode") == "middle" for item in items), "all App Shelf labels must use middle truncation") |
| | | require(all(item.get("indexVisible") is True for item in items), "all App Shelf items must expose a visible hand-written index marker") |
| | | require(all(item.get("indexText") == expected_index_text(index) for index, item in enumerate(items)), "App Shelf index markers must follow 1234567890ABCDEFG order") |
| | | require(all(item.get("indexFontSize", 0) >= 13 for item in items), "App Shelf index markers must keep readable font size") |
| | | require(all(0 < item.get("indexColor", {}).get("alpha", 0) <= 0.5 for item in items), "App Shelf index markers must stay low-noise with light alpha") |
| | | require(all(item.get("indexFrame", {}).get("width", 0) >= 14 for item in items), "App Shelf index markers must reserve enough width") |
| | | require(all(item.get("indexFontSize", 0) >= 14 for item in items), "App Shelf index markers must keep readable font size") |
| | | require(all(0.38 <= item.get("indexColor", {}).get("alpha", 0) <= 0.62 for item in items), "App Shelf index markers must stay low-noise but fully readable") |
| | | require(all(item.get("indexOpacity", 0) == 1 for item in items), "App Shelf index markers must avoid double alpha fading") |
| | | require(all(item.get("indexFrame", {}).get("width", 0) >= 16 for item in items), "App Shelf index markers must reserve enough width") |
| | | require(all(item.get("indexFrame", {}).get("height", 0) >= 22 for item in items), "App Shelf index markers must reserve enough height to avoid bottom clipping") |
| | | require(all(item.get("indexFrame", {}).get("x", 99) < item.get("iconFrame", {}).get("x", -99) for item in items), "App Shelf index markers must sit beside the icon, not over the icon center") |
| | | |
| | | row_y_values = {round(item.get("frame", {}).get("y", 0), 2) for item in items} |
| | |
| | | "hoveredColumnHeaderColor": hovered_header_color, |
| | | "hoveredColumnTitleColor": hovered_title_color, |
| | | "hoveredColumnCountColor": hovered_count_color, |
| | | "blueReference": blue_reference, |
| | | "legacyBlueReference": legacy_blue_reference, |
| | | "hoveredFirstCardStates": hovered_cards[0].get("visualStates"), |
| | | "hoveredFirstCardTitleBarColor": hovered_cards[0].get("titleBarBackgroundColor"), |
| | | "firstIndexes": [item.get("indexText") for item in items[:min(12, len(items))]], |
| | | "selectedZ": selected_z, |
| | | "hoverZ": hover_z, |