diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..ce145e299c --- /dev/null +++ b/.clang-format @@ -0,0 +1,30 @@ +--- +BasedOnStyle: Google +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignOperands: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AllowShortCaseLabelsOnASingleLine: 'false' +AllowShortFunctionsOnASingleLine: Empty +AllowShortLoopsOnASingleLine: 'false' +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'false' +BinPackArguments: 'true' +BinPackParameters: 'true' +ColumnLimit: '1000' +IndentCaseLabels: 'true' +IndentPPDirectives: AfterHash +IndentWidth: '4' +MaxEmptyLinesToKeep: '1' +PointerAlignment: Right +SortIncludes: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: 'false' +SpacesBeforeTrailingComments: 1 +TabWidth: '4' +UseTab: Never + +... diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..7aaee1fda1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "QMK CLI", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "ghcr.io/qmk/qmk_cli", + "customizations": { + "vscode": { + "extensions": [ + "amodio.toggle-excluded-files", + "EditorConfig.EditorConfig", + "xaver.clang-format", + "llvm-vs-code-extensions.vscode-clangd", + "bierner.github-markdown-preview", + "donjayamanne.git-extension-pack", + "ms-vscode-remote.remote-containers" + ] + } + }, + "postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/setup.sh ${containerWorkspaceFolder}" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000000..9155c6ccad --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -eEuo pipefail + +wget https://bootstrap.pypa.io/get-pip.py +python3 get-pip.py +python3 -m pip install qmk +rm get-pip.py + +python3 -m pip install --upgrade milc + +userspacePath="$1" + +git config --global --add safe.directory "$userspacePath" +git submodule update --init --recursive + +[ -d /workspaces/qmk_firmware ] || git clone https://github.com/qmk/qmk_firmware.git /workspaces/qmk_firmware +git config --global --add safe.directory /workspaces/qmk_firmware + +qmk config user.qmk_home=/workspaces/qmk_firmware +qmk config user.overlay_dir="$userspacePath" + +qmk git-submodule diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..e06a225638 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,32 @@ +# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false +indent_size = 4 + +[{qmk,*.py}] +charset = utf-8 +max_line_length = 200 + +# Make these match what we have in .gitattributes +[*.mk] +end_of_line = lf +indent_style = tab + +[Makefile] +end_of_line = lf +indent_style = tab + +[*.sh] +end_of_line = lf diff --git a/.github/workflows/build_binaries.yaml b/.github/workflows/build_binaries.yaml new file mode 100755 index 0000000000..f7908fadb8 --- /dev/null +++ b/.github/workflows/build_binaries.yaml @@ -0,0 +1,20 @@ +name: Build QMK firmware + +on: [push, workflow_dispatch] + +permissions: + contents: write + +jobs: + build: + name: 'QMK Userspace Build' + uses: qmk/.github/.github/workflows/qmk_userspace_build.yml@main + with: + qmk_repo: qmk/qmk_firmware + qmk_ref: master + + publish: + name: 'QMK Userspace Publish' + uses: qmk/.github/.github/workflows/qmk_userspace_publish.yml@main + if: always() && !cancelled() + needs: build diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..3984e9bedd --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +// Suggested extensions +{ + "recommendations": [ + "amodio.toggle-excluded-files", + "EditorConfig.EditorConfig", + "xaver.clang-format", + "llvm-vs-code-extensions.vscode-clangd", + "bierner.github-markdown-preview", + "donjayamanne.git-extension-pack", + "ms-vscode-remote.remote-containers" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000000..2520899774 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# QMK Userspace + +This is a template repository which allows for an external set of QMK keymaps to be defined and compiled. This is useful for users who want to maintain their own keymaps without having to fork the main QMK repository. + +## Howto configure your build targets + +1. Run the normal `qmk setup` procedure if you haven't already done so -- see [QMK Docs](https://docs.qmk.fm/#/newbs) for details. +1. Fork this repository +1. Clone your fork to your local machine +1. Enable userspace in QMK config using `qmk config user.overlay_dir="$(realpath qmk_userspace)"` +1. Add a new keymap for your board using `qmk new-keymap` + * This will create a new keymap in the `keyboards` directory, in the same location that would normally be used in the main QMK repository. For example, if you wanted to add a keymap for the Planck, it will be created in `keyboards/planck/keymaps/` + * You can also create a new keymap using `qmk new-keymap -kb -km ` + * Alternatively, add your keymap manually by placing it in the location specified above. + * `layouts///keymap.*` is also supported if you prefer the layout system +1. Add your keymap(s) to the build by running `qmk userspace-add -kb -km ` + * This will automatically update your `qmk.json` file + * Corresponding `qmk userspace-remove -kb -km ` will delete it + * Listing the build targets can be done with `qmk userspace-list` +1. Commit your changes + +## Howto build with GitHub + +1. In the GitHub Actions tab, enable workflows +1. Push your changes above to your forked GitHub repository +1. Look at the GitHub Actions for a new actions run +1. Wait for the actions run to complete +1. Inspect the Releases tab on your repository for the latest firmware build + +## Howto build locally + +1. Run the normal `qmk setup` procedure if you haven't already done so -- see [QMK Docs](https://docs.qmk.fm/#/newbs) for details. +1. Fork this repository +1. Clone your fork to your local machine +1. `cd` into this repository's clone directory +1. Set global userspace path: `qmk config user.overlay_dir="$(realpath .)"` -- you MUST be located in the cloned userspace location for this to work correctly + * This will be automatically detected if you've `cd`ed into your userspace repository, but the above makes your userspace available regardless of your shell location. +1. Compile normally: `qmk compile -kb your_keyboard -km your_keymap` or `make your_keyboard:your_keymap` + +Alternatively, if you configured your build targets above, you can use `qmk userspace-compile` to build all of your userspace targets at once. + +## Extra info + +If you wish to point GitHub actions to a different repository, a different branch, or even a different keymap name, you can modify `.github/workflows/build_binaries.yml` to suit your needs. + +To override the `build` job, you can change the following parameters to use a different QMK repository or branch: +``` + with: + qmk_repo: qmk/qmk_firmware + qmk_ref: master +``` + +If you wish to manually manage `qmk_firmware` using git within the userspace repository, you can add `qmk_firmware` as a submodule in the userspace directory instead. GitHub Actions will automatically use the submodule at the pinned revision if it exists, otherwise it will use the default latest revision of `qmk_firmware` from the main repository. + +This can also be used to control which fork is used, though only upstream `qmk_firmware` will have support for external userspace until other manufacturers update their forks. + +1. (First time only) `git submodule add https://github.com/qmk/qmk_firmware.git` +1. (To update) `git submodule update --init --recursive` +1. Commit your changes to your userspace repository diff --git a/keyboards/.keep b/keyboards/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/keymap.c deleted file mode 100644 index e622ce99f6..0000000000 --- a/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/keymap.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keychron_common.h" - -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN, -}; -// clang-format off -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_SLEP, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [WIN_FN] = LAYOUT_ansi_82( - _______, _______, _______, KC_TASK, KC_FILE, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, _______, _______, _______, QK_BOOT, - _______, BT_HST1, BT_HST2, BT_HST3, P2P4G, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, - _______, _______, _______, _______, _______, BAT_LVL, NK_TOGG, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) -}; - -// clang-format on -#if defined(ENCODER_MAP_ENABLE) -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { - [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, -}; -#endif // ENCODER_MAP_ENABLE - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (!process_record_keychron_common(keycode, record)) { - return false; - } - return true; -} diff --git a/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/rules.mk b/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/rules.mk deleted file mode 100644 index f845616741..0000000000 --- a/keyboards/keychron/v1_max/ansi_encoder/keymaps/default/rules.mk +++ /dev/null @@ -1 +0,0 @@ -BACKLIGHT_ENABLE = no \ No newline at end of file diff --git a/layouts/.keep b/layouts/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/qmk.json b/qmk.json index 6b75a408cc..3afc389f42 100644 --- a/qmk.json +++ b/qmk.json @@ -1,4 +1,4 @@ { "userspace_version": "1.0", - "build_targets": [["keychron/v1_max/ansi_encoder", "default"]] -} + "build_targets": [] +} \ No newline at end of file diff --git a/users/.keep b/users/.keep new file mode 100644 index 0000000000..e69de29bb2