Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Map the Command keys to Ctrl so Cmd+C/Cmd+V work in Windows apps

Michael Liendobe92822027d2
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 9730596..ae39033 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -482,6 +482,7 @@ final class AppState {
try await BottleStore.ensureWoW64(runner: runner, bottle: bottle, log: r.log)
try? await runner.setGpuIdentity()
try? await runner.setServiceTimeout()
+ try? await runner.setKeyboardMapping(commandIsControl: bottle.settings.commandIsControl)
await MainActor.run { self.appendLog("bottle repaired — Windows environment refreshed") }
}
}
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 25292ac..677a19e 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -365,6 +365,9 @@ struct BottleSettingsSheet: View {
ForEach(WindowsVersion.allCases, id: \.self) { Text($0.rawValue).tag($0) }
}
Toggle(L("Advertise AVX to games (Rosetta)"), isOn: binding(\.advertiseAVX))
+ Toggle(L("Use ⌘C / ⌘V inside Windows apps"), isOn: binding(\.commandIsControl))
+ Text(L("Maps the Command keys to Ctrl, so Mac copy and paste work in Steam and games. Option becomes Alt so Alt-based bindings keep working. Off = Wine's default, where Command acts as Alt."))
+ .font(.caption).foregroundStyle(.secondary)
Text(L("Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it."))
.font(.caption).foregroundStyle(.secondary)
}
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index bd3abb9..061a601 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -10,6 +10,8 @@ func L(_ en: String) -> String {
enum L10n {
static let fr: [String: String] = [
// Sidebar & shell
+ "Use ⌘C / ⌘V inside Windows apps": "Utiliser ⌘C / ⌘V dans les applications Windows",
+ "Maps the Command keys to Ctrl, so Mac copy and paste work in Steam and games. Option becomes Alt so Alt-based bindings keep working. Off = Wine's default, where Command acts as Alt.": "Associe les touches Command à Ctrl, pour que le copier-coller du Mac fonctionne dans Steam et les jeux. Option devient Alt afin que les raccourcis Alt continuent de fonctionner. Désactivé = comportement par défaut de Wine, où Command agit comme Alt.",
"Bottles": "Bouteilles",
"Engine": "Moteur",
"New Bottle": "Nouvelle bouteille",
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index e248e4e..bb70a6c 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -160,6 +160,11 @@ public struct BottleSettings: Codable, Sendable {
public var dxvkAsync: Bool = true
/// Cap the frame rate (0 = uncapped). Applied per renderer (DXVK_FRAME_RATE / DXMT_CONFIG).
public var fpsCap: Int = 0
+ /// Map the Mac Command keys to Windows Ctrl, so Cmd+C/Cmd+V/Cmd+A do what a Mac user expects
+ /// inside Windows apps. Wine's default leaves Command as Alt, which is why pasting into Steam
+ /// beeps instead of pasting. Option is mapped to Alt alongside it — without that, mapping both
+ /// Command keys leaves no way to send Alt at all (winemac.drv warns about exactly this).
+ public var commandIsControl: Bool = true
/// Windows UI scale as a DPI value (LogPixels): 96 = 100% (1x), up to 240 = 250%. Above 96 the
/// Mac driver switches to native Retina pixels so the scaled UI stays crisp. Applied to the prefix
/// registry on change. Supersedes the old on/off retinaMode (which was just 96 / 192).
diff --git a/Sources/HighballKit/BottleStore.swift b/Sources/HighballKit/BottleStore.swift
index dff6fc0..7e85243 100644
--- a/Sources/HighballKit/BottleStore.swift
+++ b/Sources/HighballKit/BottleStore.swift
@@ -74,6 +74,7 @@ public struct BottleStore: Sendable {
if windowsVersion != .win10 { try await runner.setWindowsVersion(windowsVersion) }
try? await runner.setGpuIdentity()
try? await runner.setServiceTimeout()
+ try? await runner.setKeyboardMapping(commandIsControl: bottle.settings.commandIsControl)
return bottle
}
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swift
index 6522a48..a3d91b6 100644
--- a/Sources/HighballKit/WineRunner.swift
+++ b/Sources/HighballKit/WineRunner.swift
@@ -271,6 +271,30 @@ public struct WineRunner: Sendable {
type: "REG_SZ", data: String(Self.servicesPipeTimeoutMs))
}
+ /// Wine's Mac driver leaves the Command keys acting as Alt, so Cmd+C / Cmd+V reach Windows
+ /// apps as Alt+C / Alt+V — nothing pastes and macOS beeps. Mapping Command to Ctrl fixes
+ /// copy/paste everywhere (Steam's login and store pages are the common report).
+ ///
+ /// Option must be mapped to Alt in the same breath: with both Command keys taken, winemac.drv
+ /// itself warns "there is no way to send an Alt key to Windows applications", which would break
+ /// Alt-driven game bindings. The four values move together or not at all.
+ ///
+ /// Pure so the mapping is unit-tested without touching a prefix.
+ public static func keyboardRegistry(commandIsControl: Bool) -> [(name: String, data: String)] {
+ let on = commandIsControl ? "1" : "0"
+ return [
+ ("LeftCommandIsCtrl", on), ("RightCommandIsCtrl", on),
+ ("LeftOptionIsAlt", on), ("RightOptionIsAlt", on),
+ ]
+ }
+
+ public func setKeyboardMapping(commandIsControl: Bool) async throws {
+ for v in Self.keyboardRegistry(commandIsControl: commandIsControl) {
+ try await regAdd(key: #"HKCU\Software\Wine\Mac Driver"#, name: v.name,
+ type: "REG_DWORD", data: v.data)
+ }
+ }
+
public func setGpuIdentity() async throws {
try await regAdd(key: #"HKCU\Software\Wine\Direct3D"#, name: "VideoPciVendorID", type: "REG_DWORD", data: String(Self.gpuIdentity.vendor))
try await regAdd(key: #"HKCU\Software\Wine\Direct3D"#, name: "VideoPciDeviceID", type: "REG_DWORD", data: String(Self.gpuIdentity.device))
diff --git a/Sources/highball/main.swift b/Sources/highball/main.swift
index 6ea3e9b..9d928b1 100644
--- a/Sources/highball/main.swift
+++ b/Sources/highball/main.swift
@@ -180,6 +180,7 @@ struct Bottle: AsyncParsableCommand {
let r = try await runner.wineboot()
try? await runner.setGpuIdentity()
try? await runner.setServiceTimeout()
+ try? await runner.setKeyboardMapping(commandIsControl: b.settings.commandIsControl)
// Same 32-bit check the app and bottle creation use (#37): wineboot exits 0 even
// when it skipped building syswow64, so the exit code alone means little.
try await BottleStore.ensureWoW64(runner: runner, bottle: b, log: r.log)
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index dc70e68..096c42a 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -80,6 +80,28 @@ final class RegressionTests: XCTestCase {
XCTAssertEqual(WineRunner.dpiRegistry(for: 999).retinaMode, "y")
}
+ // Cmd+V beeped instead of pasting in Steam: Wine's Mac driver leaves Command acting as Alt.
+ // Mapping Command to Ctrl without also mapping Option to Alt leaves no way to send Alt at all
+ // (winemac.drv warns about exactly that), so the four values must move together.
+ func testCommandKeyMappingMovesAsASet() throws {
+ let on = WineRunner.keyboardRegistry(commandIsControl: true)
+ XCTAssertEqual(on.count, 4)
+ XCTAssertEqual(Set(on.map(\.name)),
+ ["LeftCommandIsCtrl", "RightCommandIsCtrl", "LeftOptionIsAlt", "RightOptionIsAlt"])
+ XCTAssertTrue(on.allSatisfy { $0.data == "1" }, "Command→Ctrl is useless without Option→Alt")
+
+ let off = WineRunner.keyboardRegistry(commandIsControl: false)
+ XCTAssertTrue(off.allSatisfy { $0.data == "0" }, "off restores Wine's default mapping")
+ XCTAssertEqual(Set(off.map(\.name)), Set(on.map(\.name)),
+ "turning it off must clear the same keys it set, not leave half behind")
+ }
+
+ // New bottles get Mac-native copy/paste; the setting is what the registry write follows.
+ func testCommandIsControlDefaultsOn() throws {
+ let s = BottleSettings(name: "t", engineID: "e")
+ XCTAssertTrue(s.commandIsControl, "Mac users expect ⌘C/⌘V to work in Windows apps")
+ }
+
// Steam writes StateFlags 1026 while downloading; the game card must not offer Play.
func testACFDownloadingNotReady() throws {
let acf = """