Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
The library opens on an Installed games row with Play on the cover (highball#252, #257)
Gauthier Piarrettef0c9380e61ac
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex e49601b..68fb363 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -246,6 +246,7 @@ enum L10n {// One Library (Phase 2)"Library": "Bibliothèque","Continue playing": "Reprendre",+ "Installed games": "Jeux installés","Search your games": "Rechercher vos jeux","All": "Tous","No bottles yet. A bottle is a private Windows environment for your games.":diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swiftindex c9474d5..f6cd8d9 100644--- a/Sources/HighballApp/LibraryView.swift+++ b/Sources/HighballApp/LibraryView.swift@@ -14,18 +14,17 @@ struct LibraryView: View {@Environment(\.openSettings) private var openSettings@State private var search = ""@State private var sourceFilter: LibrarySource?- /// On by default so the owned Steam library (highball#199) doesn't change what the library- /// shows until someone asks for it; switching Installed off reveals owned games.- @State private var installedOnly = true- /// Until the chip is touched, Installed hides only Steam's owned-only games: Epic's owned- /// games keep showing as they always have (#205). Once touched it applies to every source.- @State private var installedTouched = false+ /// Off by default since the Home row (highball#252): installed games lead the screen in their+ /// own row, so the owned library below them is what the grid is for. On, it keeps every store+ /// to its installed games alike; it used to let Epic's owned games through until touched, and+ /// that read as a bug (highball#257).+ @State private var installedOnly = false@State private var verifiedOnly = falseprivate var filtered: [LibraryItem] {state.libraryItems.filter { item inif let sourceFilter, item.source != sourceFilter { return false }- if installedOnly && !item.installedAnywhere && (installedTouched || item.source == .steam) { return false }+ if installedOnly && !item.installedAnywhere { return false }if verifiedOnly {guard state.gameDB.entry(for: item)?.status == "verified-local" else { return false }}@@ -35,26 +34,32 @@ struct LibraryView: View {}}- /// Only once the grid needs it: with a handful of games the row would repeat every tile.- private var continueItems: [LibraryItem] {- guard state.libraryItems.count > 6 else { return [] }- return state.libraryItems- .filter { $0.lastPlayed != nil && $0.installedAnywhere }- .sorted { ($0.lastPlayed ?? .distantPast) > ($1.lastPlayed ?? .distantPast) }- .prefix(10).map { $0 }+ /// The Home row: installed games, the most recently played first (highball#252, the first+ /// piece taken from PR #230). Only once the grid holds more than the row, with a handful of+ /// games and nothing owned besides them the row would repeat every tile.+ private var homeItems: [LibraryItem] {+ let installed = LibraryIndex.installedForHome(state.libraryItems)+ guard state.libraryItems.count > 6, state.libraryItems.count > installed.count else { return [] }+ return installed}var body: some View {ScrollView {VStack(alignment: .leading, spacing: 26) {filterBar- if !continueItems.isEmpty && search.isEmpty && sourceFilter == nil {+ // Installed games first, large, with Play on the cover. The verdict stays under+ // every cover, the grid below keeps every game, and the row steps aside as soon as+ // a search or a filter is on.+ if !homeItems.isEmpty && search.isEmpty && sourceFilter == nil && !installedOnly && !verifiedOnly {VStack(alignment: .leading, spacing: 12) {- HB.eyebrow(L("Continue playing"))+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ HB.eyebrow(L("Installed games"))+ Text("\(homeItems.count)").font(.caption.monospaced()).foregroundStyle(.tertiary)+ }ScrollView(.horizontal, showsIndicators: false) {- LazyHStack(spacing: 14) {- ForEach(continueItems) { item in- LibraryTile(item: item, entry: entry(for: item), width: 128)+ LazyHStack(spacing: 16) {+ ForEach(homeItems) { item in+ LibraryTile(item: item, entry: entry(for: item), width: 176, playOnCover: true)}}// Room inside the clip for a hovered tile's scale, stroke and shadow,@@ -101,7 +106,7 @@ struct LibraryView: View {FilterChip(label: "Epic", on: sourceFilter == .epic) { sourceFilter = .epic }FilterChip(label: L("Programs"), on: sourceFilter == .pin) { sourceFilter = .pin }Divider().frame(height: 16)- FilterChip(label: L("Installed"), on: installedOnly) { installedOnly.toggle(); installedTouched = true }+ FilterChip(label: L("Installed"), on: installedOnly) { installedOnly.toggle() }FilterChip(label: L("Verified"), on: verifiedOnly) { verifiedOnly.toggle() }Spacer()}@@ -210,6 +215,9 @@ struct LibraryTile: View {let item: LibraryItemlet entry: GameDBEntry?var width: CGFloat? = nil+ /// The Home row shows Play on the cover without a hover, as a visible control, where the+ /// grid keeps it for the hover so covers stay clean at a glance.+ var playOnCover = false@State private var hovering = false@State private var coverDropTargeted = false@@ -259,6 +267,24 @@ struct LibraryTile: View {.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing).padding(6)}+ // The visible Play of the Home row, bottom right, clear of the badge and of+ // the Running pill. The hover overlay above takes over while the pointer is in.+ if playOnCover && playable && !hovering && !isRunning {+ Button { state.play(item) } label: {+ ZStack {+ Circle().fill(HB.amber).frame(width: 34, height: 34)+ .shadow(color: .black.opacity(0.45), radius: 6, y: 2)+ Image(systemName: "play.fill")+ .font(.system(size: 13, weight: .bold))+ .foregroundStyle(Color(red: 0.13, green: 0.08, blue: 0.01))+ .offset(x: 1)+ }+ }+ .buttonStyle(.plain)+ .accessibilityLabel(String(format: L("Play %@"), state.displayTitle(item)))+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)+ .padding(8)+ }}.aspectRatio(2 / 3, contentMode: .fit).clipShape(RoundedRectangle(cornerRadius: 9))@@ -350,6 +376,7 @@ struct LibraryTile: View {}private var verdict: (String, Color)? { verdictLabel(entry?.status) }+ private var isRunning: Bool { item.steamAppID.map { state.session(forAppID: $0) != nil } ?? false }}/// Shared verdict mapping (was embedded in GameCard).diff --git a/Sources/HighballKit/Library.swift b/Sources/HighballKit/Library.swiftindex 5e682fb..1e1a823 100644--- a/Sources/HighballKit/Library.swift+++ b/Sources/HighballKit/Library.swift@@ -50,6 +50,21 @@ public struct LibraryItem: Identifiable, Sendable, Hashable {}public enum LibraryIndex {+ /// The installed games in the order the Home row shows them: the ones played most recently+ /// first, then the rest by title, so the row reads as "what you were playing, then what you+ /// have" (highball#252, from PR #230). Owned-but-not-installed games stay out; they belong to+ /// the grid, where the download arrow says what they are.+ public static func installedForHome(_ items: [LibraryItem]) -> [LibraryItem] {+ items.filter(\.installedAnywhere).sorted { a, b in+ switch (a.lastPlayed, b.lastPlayed) {+ case let (x?, y?) where x != y: return x > y+ case (.some, .none): return true+ case (.none, .some): return false+ default: return a.title.localizedCaseInsensitiveCompare(b.title) == .orderedAscending+ }+ }+ }+/// Launcher pins are infrastructure, not games — they never appear in the library, and/// launching one is not "playing" for the Continue shelf. Single source of truth for the/// filter BottleView's Programs section shares.diff --git a/Tests/HighballKitTests/HomeOrderTests.swift b/Tests/HighballKitTests/HomeOrderTests.swiftnew file mode 100644index 0000000..7378724--- /dev/null+++ b/Tests/HighballKitTests/HomeOrderTests.swift@@ -0,0 +1,28 @@+import XCTest+@testable import HighballKit++/// The Home row (highball#252): installed games only, the ones played most recently first, then+/// the rest by title. Owned-but-not-installed games stay in the grid.+final class HomeOrderTests: XCTestCase {+ private func item(_ title: String, installed: Bool, played: Date? = nil) -> HighballKit.LibraryItem {+ HighballKit.LibraryItem(source: .steam, id: "steam:\(title.hashValue)", title: title, bottleName: installed ? "Games" : nil,+ installed: installed, installedOnMac: false, steamAppID: abs(title.hashValue % 100000), epicAppName: nil,+ pinID: nil, artworkTall: nil, lastPlayed: played)+ }++ func testRecentlyPlayedComeFirstThenTheRestByTitle() {+ let now = Date()+ let items = [+ item("Zed", installed: true),+ item("Alpha", installed: true),+ item("Mid", installed: true, played: now.addingTimeInterval(-3600)),+ item("Newest", installed: true, played: now),+ item("Owned only", installed: false, played: now),+ ]+ XCTAssertEqual(LibraryIndex.installedForHome(items).map(\.title), ["Newest", "Mid", "Alpha", "Zed"])+ }++ func testNothingInstalledMeansAnEmptyRow() {+ XCTAssertTrue(LibraryIndex.installedForHome([item("Owned only", installed: false)]).isEmpty)+ }+}