diff --git a/Platform/macOS/Display/VMMetalView.swift b/Platform/macOS/Display/VMMetalView.swift index 8d8be2fb..5885f489 100644 --- a/Platform/macOS/Display/VMMetalView.swift +++ b/Platform/macOS/Display/VMMetalView.swift @@ -26,11 +26,12 @@ class VMMetalView: MTKView { private(set) var isMouseInWindow = false @Setting("HandleInitialClick") private var isHandleInitialClick: Bool = false @Setting("IsCtrlCmdSwapped") private var isCtrlCmdSwapped = false + @Setting("IsISOKeySwapped") private var isISOKeySwapped = false /// On ISO keyboards we have to switch `kVK_ISO_Section` and `kVK_ANSI_Grave` /// from: https://chromium.googlesource.com/chromium/src/+/lkgr/ui/events/keycodes/keyboard_code_conversion_mac.mm private func convertToCurrentLayout(for keycode: Int) -> Int { - guard KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardISO else { + guard !isISOKeySwapped && KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardISO else { return keycode } switch keycode { diff --git a/Platform/macOS/SettingsView.swift b/Platform/macOS/SettingsView.swift index fdde75a2..045c8002 100644 --- a/Platform/macOS/SettingsView.swift +++ b/Platform/macOS/SettingsView.swift @@ -272,7 +272,8 @@ struct InputSettingsView: View { @AppStorage("IsCtrlCmdSwapped") var isCtrlCmdSwapped = false @AppStorage("InvertScroll") var isInvertScroll = false @AppStorage("HandleInitialClick") var isHandleInitialClick = false - + @AppStorage("IsISOKeySwapped") var isISOKeySwapped = false + @State private var isKeyboardShortcutsShown = false var body: some View { @@ -320,6 +321,9 @@ struct InputSettingsView: View { Toggle(isOn: $isCtrlCmdSwapped, label: { Text("Swap Control (⌃) and Command (⌘) keys") }).help("This does not apply to key binding outside the guest.") + Toggle(isOn: $isISOKeySwapped) { + Text("Swap the leftmost key on the number row and the key next to left shift on ISO keyboards") + }.help("This only applies to ISO layout keyboards.") } .sheet(isPresented: $isKeyboardShortcutsShown) { VMKeyboardShortcutsView().padding()