+
+ if (id == L_CTRL_ALT_ENT || id == R_CTRL_ALT_ENT) {
+ if (record->tap.count == 0 || record->tap.interrupted) {
+ uint8_t weak_mods;
+ uint8_t layer;
+
+ if (id == L_CTRL_ALT_ENT) {
+ weak_mods = MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT);
+ layer = 5;
+ } else {
+ weak_mods = MOD_BIT(KC_RCTL) | MOD_BIT(KC_RALT);
+ layer = 6;
+ }
+
+ if (record->event.pressed) {
+ layer_on(layer);
+ add_weak_mods(weak_mods);
+ } else {
+ del_weak_mods(weak_mods);
+ layer_off(layer);
+ }
+ } else {
+ if (record->event.pressed) {
+ add_key(KC_ENT);
+ send_keyboard_report();
+ } else {
+ del_key(KC_ENT);
+ send_keyboard_report();
+ }
+ }
+ }
+
+
+/*
+ * just an example of custom key implementation
+ * not really needed with custom keymap_fn_to_action(),
+ * because it will allow you to have 32 FN** keys on EACH layer
+ */
+
+/*
+ keyevent_t event = record->event;
+
+ if (id == CUSTOM_KEY) {
+ uint8_t layer = biton32(layer_state);
+ uint8_t col = event.key.col;
+ uint8_t row = event.key.row;
+ uint8_t handled = 0;
+
+ if (event.pressed) {
+ if (layer == XXX && col == XXX && row == XXX) {
+ action_macro_play(
+ MACRO(
+ ...........
+ END)
+ );
+ handled++;
+ }
+ }
+ }
+
+ if (!handled) {
+ print("custom key not handled");
+ print(": layer "); pdec(layer);
+ print(", col "); pdec(col);
+ print(", row "); pdec(row);
+ print("\n");
+ }
+ }
+*/
+
+}
+
+#include "keymap_passwords.h"
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ if (record->event.pressed) {
+ switch (id) {
+ case XMONAD_RESET: return MACRO_XMONAD_RESET;
+ case PASSWORD1: return MACRO_PASSWORD1;
+ }
+ }
+ return MACRO_NONE;
+}
+
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+#define FN_ACTIONS_4_SIZE (sizeof(fn_actions_4) / sizeof(fn_actions_4[0]))
+#define FN_ACTIONS_7_SIZE (sizeof(fn_actions_7) / sizeof(fn_actions_7[0]))
+#define FN_ACTIONS_9_SIZE (sizeof(fn_actions_9) / sizeof(fn_actions_9[0]))
+
+/*
+ * translates Fn keycode to action
+ * for some layers, use different translation table
+ */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ uint8_t layer = biton32(layer_state);
+
+ action_t action;
+ action.code = ACTION_NO;
+
+ if (layer == 4 && FN_INDEX(keycode) < FN_ACTIONS_4_SIZE) {
+ action.code = pgm_read_word(&fn_actions_4[FN_INDEX(keycode)]);
+ }
+
+ if (layer == 7 && FN_INDEX(keycode) < FN_ACTIONS_7_SIZE) {
+ action.code = pgm_read_word(&fn_actions_7[FN_INDEX(keycode)]);
+ }
+
+ if (layer == 9 && FN_INDEX(keycode) < FN_ACTIONS_9_SIZE) {
+ action.code = pgm_read_word(&fn_actions_9[FN_INDEX(keycode)]);
+ }
+
+ // by default, use fn_actions from default layer 0
+ // this is needed to get mapping for same key, that was used switch to some layer,
+ // to have possibility to switch layers back
+ if (action.code == ACTION_NO && FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ }
+
+ return action;