Skip to content
jthegunner_

← All projects

karabiner-windows-keyboard-mapping-macos

A comprehensive Karabiner-Elements configuration to replicate the Windows keyboard experience on macOS. Includes modifier key swaps (Ctrl/Cmd), Windows-style shortcuts (Alt+E, F2, F5), and app-specific remappings for a seamless OS transition.

ActiveNo CI

★ 0 · Last push 27 Nov 2026

Open on GitHub

Releases

No releases yet.

README

⌨️ Windows Keyboard Mapping for macOS

Windows / PC muscle memory on a Mac, without breaking the terminal.

🪟 PC keyboard (Swiss ISO)  →  🔄 Karabiner-Elements  →  🍎 macOS apps · terminals · IDEs


🎯 What it is

A Karabiner-Elements configuration for a Mac driven by a Swiss-German ISO PC keyboard. It gives you the Windows shortcuts your fingers already know:

  • Ctrl+C/V/X/Z/Y, Ctrl+S, Ctrl+F, … in every GUI app
  • Home / End, Ctrl+Home/End, Ctrl+←/→ word jump, Ctrl+Backspace/Delete
  • Alt+F4, Ctrl+Space (Spotlight), F2 rename and Enter open in Finder
  • F5, F12, Ctrl+H and Ctrl+keypad zoom in browsers

…while terminals keep real UNIX behaviour (Ctrl+C = SIGINT) and IDEs keep their own keymaps.

