Allow mod swapping for mod tap (MT) (#1202)
* allow mod swapping for mod tap * quick include * fix the mod swapping * make changes consistent with action code * fix bug * re-enable no gui, etc * fix binary comps * solid logic
This commit is contained in:
parent
d1fb8d2296
commit
61cdc9aaa4
|
@ -88,3 +88,31 @@ uint16_t keycode_config(uint16_t keycode) {
|
||||||
return keycode;
|
return keycode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t mod_config(uint8_t mod) {
|
||||||
|
keymap_config.raw = eeconfig_read_keymap();
|
||||||
|
if (keymap_config.swap_lalt_lgui) {
|
||||||
|
if ((mod & MOD_RGUI) == MOD_LGUI) {
|
||||||
|
mod &= ~MOD_LGUI;
|
||||||
|
mod |= MOD_LALT;
|
||||||
|
} else if ((mod & MOD_RALT) == MOD_LALT) {
|
||||||
|
mod &= ~MOD_LALT;
|
||||||
|
mod |= MOD_LGUI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keymap_config.swap_ralt_rgui) {
|
||||||
|
if ((mod & MOD_RGUI) == MOD_RGUI) {
|
||||||
|
mod &= ~MOD_RGUI;
|
||||||
|
mod |= MOD_RALT;
|
||||||
|
} else if ((mod & MOD_RALT) == MOD_RALT) {
|
||||||
|
mod &= ~MOD_RALT;
|
||||||
|
mod |= MOD_RGUI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keymap_config.no_gui) {
|
||||||
|
mod &= ~MOD_LGUI;
|
||||||
|
mod &= ~MOD_RGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mod;
|
||||||
|
}
|
|
@ -16,11 +16,13 @@
|
||||||
|
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
#include "keycode.h"
|
#include "keycode.h"
|
||||||
|
#include "action_code.h"
|
||||||
|
|
||||||
#ifndef KEYCODE_CONFIG_H
|
#ifndef KEYCODE_CONFIG_H
|
||||||
#define KEYCODE_CONFIG_H
|
#define KEYCODE_CONFIG_H
|
||||||
|
|
||||||
uint16_t keycode_config(uint16_t keycode);
|
uint16_t keycode_config(uint16_t keycode);
|
||||||
|
uint8_t mod_config(uint8_t mod);
|
||||||
|
|
||||||
/* NOTE: Not portable. Bit field order depends on implementation */
|
/* NOTE: Not portable. Bit field order depends on implementation */
|
||||||
typedef union {
|
typedef union {
|
||||||
|
|
|
@ -123,7 +123,8 @@ action_t action_for_key(uint8_t layer, keypos_t key)
|
||||||
action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
|
action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
|
||||||
break;
|
break;
|
||||||
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
|
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
|
||||||
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF);
|
mod = mod_config((keycode >> 0x8) & 0x1F);
|
||||||
|
action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF);
|
||||||
break;
|
break;
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
case BL_0 ... BL_15:
|
case BL_0 ... BL_15:
|
||||||
|
|
Loading…
Reference in New Issue