+
+
+/*
+ * 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]))
+
+/*
+ * 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)]);
+ }
+
+ // 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;