Skip to content

Instantly share code, notes, and snippets.

@arkag
Created August 31, 2018 19:10
Show Gist options
  • Select an option

  • Save arkag/e9380b225668bb3e11aec66084cc49a0 to your computer and use it in GitHub Desktop.

Select an option

Save arkag/e9380b225668bb3e11aec66084cc49a0 to your computer and use it in GitHub Desktop.
Set OS function for QMK with update eeprom functionality
void set_os(OS type, bool update) {
userspace_config.curr_os = type;
underlight_color = HSV_COEFFICIENT * type;
switch (type) {
case OS_MAC:
set_unicode_input_mode(UC_OSX_RALT);
userspace_config.next_os = OS_WIN;
break;
case OS_WIN:
set_unicode_input_mode(UC_WIN);
userspace_config.next_os = OS_NIX;
break;
case OS_NIX:
set_unicode_input_mode(UC_LNX);
userspace_config.next_os = OS_MAC;
break;
}
if (update) {
rgblight_sethsv(underlight_color, 255, 255);
eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
} else {
rgblight_sethsv_noeeprom(underlight_color, 255, 255);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment