qmk_settings: initial prototype

This commit is contained in:
Ilya Zhuravlev
2021-06-29 19:43:11 -04:00
parent c0cd1bfc6c
commit 8dc2d07288
6 changed files with 143 additions and 8 deletions

View File

@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "process_grave_esc.h"
#include "qmk_settings.h"
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
* Used to ensure that the correct keycode is released if the key is released.
@ -25,35 +26,35 @@ bool process_grave_esc(uint16_t keycode, keyrecord_t *record) {
const uint8_t mods = get_mods();
uint8_t shifted = mods & MOD_MASK_SG;
#ifdef GRAVE_ESC_ALT_OVERRIDE
if (QS_grave_esc_alt_override) {
// if ALT is pressed, ESC is always sent
// this is handy for the cmd+opt+esc shortcut on macOS, among other things.
if (mods & MOD_MASK_ALT) {
shifted = 0;
}
#endif
}
#ifdef GRAVE_ESC_CTRL_OVERRIDE
if (QS_grave_esc_ctrl_override) {
// if CTRL is pressed, ESC is always sent
// this is handy for the ctrl+shift+esc shortcut on windows, among other things.
if (mods & MOD_MASK_CTRL) {
shifted = 0;
}
#endif
}
#ifdef GRAVE_ESC_GUI_OVERRIDE
if (QS_grave_esc_gui_override) {
// if GUI is pressed, ESC is always sent
if (mods & MOD_MASK_GUI) {
shifted = 0;
}
#endif
}
#ifdef GRAVE_ESC_SHIFT_OVERRIDE
if (QS_grave_esc_shift_override) {
// if SHIFT is pressed, ESC is always sent
if (mods & MOD_MASK_SHIFT) {
shifted = 0;
}
#endif
}
if (record->event.pressed) {
grave_esc_was_shifted = shifted;