Skip to content

nurkamol/mac-fn-key-remapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

🎹 Mac Fn Key Remapper

Advanced Function Key Remapping Tool for Apple Silicon Macs

License: MIT macOS Apple Silicon

Remap your MacBook's function keys to control keyboard backlight, media playback, and more — using native macOS hidutil. No third-party apps required!

Demo Demo Demo


✨ Features

  • 🔆 Keyboard Backlight Control — Missing on Apple Silicon Macs? Not anymore!
  • 🎵 Media Controls — Quick access to Play/Pause, Next/Previous track
  • 🛠️ Custom Mapping Builder — Create your own key combinations
  • 💾 Persistent — Survives restarts via LaunchAgent
  • 🖥️ Interactive Menu — Beautiful TUI for easy configuration
  • ⌨️ CLI Support — Script-friendly commands for automation
  • 🍎 Native — Uses macOS hidutil, no kernel extensions

🖥️ Compatibility

Requirement Supported
Chip Apple Silicon (M1, M2, M3, M4 series)
macOS 14 Sonoma, 15 Sequoia, and later
MacBook Air, Pro (all Apple Silicon models)

🚀 Quick Start

One-Line Install

curl -fsSL https://raw.githubusercontent.com/nurkamol/mac-fn-key-remapper/main/mac-fn-key-remapper.sh -o mac-fn-key-remapper.sh && chmod +x mac-fn-key-remapper.sh && ./mac-fn-key-remapper.sh

Manual Install

# Clone the repository
git clone https://github.com/nurkamol/mac-fn-key-remapper.git
cd mac-fn-key-remapper

# Make executable
chmod +x mac-fn-key-remapper.sh

# Run interactive menu
./mac-fn-key-remapper.sh

📖 Usage

Interactive Mode

Simply run the script without arguments:

./mac-fn-key-remapper.sh

You'll see a beautiful menu:

  ╔═══════════════════════════════════════════════════════════════╗
  ║       ⌨️  MAC FN KEY REMAPPER  💡                              ║
  ║         Advanced Function Key Remapping Tool                  ║
  ║              Apple Silicon Mac Edition                        ║
  ╚═══════════════════════════════════════════════════════════════╝

  [1]  Preset: Keyboard Backlight (F4↓ F5↑)
  [2]  Preset: Media Controls (F4⏮ F5⏯ F6⏭)
  [3]  Preset: Backlight + Media (F4↓ F5↑ F6⏯)
  [4]  Custom Mapping Builder
  [5]  Disable All Mappings
  ...

CLI Mode

# Enable keyboard backlight control
./mac-fn-key-remapper.sh backlight

# Enable media controls
./mac-fn-key-remapper.sh media

# Enable both backlight and play/pause
./mac-fn-key-remapper.sh combo

# Disable all mappings
./mac-fn-key-remapper.sh unload

# Check current status
./mac-fn-key-remapper.sh status

# Show version
./mac-fn-key-remapper.sh version

🎛️ Presets

1. Keyboard Backlight

Key New Function Original
F4 Backlight Down ↓ Spotlight
F5 Backlight Up ↑ Dictation

2. Media Controls

Key New Function Original
F4 Previous Track ⏮ Spotlight
F5 Play/Pause ⏯ Dictation
F6 Next Track ⏭ Do Not Disturb

3. Backlight + Media

Key New Function Original
F4 Backlight Down ↓ Spotlight
F5 Backlight Up ↑ Dictation
F6 Play/Pause ⏯ Do Not Disturb

🔧 HID Key Reference

Source Keys (Function Row)

Code Key Default Function
0xFF0100000010 F3 Mission Control
0x0C00000221 F4 Spotlight
0x10000009B F5 Dictation
0xC000000CF F6 Do Not Disturb
0x0C000002A2 F4 Launchpad (alt)

Destination Keys (Actions)

Code Action
0xFF00000008 Keyboard Backlight Up
0xFF00000009 Keyboard Backlight Down
0xFF00000004 Display Brightness Up
0xFF00000005 Display Brightness Down
0xC000000CD Play/Pause
0xC000000B5 Next Track
0xC000000B6 Previous Track
0xC000000E2 Mute
0xC000000E9 Volume Up
0xC000000EA Volume Down

❓ FAQ

Q: How do I access Spotlight after remapping F4?

A: Use Cmd + Space (default macOS shortcut)

Q: How do I access Dictation after remapping F5?

A: Go to System Settings → Keyboard → Dictation or set a custom shortcut

Q: Will this survive a restart?

A: Yes! The script creates a LaunchAgent that loads automatically at login

Q: How do I uninstall completely?

./mac-fn-key-remapper.sh unload
rm ~/Library/LaunchAgents/com.local.KeyRemapping.plist

Q: Does this work on Intel Macs?

A: Some mappings may work, but this tool is designed and tested for Apple Silicon


🤝 Contributing

Contributions are welcome! Feel free to:

  • 🐛 Report bugs
  • 💡 Suggest features
  • 🔀 Submit pull requests

📄 License

MIT License © 2026 Nurkamol Vakhidov


👨‍💻 Author

Nurkamol Vakhidov


Made with ❤️ for the Mac community

About

⌨️ Remap MacBook function keys to control keyboard backlight, media playback & more. Native macOS hidutil solution for Apple Silicon (M1/M2/M3/M4). No third-party apps needed!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages