Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GLS = 1, bound to the L Shift key (used on my keymap to do ACTION_MACRO(GLS) instead of ACTION_MACRO(1) which is not really understandable
- // GLG = 2, bound to the Greek key
- bool greekPressed = false;
- bool shiftPressed = false;
- const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
- {
- // MACRODOWN only works in this function
- switch(id) {
- case GLS: // Left Shift was pressed (or released)
- shiftPressed = !shiftPressed;
- // Send the signal to the computer
- if (record->event.pressed)
- register_code(KC_LSFT);
- else
- unregister_code(KC_LSFT);
- // Refresh Greek mode state
- enableDisableGreek();
- break;
- case GLG: // Greek key was pressed (or released)
- greekPressed = !greekPressed;
- enableDisableGreek();
- }
- return MACRO_NONE;
- };
- void enableDisableGreek()
- {
- if (!shiftPressed && !greekPressed)
- {
- ACTION_LAYER_OFF(L_CAPITALGREEK);
- ACTION_LAYER_OFF(L_GREEK);
- }
- else if (!shiftPressed && greekPressed)
- {
- ACTION_LAYER_OFF(L_CAPITALGREEK);
- ACTION_LAYER_ON (L_GREEK);
- }
- else if (shiftPressed && !greekPressed)
- {
- ACTION_LAYER_OFF(L_CAPITALGREEK);
- ACTION_LAYER_OFF(L_GREEK);
- }
- else if (shiftPressed && greekPressed)
- {
- ACTION_LAYER_ON (L_CAPITALGREEK);
- ACTION_LAYER_OFF(L_GREEK);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment