From 5afb50b1e8a737a4b906d2cdda22888eca8468a7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 9 Dec 2024 19:43:04 +0100 Subject: build: Add infrastructure --- .ccls | 1 + .envrc | 6 + .gitignore | 17 + .reuse/templates/default.jinja2 | 28 ++ README.md | 26 ++ build.sh | 85 ++++ cog.toml | 34 ++ flake.lock | 85 ++++ flake.nix | 66 +++ github.yml | 109 +++++ package.nix | 67 +++ scripts/download.sh | 34 ++ src/config.h | 25 ++ src/keymap.c | 476 +++++++++++++++++++++ src/rules.mk | 17 + treefmt.nix | 80 ++++ update.sh | 13 + zsa_moonlander_layout-v25_source/config.h | 25 ++ zsa_moonlander_layout-v25_source/keymap.c | 476 +++++++++++++++++++++ zsa_moonlander_layout-v25_source/rules.mk | 17 + .../zsa_moonlander_layout-v25_KWBYA_PzA9E.bin | Bin 0 -> 64560 bytes .../zsa_moonlander_layout-v25_KWBYA_PzA9E.md5 | 1 + 22 files changed, 1688 insertions(+) create mode 100644 .ccls create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 .reuse/templates/default.jinja2 create mode 100644 README.md create mode 100755 build.sh create mode 100644 cog.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 github.yml create mode 100644 package.nix create mode 100755 scripts/download.sh create mode 100644 src/config.h create mode 100644 src/keymap.c create mode 100644 src/rules.mk create mode 100644 treefmt.nix create mode 100755 update.sh create mode 100644 zsa_moonlander_layout-v25_source/config.h create mode 100644 zsa_moonlander_layout-v25_source/keymap.c create mode 100644 zsa_moonlander_layout-v25_source/rules.mk create mode 100755 zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.bin create mode 100644 zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.md5 diff --git a/.ccls b/.ccls new file mode 100644 index 0000000..90584dd --- /dev/null +++ b/.ccls @@ -0,0 +1 @@ +gcc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..aadb9e3 --- /dev/null +++ b/.envrc @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +use flake || use nix +watch_file flake.nix + +PATH_add ./scripts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03091e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# build +/target +/result + +# dev env +.direnv +.ccls-cache diff --git a/.reuse/templates/default.jinja2 b/.reuse/templates/default.jinja2 new file mode 100644 index 0000000..adc7772 --- /dev/null +++ b/.reuse/templates/default.jinja2 @@ -0,0 +1,28 @@ +{# +Moonlander Layout + +Copyright (C) 2024 Benedikt Peetz +SPDX-License-Identifier: AGPL-3.0-or-later + +This file is part of Moonlander Layout. + +You should have received a copy of the License along with this program. +If not, see . +#} + +Moonlander Layout + +{% for copyright_line in copyright_lines %} +{{ copyright_line }} +{% endfor %} +{% for contributor_line in contributor_lines %} +SPDX-FileContributor: {{ contributor_line }} +{% endfor %} +{% for expression in spdx_expressions %} +SPDX-License-Identifier: {{ expression }} +{% endfor %} + +This file is part of Moonlander Layout. + +You should have received a copy of the License along with this program. +If not, see . diff --git a/README.md b/README.md new file mode 100644 index 0000000..7de5216 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ + + +# Building your layout from source + +Congratulations on taking the next step, and making use of your keyboard's open-source nature! There's so much power to unlock — this is going to be fun. :) + +Here are some initial pointers to get you started: + +- Use the documentation at [https://docs.qmk.fm/](https://docs.qmk.fm/) to set up your environment for building your firmware. +- Build your layout against [https://github.com/zsa/qmk_firmware/](https://github.com/zsa/qmk_firmware/) which is our QMK fork (instead of qmk/qmk_firmware). This is what Oryx (the graphical configurator) uses, so it's guaranteed to work. +- Create a folder with a simple name (no spaces!) for your layout inside the qmk_firmware/keyboards/moonlander/keymaps/ folder. +- Copy the contents of the \*\_source folder (in the .zip you downloaded from Oryx) into this folder. +- Make sure you've set up your environment per the [QMK docs](https://docs.qmk.fm/#/newbs_getting_started?id=set-up-your-environment) so compilation would actually work. +- From your shell, make sure your working directory is qmk*firmware, then enter the command `make moonlander:_layout_`, substituting the name of the folder you created for "_layout_". + +Good luck on your journey! And remember, if you get stuck, you can always get back to your [original layout](https://configure.zsa.io/moonlander/layouts/KWBYA/PzA9E/0) from Oryx. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..51ecb7a --- /dev/null +++ b/build.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env sh + +set -e + +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +LAYOUT_ID="KWBYA" +LAYOUT_GEOMETRY="moonlander" + +# # Download layout source +# data="$(mktemp)" +# echo +# cat <"$data" +# { "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}} +# EOF +# +# response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')" +# +# hash_id="$(echo "${response}" | jq -r '.[0]')" +# firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')") +# change_description=$(echo "${response}" | jq -r '.[2]') +# if [ -z "${change_description}" ]; then +# change_description="latest layout modification made with Oryx" +# fi +# +# curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip +# +# # Unzip the source file +# unzip -oj source.zip '*_source/*' -d "$LAYOUT_ID" +# rm source.zip +# +# # Commit and Push changes +# git config --local user.name "github-actions" +# git config --local user.email "github-actions@github.com" +# git add . +# git commit -m "✨(oryx): $change_description" || echo "No layout change" +# git push +# +# # Merge Oryx with custom QMK +# git fetch origin main +# git checkout -B main origin/main +# git merge -Xignore-all-space oryx +# git push +# +# # Checkout the right firmware branch +# cd qmk_firmware +# git submodule update --init --remote +# git fetch origin "firmware$firmware_version" +# git checkout -B "firmware$firmware_version" "origin/firmware$firmware_version" +# git submodule update --init --recursive +# +# # Build qmk docker image +# docker build -t qmk . + +# # Build the layout +# ## Set keyboard directory and make prefix based on firmware version +# if [ "$firmware_version" -ge 24 ]; then +# keyboard_directory="qmk_firmware/keyboards/zsa" +# make_prefix="zsa/" +# else +# keyboard_directory="qmk_firmware/keyboards" +# make_prefix="" +# fi +# +# ## Copy layout files to the qmk folder +# rm -rf ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps/$LAYOUT_ID +# mkdir -p ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps && cp -r $LAYOUT_ID ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps + +## Build the layout +docker run -v ./qmk_firmware:/root --rm qmk /bin/sh -c " + qmk setup zsa/qmk_firmware -b 'firmware$firmware_version' -y + make ${make_prefix}$LAYOUT_GEOMETRY:$LAYOUT_ID +" + +## Find and export built layout +normalized_layout_geometry="$(echo "$LAYOUT_GEOMETRY" | sed 's/\//_/g')" +built_layout_file="$(find ./qmk_firmware -maxdepth 1 -type f -regex ".*${normalized_layout_geometry}.*\.\(bin\|hex\)$")" diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..eaf2fdb --- /dev/null +++ b/cog.toml @@ -0,0 +1,34 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +tag_prefix = "v" +branch_whitelist = ["main", "prime"] +ignore_merge_commits = false + +pre_bump_hooks = [ + "reuse lint", # Check licensing status. + "nix flake check", # Verify the project builds. + "flake_version_update --version v{{version}} --input-file flake.nix", # Bump the version in the flake.nix file + "nix fmt", # Format. +] +post_bump_hooks = [ + "git push", + "git push origin v{{version}}", # push the new tag to origin +] + +[bump_profiles] + +[changelog] +path = "NEWS.md" +template = "remote" +remote = "git.vhack.eu" +repository = "moonlander_layout" +owner = "bpeetz" +authors = [{ signature = "Benedikt Peetz", username = "bpeetz" }] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..cfa3943 --- /dev/null +++ b/flake.lock @@ -0,0 +1,85 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733376361, + "narHash": "sha256-aLJxoTDDSqB+/3orsulE6/qdlX6MzDLIITLZqdgMpqo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "929116e316068c7318c54eb4d827f7d9756d5e9c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", + "owner": "nix-systems", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "x86_64-linux", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733662930, + "narHash": "sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno+f7Ii/xftqZ8=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "357cda84af1d74626afb7fb3bc12d6957167cda9", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..725ac24 --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . +{ + description = ""; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + + systems = { + url = "github:nix-systems/x86_64-linux"; # only evaluate for this system + }; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs = { + systems.follows = "systems"; + }; + }; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + treefmt-nix, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; + + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; + + package = pkgs.callPackage ./package.nix {}; + in { + packages.default = package; + checks = { + formatting = treefmtEval.config.build.check self; + }; + formatter = treefmtEval.config.build.wrapper; + + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + reuse + wally-cli + ]; + env = { + GCC_COLORS = "error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"; + }; + }; + }); +} +# vim: ts=2 + diff --git a/github.yml b/github.yml new file mode 100644 index 0000000..2d38f93 --- /dev/null +++ b/github.yml @@ -0,0 +1,109 @@ +name: Fetch and build layout + +on: + workflow_dispatch: + inputs: + layout_id: + description: "Layout id available in URL https://configure.zsa.io/voyager/layouts/[ID_IS_HERE]/latest" + required: true + default: "g7jjw" + layout_geometry: + description: "voyager | moonlander | ergodox_ez | ergodox_ez/stm32/glow | ergodox_ez/stm32/shine | ergodox_ez/m32u4/glow | ergodox_ez/m32u4/shine | planck_ez | planck_ez/glow" + required: true + default: "voyager" + +permissions: + contents: write + +jobs: + fetch-and-build-layout: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: oryx + + - name: Download the full history for the merge to work correctly + run: git pull --unshallow + + - name: Download layout source + id: download-layout-source + run: | + response=$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data '{"query":"query getLayout($hashId: String!, $revisionId: String!, $geometry: String) {layout(hashId: $hashId, geometry: $geometry, revisionId: $revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"${{ github.event.inputs.layout_id }}","geometry":"${{ github.event.inputs.layout_geometry }}","revisionId":"latest"}}' | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]') + hash_id=$(echo "${response}" | jq -r '.[0]') + firmware_version=$(printf "%.0f" $(echo "${response}" | jq -r '.[1]')) + change_description=$(echo "${response}" | jq -r '.[2]') + if [[ -z "${change_description}" ]]; then + change_description="latest layout modification made with Oryx" + fi + + curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip + + echo firmware_version=${firmware_version} >> "$GITHUB_OUTPUT" + echo change_description=${change_description} >> "$GITHUB_OUTPUT" + + - name: Unzip the source file + run: | + unzip -oj source.zip '*_source/*' -d ${{ github.event.inputs.layout_id }} + rm source.zip + + - name: Commit and Push changes + run: | + git config --local user.name "github-actions" + git config --local user.email "github-actions@github.com" + git add . + git commit -m "✨(oryx): ${{ steps.download-layout-source.outputs.change_description }}" || echo "No layout change" + git push + + - name: Merge Oryx with custom QMK + run: | + git fetch origin main + git checkout -B main origin/main + git merge -Xignore-all-space oryx + git push + + - name: Checkout the right firmware branch + run: | + cd qmk_firmware + git submodule update --init --remote + git fetch origin firmware${{ steps.download-layout-source.outputs.firmware_version }} + git checkout -B firmware${{ steps.download-layout-source.outputs.firmware_version }} origin/firmware${{ steps.download-layout-source.outputs.firmware_version }} + git submodule update --init --recursive + + - name: Build qmk docker image + run: docker build -t qmk . + + - name: Build the layout + id: build-layout + run: | + # Set keyboard directory and make prefix based on firmware version + if [ "${{ steps.download-layout-source.outputs.firmware_version }}" -ge 24 ]; then + keyboard_directory="qmk_firmware/keyboards/zsa" + make_prefix="zsa/" + else + keyboard_directory="qmk_firmware/keyboards" + make_prefix="" + fi + + # Copy layout files to the qmk folder + rm -rf ${keyboard_directory}/${{ github.event.inputs.layout_geometry }}/keymaps/${{ github.event.inputs.layout_id }} + mkdir -p ${keyboard_directory}/${{ github.event.inputs.layout_geometry }}/keymaps && cp -r ${{ github.event.inputs.layout_id }} "$_" + + # Build the layout + docker run -v ./qmk_firmware:/root --rm qmk /bin/sh -c " + qmk setup zsa/qmk_firmware -b firmware${{ steps.download-layout-source.outputs.firmware_version }} -y + make ${make_prefix}${{ github.event.inputs.layout_geometry }}:${{ github.event.inputs.layout_id }} + " + + # Find and export built layout + normalized_layout_geometry="$(echo "${{ github.event.inputs.layout_geometry }}" | sed 's/\//_/g')" + echo built_layout_file=$(find ./qmk_firmware -maxdepth 1 -type f -regex ".*${normalized_layout_geometry}.*\.\(bin\|hex\)$") >> "$GITHUB_OUTPUT" + echo normalized_layout_geometry=${normalized_layout_geometry} >> "$GITHUB_OUTPUT" + + - name: Upload layout + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build-layout.outputs.normalized_layout_geometry }}_${{ github.event.inputs.layout_id }} + path: ${{ steps.build-layout.outputs.built_layout_file }} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..807a57c --- /dev/null +++ b/package.nix @@ -0,0 +1,67 @@ +{ + stdenv, + fetchgit, + # deps + qmk, + gnumake, +}: let + layout_id = "KWBYA"; + layout_geometry = "moonlander"; + FIRMWARE_VERSION = "24"; +in + stdenv.mkDerivation + { + pname = "moonlander-layout"; + version = "25"; + + src = fetchgit { + url = "https://github.com/zsa/qmk_firmware"; + rev = "4ae6ea9679fbd4277caa1036d326ddfce278b4d2"; # 2024-12-09T17:43:04 CET + hash = "sha256-c+fojw64dHIYoO20cO9Nd1pnQwBDPPbrh6Erf9QTyGw="; + + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + gnumake + qmk + ]; + + buildPhase = + /* + bash + */ + '' + runHook preBuild + + ## Set keyboard directory and make prefix based on firmware version + if [ "${FIRMWARE_VERSION}" -ge 24 ]; then + keyboard_directory="keyboards/zsa" + keyboard_folder="zsa/${layout_geometry}" + else + keyboard_directory="keyboards" + keyboard_folder="${layout_geometry}" + fi + + ## Copy layout files to the qmk folder + key_dir="$keyboard_directory/${layout_geometry}/keymaps/${layout_id}" + [ -d "$key_dir" ] && rm --recursive "$key_dir" + + mkdir --parents "$(dirname "$key_dir")" + cp --recursive "${./src}" "$key_dir" + + ## Build the layout + # qmk setup "zsa/qmk_firmware" -b 'firmware${FIRMWARE_VERSION}' -y + make "$keyboard_folder:${layout_id}" + + runHook postBuild + ''; + installPhase = '' + runHook preInstall + + mkdir --parents "$out/binary_output" + cp "./.build/zsa_moonlander_${layout_id}.bin" "$out/binary_output/" + + runHook postInstall + ''; + } diff --git a/scripts/download.sh b/scripts/download.sh new file mode 100755 index 0000000..097dbde --- /dev/null +++ b/scripts/download.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env sh + +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +LAYOUT_ID="KWBYA" +LAYOUT_GEOMETRY="moonlander" + +data="$(mktemp)" +echo +cat << EOF > "$data" +{ "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}} +EOF + +response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')" + +hash_id="$(echo "${response}" | jq -r '.[0]')" +firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')") +change_description=$(echo "${response}" | jq -r '.[2]') +if [ -z "${change_description}" ]; then + change_description="latest layout modification made with Oryx" +fi + +curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip + +echo "firmware_version=${firmware_version}" +echo "change_description=${change_description}" diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..335b683 --- /dev/null +++ b/src/config.h @@ -0,0 +1,25 @@ +/* + * Moonlander Layout + * + * Copyright (C) 2024 Benedikt Peetz + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Moonlander Layout. + * + * You should have received a copy of the License along with this program. + * If not, see . + */ + +/* + Set any config.h overrides for your specific keymap here. + See config.h options at https://docs.qmk.fm/#/config_options?id=the-configh-file +*/ + +#undef DEBOUNCE +#define DEBOUNCE 8 + +#define USB_SUSPEND_WAKEUP_DELAY 0 +#define LAYER_STATE_16BIT + +#define RGB_MATRIX_STARTUP_SPD 60 + diff --git a/src/keymap.c b/src/keymap.c new file mode 100644 index 0000000..6840eb6 --- /dev/null +++ b/src/keymap.c @@ -0,0 +1,476 @@ +/* + * Moonlander Layout + * + * Copyright (C) 2024 Benedikt Peetz + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Moonlander Layout. + * + * You should have received a copy of the License along with this program. + * If not, see . + */ + +#include QMK_KEYBOARD_H +#include "version.h" +#define MOON_LED_LEVEL LED_LEVEL +#define ML_SAFE_RANGE SAFE_RANGE + +enum custom_keycodes { + RGB_SLD = ML_SAFE_RANGE, + ST_MACRO_0, + ST_MACRO_1, + ST_MACRO_2, + ST_MACRO_3, + ST_MACRO_4, + ST_MACRO_5, + ST_MACRO_6, + ST_MACRO_7, +}; + + + +enum tap_dance_codes { + DANCE_0, + DANCE_1, + DANCE_2, + DANCE_3, + DANCE_4, +}; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, QK_BOOT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + TG(5), KC_QUOTE, KC_COMMA, LT(9,KC_DOT), KC_P, KC_Y, KC_TRANSPARENT, KC_TRANSPARENT, KC_F, KC_G, LT(9,KC_C), KC_R, KC_L, TG(5), + MO(7), KC_A, KC_O, KC_E, KC_U, KC_I, MO(8), MO(8), KC_D, KC_H, KC_T, KC_N, KC_S, MO(7), + KC_LEFT_SHIFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RIGHT_SHIFT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_LEFT, KC_RIGHT, LALT(LGUI(LCTL(LSFT(KC_T)))), LALT(LGUI(LCTL(LSFT(KC_K)))),KC_UP, KC_DOWN, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + MO(3), MO(4), MO(6), KC_TRANSPARENT, MO(1), MO(2) + ), + [1] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_R)))),LALT(LGUI(LCTL(LSFT(KC_P)))),LALT(LGUI(LCTL(LSFT(KC_Q)))),LALT(LGUI(LCTL(LSFT(KC_S)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_L)))),LALT(LGUI(LCTL(LSFT(KC_M)))),LALT(LGUI(LCTL(LSFT(KC_N)))),LALT(LGUI(LCTL(LSFT(KC_O)))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_I)))),LALT(LGUI(LCTL(LSFT(KC_H)))),LALT(LGUI(LCTL(LSFT(KC_G)))),KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_A)))),KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_W)))),LALT(LGUI(LCTL(LSFT(KC_V)))),LALT(LGUI(LCTL(LSFT(KC_U)))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_B)))),LALT(LGUI(LCTL(LSFT(KC_D)))),LALT(LGUI(LCTL(LSFT(KC_F)))),LALT(LGUI(LCTL(LSFT(KC_E)))),LALT(LGUI(LCTL(LSFT(KC_C)))),KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_J)))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [2] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, OSM(MOD_RSFT), OSM(MOD_RGUI), OSM(MOD_RCTL), OSM(MOD_RALT), KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, OSM(MOD_LSFT), OSM(MOD_LGUI), OSM(MOD_LCTL), OSM(MOD_LALT), KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TAB, KC_SPACE, KC_BSPC, KC_ENTER, KC_ESCAPE, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [3] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_GRAVE, KC_EXLM, KC_DLR, KC_PERC, CW_TOGG, KC_TRANSPARENT, KC_TRANSPARENT, KC_AT, KC_HASH, KC_AMPR, KC_ASTR, KC_QUES, KC_TRANSPARENT, + KC_TRANSPARENT, KC_LABK, KC_LBRC, KC_LPRN, KC_LCBR, TD(DANCE_0), KC_TRANSPARENT, KC_TRANSPARENT, KC_TILD, TD(DANCE_1), TD(DANCE_2), TD(DANCE_3), KC_PLUS, KC_TRANSPARENT, + KC_TRANSPARENT, KC_RABK, KC_RBRC, KC_RPRN, KC_RCBR, KC_TRANSPARENT, KC_CIRC, KC_BSLS, KC_COMMA, TD(DANCE_4), KC_PIPE, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [4] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_1, KC_2, KC_3, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRANSPARENT, KC_TRANSPARENT, KC_0, KC_4, KC_5, KC_6, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_TRANSPARENT, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [5] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN2, KC_MS_BTN3, KC_MS_BTN1, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_MS_WH_UP, KC_MS_WH_UP, KC_MS_WH_DOWN, KC_MS_WH_LEFT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, KC_TRANSPARENT, + KC_TRANSPARENT, LCTL(LSFT(KC_TAB)),LALT(LCTL(KC_R)),LCTL(KC_T), LCTL(KC_TAB), KC_TRANSPARENT, KC_TRANSPARENT, KC_WWW_BACK, KC_TRANSPARENT, KC_WWW_HOME, KC_WWW_FORWARD, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [6] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_3))),LALT(LCTL(LSFT(KC_2))),LALT(LCTL(LSFT(KC_1))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_1)))),LALT(LGUI(LCTL(LSFT(KC_2)))),LALT(LGUI(LCTL(LSFT(KC_3)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_6))),LALT(LCTL(LSFT(KC_5))),LALT(LCTL(LSFT(KC_4))),LALT(LCTL(LSFT(KC_0))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_0)))),LALT(LGUI(LCTL(LSFT(KC_4)))),LALT(LGUI(LCTL(LSFT(KC_5)))),LALT(LGUI(LCTL(LSFT(KC_6)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_9))),LALT(LCTL(LSFT(KC_8))),LALT(LCTL(LSFT(KC_7))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_7)))),LALT(LGUI(LCTL(LSFT(KC_8)))),LALT(LGUI(LCTL(LSFT(KC_9)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [7] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, ST_MACRO_0, ST_MACRO_1, KC_TRANSPARENT, ST_MACRO_2, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, ST_MACRO_3, KC_TRANSPARENT, ST_MACRO_4, ST_MACRO_5, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [8] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, ST_MACRO_6, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, ST_MACRO_7, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [9] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_DQUO, KC_TRANSPARENT, KC_TRANSPARENT, KC_DQUO, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), +}; + +extern rgb_config_t rgb_matrix_config; + +void keyboard_post_init_user(void) { + rgb_matrix_enable(); +} + + +const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = { + [0] = { {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [1] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {131,255,255}, {0,245,245}, {0,0,0} }, + + [2] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [3] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [4] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {131,255,255}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [5] = { {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,245,245} }, + + [6] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [7] = { {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + + [8] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + + [9] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + +}; + +void set_layer_color(int layer) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { + HSV hsv = { + .h = pgm_read_byte(&ledmap[layer][i][0]), + .s = pgm_read_byte(&ledmap[layer][i][1]), + .v = pgm_read_byte(&ledmap[layer][i][2]), + }; + if (!hsv.h && !hsv.s && !hsv.v) { + rgb_matrix_set_color( i, 0, 0, 0 ); + } else { + RGB rgb = hsv_to_rgb( hsv ); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + } + } +} + +bool rgb_matrix_indicators_user(void) { + if (keyboard_config.disable_layer_led) { return false; } + switch (biton32(layer_state)) { + case 0: + set_layer_color(0); + break; + case 1: + set_layer_color(1); + break; + case 2: + set_layer_color(2); + break; + case 3: + set_layer_color(3); + break; + case 4: + set_layer_color(4); + break; + case 5: + set_layer_color(5); + break; + case 6: + set_layer_color(6); + break; + case 7: + set_layer_color(7); + break; + case 8: + set_layer_color(8); + break; + case 9: + set_layer_color(9); + break; + default: + if (rgb_matrix_get_flags() == LED_FLAG_NONE) + rgb_matrix_set_color_all(0, 0, 0); + break; + } + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ST_MACRO_0: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_A)); + } + break; + case ST_MACRO_1: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_O)); + } + break; + case ST_MACRO_2: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_U)); + } + break; + case ST_MACRO_3: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_U))); + } + break; + case ST_MACRO_4: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_O))); + } + break; + case ST_MACRO_5: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_A))); + } + break; + case ST_MACRO_6: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_TAP(X_O) SS_DELAY(100) SS_TAP(X_A)); + } + break; + case ST_MACRO_7: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_TAP(X_O) SS_DELAY(100) SS_LSFT(SS_TAP(X_A))); + } + break; + + case RGB_SLD: + if (record->event.pressed) { + rgblight_mode(1); + } + return false; + } + return true; +} + + +typedef struct { + bool is_press_action; + uint8_t step; +} tap; + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD, + DOUBLE_TAP, + DOUBLE_HOLD, + DOUBLE_SINGLE_TAP, + MORE_TAPS +}; + +static tap dance_state[5]; + +uint8_t dance_step(tap_dance_state_t *state); + +uint8_t dance_step(tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + return MORE_TAPS; +} + + +void on_dance_0(tap_dance_state_t *state, void *user_data); +void dance_0_finished(tap_dance_state_t *state, void *user_data); +void dance_0_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_0(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + } + if(state->count > 3) { + tap_code16(KC_SCLN); + } +} + +void dance_0_finished(tap_dance_state_t *state, void *user_data) { + dance_state[0].step = dance_step(state); + switch (dance_state[0].step) { + case SINGLE_TAP: register_code16(KC_SCLN); break; + case SINGLE_HOLD: register_code16(KC_COLN); break; + case DOUBLE_TAP: register_code16(KC_SCLN); register_code16(KC_SCLN); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_SCLN); register_code16(KC_SCLN); + } +} + +void dance_0_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[0].step) { + case SINGLE_TAP: unregister_code16(KC_SCLN); break; + case SINGLE_HOLD: unregister_code16(KC_COLN); break; + case DOUBLE_TAP: unregister_code16(KC_SCLN); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_SCLN); break; + } + dance_state[0].step = 0; +} +void on_dance_1(tap_dance_state_t *state, void *user_data); +void dance_1_finished(tap_dance_state_t *state, void *user_data); +void dance_1_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_1(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + } + if(state->count > 3) { + tap_code16(KC_SLASH); + } +} + +void dance_1_finished(tap_dance_state_t *state, void *user_data) { + dance_state[1].step = dance_step(state); + switch (dance_state[1].step) { + case SINGLE_TAP: register_code16(KC_SLASH); break; + case SINGLE_HOLD: register_code16(KC_BSLS); break; + case DOUBLE_TAP: register_code16(KC_SLASH); register_code16(KC_SLASH); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_SLASH); register_code16(KC_SLASH); + } +} + +void dance_1_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[1].step) { + case SINGLE_TAP: unregister_code16(KC_SLASH); break; + case SINGLE_HOLD: unregister_code16(KC_BSLS); break; + case DOUBLE_TAP: unregister_code16(KC_SLASH); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_SLASH); break; + } + dance_state[1].step = 0; +} +void on_dance_2(tap_dance_state_t *state, void *user_data); +void dance_2_finished(tap_dance_state_t *state, void *user_data); +void dance_2_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_2(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + } + if(state->count > 3) { + tap_code16(KC_MINUS); + } +} + +void dance_2_finished(tap_dance_state_t *state, void *user_data) { + dance_state[2].step = dance_step(state); + switch (dance_state[2].step) { + case SINGLE_TAP: register_code16(KC_MINUS); break; + case SINGLE_HOLD: register_code16(KC_UNDS); break; + case DOUBLE_TAP: register_code16(KC_MINUS); register_code16(KC_MINUS); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_MINUS); register_code16(KC_MINUS); + } +} + +void dance_2_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[2].step) { + case SINGLE_TAP: unregister_code16(KC_MINUS); break; + case SINGLE_HOLD: unregister_code16(KC_UNDS); break; + case DOUBLE_TAP: unregister_code16(KC_MINUS); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_MINUS); break; + } + dance_state[2].step = 0; +} +void on_dance_3(tap_dance_state_t *state, void *user_data); +void dance_3_finished(tap_dance_state_t *state, void *user_data); +void dance_3_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_3(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + } + if(state->count > 3) { + tap_code16(KC_QUOTE); + } +} + +void dance_3_finished(tap_dance_state_t *state, void *user_data) { + dance_state[3].step = dance_step(state); + switch (dance_state[3].step) { + case SINGLE_TAP: register_code16(KC_QUOTE); break; + case SINGLE_HOLD: register_code16(KC_DQUO); break; + case DOUBLE_TAP: register_code16(KC_QUOTE); register_code16(KC_QUOTE); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_QUOTE); register_code16(KC_QUOTE); + } +} + +void dance_3_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[3].step) { + case SINGLE_TAP: unregister_code16(KC_QUOTE); break; + case SINGLE_HOLD: unregister_code16(KC_DQUO); break; + case DOUBLE_TAP: unregister_code16(KC_QUOTE); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_QUOTE); break; + } + dance_state[3].step = 0; +} +void on_dance_4(tap_dance_state_t *state, void *user_data); +void dance_4_finished(tap_dance_state_t *state, void *user_data); +void dance_4_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_4(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + } + if(state->count > 3) { + tap_code16(KC_EQUAL); + } +} + +void dance_4_finished(tap_dance_state_t *state, void *user_data) { + dance_state[4].step = dance_step(state); + switch (dance_state[4].step) { + case SINGLE_TAP: register_code16(KC_EQUAL); break; + case SINGLE_HOLD: register_code16(KC_PLUS); break; + case DOUBLE_TAP: register_code16(KC_EQUAL); register_code16(KC_EQUAL); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_EQUAL); register_code16(KC_EQUAL); + } +} + +void dance_4_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[4].step) { + case SINGLE_TAP: unregister_code16(KC_EQUAL); break; + case SINGLE_HOLD: unregister_code16(KC_PLUS); break; + case DOUBLE_TAP: unregister_code16(KC_EQUAL); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_EQUAL); break; + } + dance_state[4].step = 0; +} + +tap_dance_action_t tap_dance_actions[] = { + [DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset), + [DANCE_1] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_1, dance_1_finished, dance_1_reset), + [DANCE_2] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_2, dance_2_finished, dance_2_reset), + [DANCE_3] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_3, dance_3_finished, dance_3_reset), + [DANCE_4] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_4, dance_4_finished, dance_4_reset), +}; diff --git a/src/rules.mk b/src/rules.mk new file mode 100644 index 0000000..e372341 --- /dev/null +++ b/src/rules.mk @@ -0,0 +1,17 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# Set any rules.mk overrides for your specific keymap here. +# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file +CONSOLE_ENABLE = no +COMMAND_ENABLE = no +TAP_DANCE_ENABLE = yes +SPACE_CADET_ENABLE = no +CAPS_WORD_ENABLE = yes diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 0000000..42dd06a --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,80 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +{ + treefmt-nix, + pkgs, +}: +treefmt-nix.lib.evalModule pkgs ( + {pkgs, ...}: { + # Used to find the project root + projectRootFile = "flake.nix"; + + programs = { + alejandra.enable = true; + rustfmt.enable = true; + clang-format.enable = true; + mdformat.enable = true; + shfmt = { + enable = true; + indent_size = 4; + }; + shellcheck.enable = true; + prettier = { + enable = true; + settings = { + arrowParens = "always"; + bracketSameLine = false; + bracketSpacing = true; + editorconfig = true; + embeddedLanguageFormatting = "auto"; + endOfLine = "lf"; + # experimentalTernaries = false; + htmlWhitespaceSensitivity = "css"; + insertPragma = false; + jsxSingleQuote = true; + printWidth = 80; + proseWrap = "always"; + quoteProps = "consistent"; + requirePragma = false; + semi = true; + singleAttributePerLine = true; + singleQuote = false; + trailingComma = "all"; + useTabs = false; + vueIndentScriptAndStyle = false; + + tabWidth = 2; + }; + }; + stylua.enable = true; + ruff = { + enable = true; + format = true; + }; + taplo.enable = true; + }; + + settings = { + global.excludes = [ + "CHANGELOG.md" + "NEWS.md" + ]; + formatter = { + clang-format = { + options = ["--style" "GNU"]; + }; + shfmt = { + includes = ["*.bash"]; + }; + }; + }; + } +) diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..773676a --- /dev/null +++ b/update.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +nix flake update diff --git a/zsa_moonlander_layout-v25_source/config.h b/zsa_moonlander_layout-v25_source/config.h new file mode 100644 index 0000000..335b683 --- /dev/null +++ b/zsa_moonlander_layout-v25_source/config.h @@ -0,0 +1,25 @@ +/* + * Moonlander Layout + * + * Copyright (C) 2024 Benedikt Peetz + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Moonlander Layout. + * + * You should have received a copy of the License along with this program. + * If not, see . + */ + +/* + Set any config.h overrides for your specific keymap here. + See config.h options at https://docs.qmk.fm/#/config_options?id=the-configh-file +*/ + +#undef DEBOUNCE +#define DEBOUNCE 8 + +#define USB_SUSPEND_WAKEUP_DELAY 0 +#define LAYER_STATE_16BIT + +#define RGB_MATRIX_STARTUP_SPD 60 + diff --git a/zsa_moonlander_layout-v25_source/keymap.c b/zsa_moonlander_layout-v25_source/keymap.c new file mode 100644 index 0000000..6840eb6 --- /dev/null +++ b/zsa_moonlander_layout-v25_source/keymap.c @@ -0,0 +1,476 @@ +/* + * Moonlander Layout + * + * Copyright (C) 2024 Benedikt Peetz + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Moonlander Layout. + * + * You should have received a copy of the License along with this program. + * If not, see . + */ + +#include QMK_KEYBOARD_H +#include "version.h" +#define MOON_LED_LEVEL LED_LEVEL +#define ML_SAFE_RANGE SAFE_RANGE + +enum custom_keycodes { + RGB_SLD = ML_SAFE_RANGE, + ST_MACRO_0, + ST_MACRO_1, + ST_MACRO_2, + ST_MACRO_3, + ST_MACRO_4, + ST_MACRO_5, + ST_MACRO_6, + ST_MACRO_7, +}; + + + +enum tap_dance_codes { + DANCE_0, + DANCE_1, + DANCE_2, + DANCE_3, + DANCE_4, +}; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, QK_BOOT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + TG(5), KC_QUOTE, KC_COMMA, LT(9,KC_DOT), KC_P, KC_Y, KC_TRANSPARENT, KC_TRANSPARENT, KC_F, KC_G, LT(9,KC_C), KC_R, KC_L, TG(5), + MO(7), KC_A, KC_O, KC_E, KC_U, KC_I, MO(8), MO(8), KC_D, KC_H, KC_T, KC_N, KC_S, MO(7), + KC_LEFT_SHIFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RIGHT_SHIFT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_LEFT, KC_RIGHT, LALT(LGUI(LCTL(LSFT(KC_T)))), LALT(LGUI(LCTL(LSFT(KC_K)))),KC_UP, KC_DOWN, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + MO(3), MO(4), MO(6), KC_TRANSPARENT, MO(1), MO(2) + ), + [1] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_R)))),LALT(LGUI(LCTL(LSFT(KC_P)))),LALT(LGUI(LCTL(LSFT(KC_Q)))),LALT(LGUI(LCTL(LSFT(KC_S)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_L)))),LALT(LGUI(LCTL(LSFT(KC_M)))),LALT(LGUI(LCTL(LSFT(KC_N)))),LALT(LGUI(LCTL(LSFT(KC_O)))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_I)))),LALT(LGUI(LCTL(LSFT(KC_H)))),LALT(LGUI(LCTL(LSFT(KC_G)))),KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_A)))),KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_W)))),LALT(LGUI(LCTL(LSFT(KC_V)))),LALT(LGUI(LCTL(LSFT(KC_U)))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_B)))),LALT(LGUI(LCTL(LSFT(KC_D)))),LALT(LGUI(LCTL(LSFT(KC_F)))),LALT(LGUI(LCTL(LSFT(KC_E)))),LALT(LGUI(LCTL(LSFT(KC_C)))),KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_J)))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [2] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, OSM(MOD_RSFT), OSM(MOD_RGUI), OSM(MOD_RCTL), OSM(MOD_RALT), KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, OSM(MOD_LSFT), OSM(MOD_LGUI), OSM(MOD_LCTL), OSM(MOD_LALT), KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TAB, KC_SPACE, KC_BSPC, KC_ENTER, KC_ESCAPE, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [3] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_GRAVE, KC_EXLM, KC_DLR, KC_PERC, CW_TOGG, KC_TRANSPARENT, KC_TRANSPARENT, KC_AT, KC_HASH, KC_AMPR, KC_ASTR, KC_QUES, KC_TRANSPARENT, + KC_TRANSPARENT, KC_LABK, KC_LBRC, KC_LPRN, KC_LCBR, TD(DANCE_0), KC_TRANSPARENT, KC_TRANSPARENT, KC_TILD, TD(DANCE_1), TD(DANCE_2), TD(DANCE_3), KC_PLUS, KC_TRANSPARENT, + KC_TRANSPARENT, KC_RABK, KC_RBRC, KC_RPRN, KC_RCBR, KC_TRANSPARENT, KC_CIRC, KC_BSLS, KC_COMMA, TD(DANCE_4), KC_PIPE, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [4] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_1, KC_2, KC_3, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRANSPARENT, KC_TRANSPARENT, KC_0, KC_4, KC_5, KC_6, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_TRANSPARENT, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [5] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN2, KC_MS_BTN3, KC_MS_BTN1, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_MS_WH_UP, KC_MS_WH_UP, KC_MS_WH_DOWN, KC_MS_WH_LEFT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, KC_TRANSPARENT, + KC_TRANSPARENT, LCTL(LSFT(KC_TAB)),LALT(LCTL(KC_R)),LCTL(KC_T), LCTL(KC_TAB), KC_TRANSPARENT, KC_TRANSPARENT, KC_WWW_BACK, KC_TRANSPARENT, KC_WWW_HOME, KC_WWW_FORWARD, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [6] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_3))),LALT(LCTL(LSFT(KC_2))),LALT(LCTL(LSFT(KC_1))),KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_1)))),LALT(LGUI(LCTL(LSFT(KC_2)))),LALT(LGUI(LCTL(LSFT(KC_3)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_6))),LALT(LCTL(LSFT(KC_5))),LALT(LCTL(LSFT(KC_4))),LALT(LCTL(LSFT(KC_0))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_0)))),LALT(LGUI(LCTL(LSFT(KC_4)))),LALT(LGUI(LCTL(LSFT(KC_5)))),LALT(LGUI(LCTL(LSFT(KC_6)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, LALT(LCTL(LSFT(KC_9))),LALT(LCTL(LSFT(KC_8))),LALT(LCTL(LSFT(KC_7))),KC_TRANSPARENT, KC_TRANSPARENT, LALT(LGUI(LCTL(LSFT(KC_7)))),LALT(LGUI(LCTL(LSFT(KC_8)))),LALT(LGUI(LCTL(LSFT(KC_9)))),KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [7] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, ST_MACRO_0, ST_MACRO_1, KC_TRANSPARENT, ST_MACRO_2, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, ST_MACRO_3, KC_TRANSPARENT, ST_MACRO_4, ST_MACRO_5, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [8] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, ST_MACRO_6, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, ST_MACRO_7, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), + [9] = LAYOUT_moonlander( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_DQUO, KC_TRANSPARENT, KC_TRANSPARENT, KC_DQUO, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), +}; + +extern rgb_config_t rgb_matrix_config; + +void keyboard_post_init_user(void) { + rgb_matrix_enable(); +} + + +const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = { + [0] = { {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [1] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {131,255,255}, {0,245,245}, {0,0,0} }, + + [2] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [3] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,245,245}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [4] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {131,255,255}, {0,245,245}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [5] = { {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,245,245} }, + + [6] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, + + [7] = { {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + + [8] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + + [9] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, + +}; + +void set_layer_color(int layer) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { + HSV hsv = { + .h = pgm_read_byte(&ledmap[layer][i][0]), + .s = pgm_read_byte(&ledmap[layer][i][1]), + .v = pgm_read_byte(&ledmap[layer][i][2]), + }; + if (!hsv.h && !hsv.s && !hsv.v) { + rgb_matrix_set_color( i, 0, 0, 0 ); + } else { + RGB rgb = hsv_to_rgb( hsv ); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + } + } +} + +bool rgb_matrix_indicators_user(void) { + if (keyboard_config.disable_layer_led) { return false; } + switch (biton32(layer_state)) { + case 0: + set_layer_color(0); + break; + case 1: + set_layer_color(1); + break; + case 2: + set_layer_color(2); + break; + case 3: + set_layer_color(3); + break; + case 4: + set_layer_color(4); + break; + case 5: + set_layer_color(5); + break; + case 6: + set_layer_color(6); + break; + case 7: + set_layer_color(7); + break; + case 8: + set_layer_color(8); + break; + case 9: + set_layer_color(9); + break; + default: + if (rgb_matrix_get_flags() == LED_FLAG_NONE) + rgb_matrix_set_color_all(0, 0, 0); + break; + } + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ST_MACRO_0: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_A)); + } + break; + case ST_MACRO_1: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_O)); + } + break; + case ST_MACRO_2: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_TAP(X_U)); + } + break; + case ST_MACRO_3: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_U))); + } + break; + case ST_MACRO_4: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_O))); + } + break; + case ST_MACRO_5: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_LSFT(SS_TAP(X_QUOTE)) SS_DELAY(100) SS_LSFT(SS_TAP(X_A))); + } + break; + case ST_MACRO_6: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_TAP(X_O) SS_DELAY(100) SS_TAP(X_A)); + } + break; + case ST_MACRO_7: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_CAPS) SS_DELAY(100) SS_TAP(X_O) SS_DELAY(100) SS_LSFT(SS_TAP(X_A))); + } + break; + + case RGB_SLD: + if (record->event.pressed) { + rgblight_mode(1); + } + return false; + } + return true; +} + + +typedef struct { + bool is_press_action; + uint8_t step; +} tap; + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD, + DOUBLE_TAP, + DOUBLE_HOLD, + DOUBLE_SINGLE_TAP, + MORE_TAPS +}; + +static tap dance_state[5]; + +uint8_t dance_step(tap_dance_state_t *state); + +uint8_t dance_step(tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + return MORE_TAPS; +} + + +void on_dance_0(tap_dance_state_t *state, void *user_data); +void dance_0_finished(tap_dance_state_t *state, void *user_data); +void dance_0_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_0(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + } + if(state->count > 3) { + tap_code16(KC_SCLN); + } +} + +void dance_0_finished(tap_dance_state_t *state, void *user_data) { + dance_state[0].step = dance_step(state); + switch (dance_state[0].step) { + case SINGLE_TAP: register_code16(KC_SCLN); break; + case SINGLE_HOLD: register_code16(KC_COLN); break; + case DOUBLE_TAP: register_code16(KC_SCLN); register_code16(KC_SCLN); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_SCLN); register_code16(KC_SCLN); + } +} + +void dance_0_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[0].step) { + case SINGLE_TAP: unregister_code16(KC_SCLN); break; + case SINGLE_HOLD: unregister_code16(KC_COLN); break; + case DOUBLE_TAP: unregister_code16(KC_SCLN); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_SCLN); break; + } + dance_state[0].step = 0; +} +void on_dance_1(tap_dance_state_t *state, void *user_data); +void dance_1_finished(tap_dance_state_t *state, void *user_data); +void dance_1_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_1(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + } + if(state->count > 3) { + tap_code16(KC_SLASH); + } +} + +void dance_1_finished(tap_dance_state_t *state, void *user_data) { + dance_state[1].step = dance_step(state); + switch (dance_state[1].step) { + case SINGLE_TAP: register_code16(KC_SLASH); break; + case SINGLE_HOLD: register_code16(KC_BSLS); break; + case DOUBLE_TAP: register_code16(KC_SLASH); register_code16(KC_SLASH); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_SLASH); register_code16(KC_SLASH); + } +} + +void dance_1_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[1].step) { + case SINGLE_TAP: unregister_code16(KC_SLASH); break; + case SINGLE_HOLD: unregister_code16(KC_BSLS); break; + case DOUBLE_TAP: unregister_code16(KC_SLASH); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_SLASH); break; + } + dance_state[1].step = 0; +} +void on_dance_2(tap_dance_state_t *state, void *user_data); +void dance_2_finished(tap_dance_state_t *state, void *user_data); +void dance_2_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_2(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + } + if(state->count > 3) { + tap_code16(KC_MINUS); + } +} + +void dance_2_finished(tap_dance_state_t *state, void *user_data) { + dance_state[2].step = dance_step(state); + switch (dance_state[2].step) { + case SINGLE_TAP: register_code16(KC_MINUS); break; + case SINGLE_HOLD: register_code16(KC_UNDS); break; + case DOUBLE_TAP: register_code16(KC_MINUS); register_code16(KC_MINUS); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_MINUS); register_code16(KC_MINUS); + } +} + +void dance_2_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[2].step) { + case SINGLE_TAP: unregister_code16(KC_MINUS); break; + case SINGLE_HOLD: unregister_code16(KC_UNDS); break; + case DOUBLE_TAP: unregister_code16(KC_MINUS); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_MINUS); break; + } + dance_state[2].step = 0; +} +void on_dance_3(tap_dance_state_t *state, void *user_data); +void dance_3_finished(tap_dance_state_t *state, void *user_data); +void dance_3_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_3(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + } + if(state->count > 3) { + tap_code16(KC_QUOTE); + } +} + +void dance_3_finished(tap_dance_state_t *state, void *user_data) { + dance_state[3].step = dance_step(state); + switch (dance_state[3].step) { + case SINGLE_TAP: register_code16(KC_QUOTE); break; + case SINGLE_HOLD: register_code16(KC_DQUO); break; + case DOUBLE_TAP: register_code16(KC_QUOTE); register_code16(KC_QUOTE); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_QUOTE); register_code16(KC_QUOTE); + } +} + +void dance_3_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[3].step) { + case SINGLE_TAP: unregister_code16(KC_QUOTE); break; + case SINGLE_HOLD: unregister_code16(KC_DQUO); break; + case DOUBLE_TAP: unregister_code16(KC_QUOTE); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_QUOTE); break; + } + dance_state[3].step = 0; +} +void on_dance_4(tap_dance_state_t *state, void *user_data); +void dance_4_finished(tap_dance_state_t *state, void *user_data); +void dance_4_reset(tap_dance_state_t *state, void *user_data); + +void on_dance_4(tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + } + if(state->count > 3) { + tap_code16(KC_EQUAL); + } +} + +void dance_4_finished(tap_dance_state_t *state, void *user_data) { + dance_state[4].step = dance_step(state); + switch (dance_state[4].step) { + case SINGLE_TAP: register_code16(KC_EQUAL); break; + case SINGLE_HOLD: register_code16(KC_PLUS); break; + case DOUBLE_TAP: register_code16(KC_EQUAL); register_code16(KC_EQUAL); break; + case DOUBLE_SINGLE_TAP: tap_code16(KC_EQUAL); register_code16(KC_EQUAL); + } +} + +void dance_4_reset(tap_dance_state_t *state, void *user_data) { + wait_ms(10); + switch (dance_state[4].step) { + case SINGLE_TAP: unregister_code16(KC_EQUAL); break; + case SINGLE_HOLD: unregister_code16(KC_PLUS); break; + case DOUBLE_TAP: unregister_code16(KC_EQUAL); break; + case DOUBLE_SINGLE_TAP: unregister_code16(KC_EQUAL); break; + } + dance_state[4].step = 0; +} + +tap_dance_action_t tap_dance_actions[] = { + [DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset), + [DANCE_1] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_1, dance_1_finished, dance_1_reset), + [DANCE_2] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_2, dance_2_finished, dance_2_reset), + [DANCE_3] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_3, dance_3_finished, dance_3_reset), + [DANCE_4] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_4, dance_4_finished, dance_4_reset), +}; diff --git a/zsa_moonlander_layout-v25_source/rules.mk b/zsa_moonlander_layout-v25_source/rules.mk new file mode 100644 index 0000000..e372341 --- /dev/null +++ b/zsa_moonlander_layout-v25_source/rules.mk @@ -0,0 +1,17 @@ +# Moonlander Layout +# +# Copyright (C) 2024 Benedikt Peetz +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Moonlander Layout. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# Set any rules.mk overrides for your specific keymap here. +# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file +CONSOLE_ENABLE = no +COMMAND_ENABLE = no +TAP_DANCE_ENABLE = yes +SPACE_CADET_ENABLE = no +CAPS_WORD_ENABLE = yes diff --git a/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.bin b/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.bin new file mode 100755 index 0000000..6312a22 Binary files /dev/null and b/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.bin differ diff --git a/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.md5 b/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.md5 new file mode 100644 index 0000000..2d172eb --- /dev/null +++ b/zsa_moonlander_layout-v25_source/zsa_moonlander_layout-v25_KWBYA_PzA9E.md5 @@ -0,0 +1 @@ +be1a18540d6d80f77979a396d6c3fa58 -- cgit 1.4.1