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
A game can be renamed from its tile (asked on Discord, 2026-10-01)
Gauthier Piarrette843bd0fc7980
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex f9f0e7e..c1ce6c2 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -237,14 +237,50 @@ final class AppState {var libraryStore: LibraryStore { LibraryStore(paths: paths) }func rebuildLibrary() {+ customNames = nameStore.names()libraryItems = LibraryIndex.build(bottles: bottles, steamByBottle: gamesByBottle,steamOwnedByBottle: steamOwnedByBottle, macInstalled: macSteamGames,epicOwned: epicOwned, epicInstalls: epicInstalls,plays: libraryPlays)+ sortLibraryByDisplayTitle()if let deferred = deferredPlayLink { resolvePlayLink(deferred.request) }refreshMacFlags()}+ // MARK: Names people give their games++ /// Custom names by item id (NameStore). A renamed game sorts, searches and shows under its+ /// new name; the store's own title stays the key for the database and for Steam.+ var customNames: [String: String] = [:]+ var nameStore: NameStore { NameStore(paths: paths) }+ /// The tile whose rename field is open, and the text in it.+ var renaming: LibraryItem?+ var renameText = ""++ func displayTitle(_ item: LibraryItem) -> String { customNames[item.id] ?? item.title }++ func beginRename(_ item: LibraryItem) {+ renameText = displayTitle(item)+ renaming = item+ }++ /// Saves the name in the field; a blank resets to the store's title.+ func rename(_ item: LibraryItem, to name: String) {+ do {+ try nameStore.setName(name, for: item.id)+ customNames = nameStore.names()+ sortLibraryByDisplayTitle()+ } catch { fail(error) }+ renaming = nil+ }++ func resetName(for item: LibraryItem) { rename(item, to: "") }++ private func sortLibraryByDisplayTitle() {+ guard !customNames.isEmpty else { return }+ libraryItems.sort { displayTitle($0).localizedCaseInsensitiveCompare(displayTitle($1)) == .orderedAscending }+ }+// MARK: Mac builds on Steam/// What Steam for Mac has installed (MacSteam), refreshed with the bottles' own installs.diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swiftindex 2112c6b..282ddfc 100644--- a/Sources/HighballApp/GameDetailView.swift+++ b/Sources/HighballApp/GameDetailView.swift@@ -54,7 +54,7 @@ struct GameDetailView: View {.frame(maxWidth: .infinity, alignment: .leading)}.background(BottleBackdrop())- .navigationTitle(item.title)+ .navigationTitle(state.displayTitle(item)).sheet(isPresented: $showBottleSettings) {if let bottle { BottleSettingsSheet(bottle: bottle) }}@@ -88,7 +88,7 @@ struct GameDetailView: View {.clipped()LinearGradient(colors: [.black.opacity(0.8), .clear], startPoint: .bottom, endPoint: .center).frame(maxWidth: 640)- Text(item.title)+ Text(state.displayTitle(item)).font(.system(size: 24, weight: .bold, design: .rounded)).foregroundStyle(.white).shadow(radius: 4).padding(14)diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex bb0ed3e..e49601b 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -261,6 +261,10 @@ enum L10n {"Windows program": "Programme Windows","Choose cover image…": "Choisir une image de couverture…","Reset cover": "Réinitialiser la couverture",+ "Rename…": "Renommer…",+ "Rename": "Renommer",+ "Reset name": "Rétablir le nom",+ "The store keeps calling it %@. Leave the field empty to go back to that name.": "La boutique continue de l’appeler %@. Laissez le champ vide pour revenir à ce nom.","Choose a cover image for %@": "Choisir une image de couverture pour %@","Apply %@ fix": "Appliquer le correctif %@","%@ needs a one-time setup to run the way it was verified.":diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swiftindex b7c67db..c9474d5 100644--- a/Sources/HighballApp/LibraryView.swift+++ b/Sources/HighballApp/LibraryView.swift@@ -29,7 +29,8 @@ struct LibraryView: View {if verifiedOnly {guard state.gameDB.entry(for: item)?.status == "verified-local" else { return false }}- if !search.isEmpty && !item.title.localizedCaseInsensitiveContains(search) { return false }+ if !search.isEmpty && !item.title.localizedCaseInsensitiveContains(search)+ && !state.displayTitle(item).localizedCaseInsensitiveContains(search) { return false }return true}}@@ -274,7 +275,7 @@ struct LibraryTile: View {.scaleEffect(hovering ? 1.02 : 1).shadow(color: .black.opacity(hovering ? 0.4 : 0.2), radius: hovering ? 12 : 5, y: 3)- Text(item.title)+ Text(state.displayTitle(item)).font(.system(size: 12, weight: .semibold)).lineLimit(1).foregroundStyle(.primary)@@ -303,6 +304,15 @@ struct LibraryTile: View {hovering = false}.help(Self.tooltip(entry?.notes) ?? item.title)+ // The rename field, on the tile being renamed only. A blank name is a reset.+ .alert(L("Rename"), isPresented: Binding(get: { state.renaming?.id == item.id },+ set: { if !$0 { state.renaming = nil } })) {+ TextField(L("Name"), text: Binding(get: { state.renameText }, set: { state.renameText = $0 }))+ Button(L("Rename")) { state.rename(item, to: state.renameText) }+ Button(L("Cancel"), role: .cancel) { state.renaming = nil }+ } message: {+ Text(String(format: L("The store keeps calling it %@. Leave the field empty to go back to that name."), item.title))+ }.contextMenu {if let appid = item.steamAppID, let running = state.session(forAppID: appid) {Button(L("Stop")) { state.stopSession(running) }@@ -316,6 +326,10 @@ struct LibraryTile: View {if state.coverStore.coverURL(for: item.id) != nil {Button(L("Reset cover")) { state.resetCover(for: item) }}+ Button(L("Rename…")) { state.beginRename(item) }+ if state.customNames[item.id] != nil {+ Button(L("Reset name")) { state.resetName(for: item) }+ }// A program someone added by hand leaves the library from its tile, not only from// the environment's programs list (highball-db#68). Steam and Epic entries follow// their stores' libraries, so they have no such button.diff --git a/Sources/HighballKit/Library.swift b/Sources/HighballKit/Library.swiftindex 5cdb636..5e682fb 100644--- a/Sources/HighballKit/Library.swift+++ b/Sources/HighballKit/Library.swift@@ -344,3 +344,38 @@ public struct CoverStore: Sendable {try? FileManager.default.removeItem(at: existing)}}++/// The names people give library entries themselves, beside the covers they choose: a Steam+/// title in a language they do not read, a program added by hand under its file name, a game+/// they call something else (asked for on Discord, 2026-10-01). One JSON file in the home,+/// keyed by the library item's id, so a rename survives rebuilds of the library and never+/// touches the store's own title, which the database lookup and Steam itself keep using.+public struct NameStore: Sendable {+ public let paths: HighballPaths+ public init(paths: HighballPaths = HighballPaths()) { self.paths = paths }++ var file: URL { paths.home.appending(path: "names.json") }++ /// Every custom name, by item id. An unreadable file reads as no names, never as an error.+ public func names() -> [String: String] {+ guard let d = try? Data(contentsOf: file) else { return [:] }+ return (try? JSONDecoder().decode([String: String].self, from: d)) ?? [:]+ }++ public func name(for id: String) -> String? { names()[id] }++ /// Sets a name, or clears it when the name is empty once trimmed: a blank is a reset, not a+ /// game called nothing.+ public func setName(_ name: String?, for id: String) throws {+ var all = names()+ let trimmed = name?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""+ if trimmed.isEmpty { all.removeValue(forKey: id) } else { all[id] = trimmed }+ if all.isEmpty {+ try? FileManager.default.removeItem(at: file)+ return+ }+ try FileManager.default.createDirectory(at: paths.home, withIntermediateDirectories: true)+ let enc = JSONEncoder(); enc.outputFormatting = [.prettyPrinted, .sortedKeys]+ try enc.encode(all).write(to: file, options: .atomic)+ }+}diff --git a/Tests/HighballKitTests/NameStoreTests.swift b/Tests/HighballKitTests/NameStoreTests.swiftnew file mode 100644index 0000000..2febf42--- /dev/null+++ b/Tests/HighballKitTests/NameStoreTests.swift@@ -0,0 +1,47 @@+import XCTest+@testable import HighballKit++/// Names people give their games (NameStore): kept by item id in the home, a blank resets, and+/// the store's own title is never touched.+final class NameStoreTests: XCTestCase {+ private var home: URL!+ private var store: NameStore!++ override func setUpWithError() throws {+ home = FileManager.default.temporaryDirectory.appending(path: "names-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: home, withIntermediateDirectories: true)+ store = NameStore(paths: HighballPaths(home: home))+ }++ override func tearDownWithError() throws { try? FileManager.default.removeItem(at: home) }++ func testNoFileMeansNoNames() {+ XCTAssertEqual(store.names(), [:])+ XCTAssertNil(store.name(for: "steam:620"))+ }++ func testANameIsKeptByItemIdAndSurvivesANewStore() throws {+ try store.setName("Portal Deux", for: "steam:620")+ XCTAssertEqual(store.name(for: "steam:620"), "Portal Deux")+ XCTAssertEqual(NameStore(paths: HighballPaths(home: home)).name(for: "steam:620"), "Portal Deux")+ }++ func testABlankNameResetsAndTheLastResetRemovesTheFile() throws {+ try store.setName("Portal Deux", for: "steam:620")+ try store.setName(" ", for: "steam:620")+ XCTAssertNil(store.name(for: "steam:620"))+ XCTAssertFalse(FileManager.default.fileExists(atPath: home.appending(path: "names.json").path))+ }++ func testSurroundingWhitespaceIsTrimmed() throws {+ try store.setName(" My Game \n", for: "pin:Games:00000000-0000-0000-0000-000000000001")+ XCTAssertEqual(store.name(for: "pin:Games:00000000-0000-0000-0000-000000000001"), "My Game")+ }++ func testOtherNamesStayWhenOneIsReset() throws {+ try store.setName("A", for: "steam:1")+ try store.setName("B", for: "steam:2")+ try store.setName(nil, for: "steam:1")+ XCTAssertEqual(store.names(), ["steam:2": "B"])+ }+}