Piece Where it lives
Windows shortcuts (this repo) Karabiner-Elements
Swiss AltGr characters (@ # | \ ~ [] {} €) swiss-windows-keyboard-layout-macos (a keyboard layout, not Karabiner)
IDE keymaps for the VS Code family intelli-key-port
Whole-Mac bootstrap that wires it all together macos-base-config

🧭 Design

Every key press is routed by the app in front:

                 ┌──────────────────────────────────────────────┐
  key press ───▶ │ Karabiner: which app is frontmost?           │
                 └──────────────────────────────────────────────┘
                   │                 │                  │
             terminal              IDE            any other GUI app
                   │                 │                  │
     Ctrl stays Ctrl (SIGINT)  native keymap      Ctrl → Cmd (PC-style)
     Ctrl+Shift+C/V = copy/paste  + Alt+digit →    Home/End, word jump,
     Ctrl+←/→ = word motion       tool windows     Alt+F4, F2, F5, …
  1. Terminals are not IDEs. Terminal-only rules match real terminal emulators — Terminal, iTerm2, Ghostty, Warp, Tabby, WezTerm, Kitty, Alacritty, Hyper. IDE bundle ids are deliberately not in that list, so an IDE's editor never gets terminal rewrites.
  2. IDEs keep their native keymaps. VS Code (+ Insiders), VSCodium, Cursor, Windsurf, Zed, Antigravity and all JetBrains IDEs run Windows-style keymaps themselves, so the PC-Ctrl swap and the cursor rules skip them.
  3. Ctrl+C stays SIGINT in terminals. Clipboard verbs are remapped only outside terminals; inside, Ctrl+Shift+C/V copy and paste. Ctrl/Shift+Insert copy and paste everywhere.
  4. Remote and VM clients get raw keys. Microsoft Remote Desktop, Parallels, VMware, VirtualBox, Citrix, TeamViewer, Parsec, … are excluded from the PC-Ctrl swap, the cursor rules and the system verbs, so the Windows guest receives the keys unchanged.

🗂️ Rule groups

Source files: assets/complex_modifications/winkeys-<nn>-*.json. In karabiner.json every rule of this set is prefixed with [winkeys].

# Rule group Active in
↩️ 05 Shift+Enter → real newline (Claude Code, zsh, REPLs) terminals + Windsurf, VSCodium, Code-OSS, Zed
🔁 10 PC-style Ctrl: left_control+<key> → left_command+<key> GUI apps except terminals, IDEs, remote/VM clients
↪️ 15 Ctrl+Y (physical QWERTZ Y) → Redo same scope as 10
✂️ 16 Ctrl+X → copy, then Ctrl+V → move (Cmd+Option+V); Ctrl+C / Esc cancel a pending cut. Finder has no native cut Finder (not while renaming; Path Finder has its own cut)
🔤 20 Home/End, Ctrl+Home/End, Ctrl+←/→ word jump, Ctrl+Backspace/Delete word delete GUI apps except terminals, IDEs, remote/VM clients ¹
💬 22 Ctrl+A → Cmd+A · Ctrl+C → Ctrl+Insert · Ctrl+Z → Cmd+Z · Ctrl+Y → Cmd+Shift+Z (the agent chat swallows or misroutes the originals) Antigravity + Antigravity IDE ³
💻 25 Ctrl+←/→ → Option+←/→ word motion terminals only
🖱️ 35 Ctrl+left-click → Cmd+left-click (discontiguous multi-select) everywhere
📋 40 Ctrl+Shift+C/V/F/A, Ctrl+T/N · Ctrl/Shift+Insert → copy / paste terminals only · Insert: everywhere except IDEs, remote/VM ²
🧰 45 Alt+0…9 → Ctrl+Shift+Alt+Cmd+0…9 (tool windows); AltGr stays free so AltGr+1/2/3/7 type | @ # | · Alt+Insert → Option+Insert IDEs only
❌ 50 Alt+F4 → close window · Ctrl+Space → Spotlight everywhere except remote/VM clients
📁 60 F2 → rename · Enter → open selected item · Delete → Trash (Path Finder only; Finder already does it) Finder, Path Finder
🌐 70 F5 / Ctrl+F5 reload · F12 DevTools · Ctrl+H history · Ctrl+keypad -/+/0 zoom Safari, Chrome, Brave, Edge, Firefox, Arc, Dia

¹ Exception: Antigravity IDE is not excluded from Home/End, Ctrl+Home/End and Ctrl+←/→, so these keys also work in its agent-chat input. ² IDEs bind Ctrl/Shift+Insert in their own keymaps (JetBrains Default for XWin, VS Code keybindings), so rule 40 leaves them alone there. ³ Karabiner cannot tell the chat from the integrated terminal, so the karabiner-winkeys layer of intelli-key-port sends ^A/^C/^Z/^Y back to the terminal. Ctrl+Shift+Z is left untouched. Port your editor keymap with intelli-key-port --layer karabiner-winkeys so the editor side matches the rewritten keys.

Important
Karabiner evaluates rules top-down and the first match wins. The group number is an id, not the position: in karabiner.json, groups 15 and 70 sit before group 10, otherwise the generic Ctrl→Cmd swap would swallow Ctrl+Y, Ctrl+H and Ctrl+F5.

🧰 Why rule 45 exists

macOS apps cannot tell left from right Option. An IDE shortcut on Option+3 therefore swallows the # that AltGr+3 (right Option) should type. The fix:

  • the physical Alt key, which arrives as left_command on this keyboard (see MX Keys: Windows mode), is rewritten to Ctrl+Shift+Alt+Cmd+<digit> inside IDEs;
  • the IDE keymaps bind their tool windows to Ctrl+Shift+Alt+Cmd+<digit> and keep no Alt+<digit> binding — for the VS Code family, intelli-key-port ports that from the JetBrains keymap.

✨ Personal extras

karabiner.json also carries a few rules that are not part of the winkeys set and have no source file:

Shortcut Action
Option+. emoji picker
Option+V macOS clipboard history (disabled in karabiner.json)
Option+Shift+S area screenshot to the clipboard
mouse side keys back / forward as Cmd+Option+[ / ] in apps without native support, e.g. Finder (browsers, IDEs, terminals, RDP & VM clients keep their own handling)
Cmd+Option+L format document in IDEs
Option+L lock screen
Ctrl+Esc Launchpad (disabled in karabiner.json)
Ctrl+Cmd+Delete Activity Monitor
Option+E open Finder

📋 Requirements

  • macOS with Homebrew (or Karabiner-Elements installed manually)
  • python3 (ships with the Xcode Command Line Tools)
  • A PC keyboard with an ISO layout — the machine config below assumes a Swiss-German one

🚀 Install

Command What it does
🆕 ./setup.sh Fresh Mac: installs Karabiner-Elements via Homebrew, runs apply.sh and set-machine-config.py, opens the permission panes
📥 ./apply.sh Backs up the live config, copies karabiner.json and the winkeys-*.json files into ~/.config/karabiner/
👀 ./apply.sh --dry-run Shows what apply.sh would do, changes nothing
📤 ./export.sh Pulls the live config back into the repo after GUI tweaks and shows the git diff --stat

Karabiner hot-reloads karabiner.json — no restart needed.

Warning
No script can grant the three macOS permissions Karabiner needs. After setup.sh, enable them by hand in System Settings: Driver Extensions → Karabiner-DriverKit-VirtualHIDDevice, Input Monitoring → karabiner_grabber (and Karabiner-Elements), Accessibility → Karabiner-Elements.

🔧 Machine-level settings

karabiner_cli cannot set simple modifications or device settings, so bin/set-machine-config.py edits the selected profile in ~/.config/karabiner/karabiner.json directly (backup first):

python3 bin/set-machine-config.py          # all of the below
python3 bin/set-machine-config.py --show   # print current values, change nothing
python3 bin/set-machine-config.py --iso    # one at a time: --simple-mods / --iso / --devices
Flag Sets
--simple-mods right_command → right_option, so the right Alt key acts as AltGr
--iso virtual keyboard type iso
--devices known Logitech keyboard/mice (vendor id 1133), incl. the MX Keys Alt/Win swap below; edit DEVICES in the script for your hardware — entries only match that exact device and are harmless otherwise

⌨️ Logitech MX Keys: Windows mode

The MX Keys sends Insert only in its Windows mode (Fn+P); in macOS mode (Fn+O) the key sends nothing at all. Windows mode, however, swaps Alt and Win: Alt arrives as left_option, Win as left_command. The MX Keys device entry swaps them back, so every rule still sees Alt as left_command and Win as left_option.

Important
Keep the keyboard in Windows mode: in Logi Options+, turn off Always keep keyboard on Mac layout and set the platform to Windows. In macOS mode the device swap turns Alt and Win the wrong way round — Fn+P fixes it.


📁 Repository layout

assets/complex_modifications/winkeys-*.json   source rule groups (importable in the Karabiner GUI)
karabiner.json                                full profile that apply.sh installs
apply.sh · export.sh · setup.sh               install / sync scripts
bin/set-machine-config.py                     machine-level settings
tests/apply-test.sh                           tests for apply.sh (bash tests/apply-test.sh)
tests/config-test.sh                          tests for karabiner.json, fragments, device settings

Note
There is no build step. karabiner.json contains the winkeys rules verbatim (prefixed [winkeys]), so a rule change has to land in both its winkeys-*.json file and karabiner.json. export.sh only syncs karabiner.json — mirror GUI edits into the matching source file by hand.


⏪ Rollback

Every write by apply.sh or set-machine-config.py leaves a timestamped backup next to the live file. apply.sh leaves files that already match this repo alone, so a re-run without changes writes nothing and makes no backup:

cp ~/.config/karabiner/karabiner-bkp-<timestamp>.json ~/.config/karabiner/karabiner.json

Karabiner's own ~/.config/karabiner/automatic_backups/ is a second safety net.


🤝 Contributing

Issues and pull requests are welcome. Try changes with ./apply.sh --dry-run first and run the tests with bash tests/apply-test.sh && bash tests/config-test.sh. After tweaking rules in the Karabiner GUI, run ./export.sh and update the matching winkeys-*.json so both files stay in sync in your PR.


📄 License

MIT — see LICENSE. © 2026 Jeffry Würmli.

Built on Karabiner-Elements by pqrs.org.


Made for fingers that learned on Windows and moved to a Mac. ⌨️