# Install QMK via UV
uv tool install qmk
export QMK_HOME='~/qmk_firmware' # Optional, set the location for `qmk_firmware`
qmk setup # This will clone `qmk/qmk_firmware` and optionally set up your build environment
Ref: Monotux
- Update rules.mk
OS_DETECTION_ENABLE = yes
DEFERRED_EXEC_ENABLE = yes
- Update keymap.c
#include "quantum.h"
#ifdef OS_DETECTION_ENABLE
void keyboard_post_init_user(void) {
// Optional: detect and act immediately
os_variant_t host = detected_host_os();
// ... apply settings based on host
}
// Optional: Use a callback function to handle detection
bool process_detected_host_os_user(os_variant_t detected_os) {
switch (detected_os) {
case OS_MACOS:
case OS_IOS:
// Swap Alt and GUI for Mac
keymap_config.swap_lalt_lgui = true;
keymap_config.swap_ralt_rgui = true;
break;
default:
// Default for Windows/Linux
keymap_config.swap_lalt_lgui = false;
keymap_config.swap_ralt_rgui = false;
break;
}
return true; // Propagate to keyboard level
}
#endif