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
Remove the shortcut next to Make a shortcut, and Uninstall Windows programs in environment settings (#97)
Gauthier Piarrette470dc5aba99e
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex c0931d1..842c44d 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -1065,6 +1065,25 @@ final class AppState {} catch { fail(error) }}+ /// Trashes the shortcut app for a game or a launcher (issue #97).+ func removeMacApp(title: String) {+ do {+ try MacAppStub.remove(for: title)+ appendLog("removed the shortcut for \(title) from ~/Applications/Highball")+ } catch { fail(error) }+ }++ /// Opens Wine's Add/Remove Programs in the environment, the way to uninstall a Windows+ /// program that was installed into it (issue #97). Nothing here is Highball's own data.+ func openUninstaller(in bottle: Bottle) {+ guard let engine = engine(for: bottle) else { return }+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)+ appendLog("\(bottle.name): opening Add/Remove Programs")+ Task.detached {+ _ = try? await runner.run(["uninstaller"], renderer: .wined3d, label: "uninstaller")+ }+ }+// MARK: Install funnel (UX plan 0.7)/// Local only. Nothing leaves the Mac unless the person reads the aggregate and sends it.diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swiftindex 5ff2f93..53b4b0a 100644--- a/Sources/HighballApp/BottleView.swift+++ b/Sources/HighballApp/BottleView.swift@@ -74,6 +74,7 @@ struct BottleView: View {.help(L("Renderer, synchronization, Windows version…"))Menu {Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }+ Button(L("Uninstall Windows programs…")) { state.openUninstaller(in: bottle) }Button(L("Stop all processes")) { state.killBottle(bottle) }} label: { Label(L("More"), systemImage: "ellipsis.circle") }}@@ -113,7 +114,11 @@ struct BottleView: View {else { state.applyRecipe(meta.id, to: bottle) }}.contextMenu {- Button(L("Make a shortcut…")) { state.makeMacApp(forLauncher: meta.id, short: meta.short) }+ if MacAppStub.existing(for: meta.short) != nil {+ Button(L("Remove the shortcut")) { state.removeMacApp(title: meta.short) }+ } else {+ Button(L("Make a shortcut…")) { state.makeMacApp(forLauncher: meta.id, short: meta.short) }+ }if installed, let pin {Button(L("Open")) { state.launch(pin: pin, in: bottle) }Button(L("Program settings…")) { editingPin = pin }diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swiftindex fb8218c..fe0d599 100644--- a/Sources/HighballApp/GameDetailView.swift+++ b/Sources/HighballApp/GameDetailView.swift@@ -242,7 +242,10 @@ struct GameDetailView: View {HStack(alignment: .firstTextBaseline, spacing: 12) {Text(L("Files")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }.controlSize(.small)- if PlayLink.target(for: item) != nil {+ if MacAppStub.existing(for: item.title) != nil {+ Button(L("Remove the shortcut")) { state.removeMacApp(title: item.title) }.controlSize(.small)+ .help(L("Moves this game's shortcut app in ~/Applications/Highball to the Trash."))+ } else if PlayLink.target(for: item) != nil {Button(L("Make a shortcut…")) { state.makeMacApp(for: item) }.controlSize(.small).help(L("A small app in ~/Applications/Highball that starts this game without opening Highball first."))}diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex 869d8f1..0a3419e 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -216,6 +216,10 @@ enum L10n {"Run and add to Programs": "Lancer et ajouter aux programmes","Keep current": "Garder l’actuel","Make a shortcut…": "Créer un raccourci…",+ "Remove the shortcut": "Supprimer le raccourci",+ "Moves this game's shortcut app in ~/Applications/Highball to the Trash.": "Place le raccourci de ce jeu (dans ~/Applications/Highball) dans la corbeille.",+ "Uninstall Windows programs…": "Désinstaller des programmes Windows…",+ "Opens Windows' Add/Remove Programs for this environment, for programs you installed into it.": "Ouvre Ajout/Suppression de programmes de Windows pour cet environnement, pour les programmes que vous y avez installés.","Steam's first start got stuck; restarting it": "Le premier démarrage de Steam s’est bloqué ; on le relance","That launcher link did not come from one of your Highball apps.": "Ce lien de lanceur ne vient pas d’une de vos apps Highball.","Open %@ in Highball?": "Ouvrir %@ dans Highball ?",diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swiftindex 0c85e94..a963dd4 100644--- a/Sources/HighballApp/LibraryView.swift+++ b/Sources/HighballApp/LibraryView.swift@@ -274,7 +274,9 @@ struct LibraryTile: View {if let appid = item.steamAppID, let running = state.session(forAppID: appid) {Button(L("Stop")) { state.stopSession(running) }} else if playable { Button(L("Play")) { state.play(item) } }- if playable, PlayLink.target(for: item) != nil {+ if MacAppStub.existing(for: item.title) != nil {+ Button(L("Remove the shortcut")) { state.removeMacApp(title: item.title) }+ } else if playable, PlayLink.target(for: item) != nil {Button(L("Make a shortcut…")) { state.makeMacApp(for: item) }}Button(L("Choose cover image…")) { state.chooseCover(for: item) }diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swiftindex 0239e38..fdb014c 100644--- a/Sources/HighballApp/SettingsView.swift+++ b/Sources/HighballApp/SettingsView.swift@@ -196,8 +196,13 @@ struct EnvironmentsPane: View {row(L("Windows components")) { WindowsComponentsRow(bottle: bottle) }Divider().padding(.vertical, 8)row(L("Files")) {- Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }- .buttonStyle(.link)+ HStack(spacing: 14) {+ Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }+ .buttonStyle(.link)+ Button(L("Uninstall Windows programs…")) { state.openUninstaller(in: bottle) }+ .buttonStyle(.link)+ .help(L("Opens Windows' Add/Remove Programs for this environment, for programs you installed into it."))+ }}}.padding(14)diff --git a/Sources/HighballKit/MacAppStub.swift b/Sources/HighballKit/MacAppStub.swiftindex d43d809..e035ded 100644--- a/Sources/HighballKit/MacAppStub.swift+++ b/Sources/HighballKit/MacAppStub.swift@@ -51,6 +51,18 @@ public enum MacAppStub {/// Writes (or rewrites) the bundle and returns its location. `cover` is any image file; it/// becomes the icon when sips and iconutil can convert it, and the stub still works without.@discardableResult+ /// The shortcut app for a title, if one was made.+ public static func existing(for title: String) -> URL? {+ let app = folder().appending(path: "\(appName(for: title)).app", directoryHint: .isDirectory)+ return FileManager.default.fileExists(atPath: app.path) ? app : nil+ }++ /// Moves the title's shortcut app to the Trash (issue #97). Nothing else references it.+ public static func remove(for title: String) throws {+ guard let app = existing(for: title) else { return }+ try FileManager.default.trashItem(at: app, resultingItemURL: nil)+ }+public static func write(title: String, libraryID: String, url: URL, cover: URL?, icon: URL? = nil) throws -> URL {let fm = FileManager.defaultlet name = appName(for: title)