Compare commits

..

3 Commits

Author SHA1 Message Date
Nick Brassel c8dcd9291b Point workflows at qmk/.githubs main branch (#1) 2023-11-28 16:44:02 +11:00
Nick Brassel 5212d63b29 Updated .gitignore. 2023-11-22 21:12:34 +11:00
Nick Brassel 92d62d05e8 Initial structure. 2023-11-22 15:22:43 +11:00
13 changed files with 79 additions and 339 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
BinPackArguments: 'true'
BinPackParameters: 'true'
ColumnLimit: '100'
ColumnLimit: '1000'
IndentCaseLabels: 'true'
IndentPPDirectives: AfterHash
IndentWidth: '4'
-1
View File
@@ -1 +0,0 @@
use flake
+20
View File
@@ -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
-3
View File
@@ -4,11 +4,8 @@
*~
.DS_Store
._*
.cache/
# Firmware files
*.hex
*.bin
*.uf2
/.direnv/
compile_commands.json
-3
View File
@@ -1,3 +0,0 @@
[submodule "qmk_firmware"]
path = qmk_firmware
url = git@github.com:qmk/qmk_firmware
-2
View File
@@ -1,2 +0,0 @@
qmk_firmware/
+58
View File
@@ -0,0 +1,58 @@
# 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. 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/<your keymap name>`
* You can also create a new keymap using `qmk new-keymap -kb <your_keyboard> -km <your_keymap>`
* Alternatively, add your keymap manually by placing it in the location specified above.
* `layouts/<layout name>/<your keymap name>/keymap.*` is also supported if you prefer the layout system
1. Add your keymap(s) to the build by running `qmk userspace-add -kb <your_keyboard> -km <your_keymap>`
* This will automatically update your `qmk.json` file
* Corresponding `qmk userspace-remove -kb <your_keyboard> -km <your_keymap>` will delete it
* Listing the build targets can be done with 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
Generated
-41
View File
@@ -1,41 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1767366107,
"narHash": "sha256-xW+NPcKsmSj8Gg4qBKhmV5/fHU57E8SwoZjqGVvu2yo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b49a5346c419b4aaa421f96529c05fa70469acc3",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}
-32
View File
@@ -1,32 +0,0 @@
{
inputs.nixpkgs.url = "github:nixos/nixpkgs";
outputs = {
self,
nixpkgs,
systems,
}: let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (sys:
f {
inherit sys;
pkgs = nixpkgs.legacyPackages.${sys};
});
in {
devShells = eachSystem ({
sys,
pkgs,
}: {
default = pkgs.mkShell {
packages = with pkgs; [
qmk
clang
clang-tools
dos2unix
];
shellHook = ''
export QMK_HOME=$PWD/qmk_firmware
'';
};
});
};
}
@@ -1,17 +0,0 @@
/* Copyright 2022 Thomas Baart <thomas@splitkb.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 <http://www.gnu.org/licenses/>.
*/
#pragma once
@@ -1,236 +0,0 @@
/* Copyright 2019 Thomas Baart <thomas@splitkb.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 <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#undef OS_LSFT
#undef OS_LCTL
#undef OS_LALT
#undef OS_LGUI
// clang-format off
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {6, 4}},
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}, {6, 5}},
{{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}, {6, 6}},
{{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}, {6, 7}},
{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}},
{{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1}},
{{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {6, 2}},
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {6, 3}},
};
// clang-format on
enum keycodes {
OS_LSFT = SAFE_RANGE,
OS_LCTL,
OS_LALT,
OS_LGUI,
};
enum layers {
_TYPE = 0,
_GAME,
_SYM,
_NUM,
_NAV,
_FUN,
};
// Aliases for readability
#define SYM MO(_SYM)
#define NUM MO(_NUM)
#define NAV MO(_NAV)
#define FUN MO(_FUN)
#define TYPE DF(_TYPE)
#define C_SPC C(KC_SPACE)
#define C_RET C(KC_ENTER)
/* TODO:
* - Mouse Keys?
*/
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_TYPE] = LAYOUT(
XXXXXXX, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_RCTL,
KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
XXXXXXX, KC_Z, KC_X, KC_C, KC_D, KC_V, SH_OS, NUM, FUN, SH_OS, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
XXXXXXX, XXXXXXX, OS_LSFT, KC_ENT, SYM, NAV, KC_SPC, KC_ESC, KC_RGUI, KC_RALT
),
[_NAV] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_DEL, XXXXXXX,
XXXXXXX, OS_LGUI, OS_LALT, OS_LCTL, OS_LSFT, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, C_SPC, C_RET, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_SYM] = LAYOUT(
KC_GRV, KC_PIPE, XXXXXXX, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_TILD, OS_LGUI, OS_LALT, OS_LCTL, OS_LSFT, KC_LPRN, KC_RPRN, KC_COLN, XXXXXXX, XXXXXXX, KC_SCLN, KC_EQL,
XXXXXXX, KC_BSLS, XXXXXXX, XXXXXXX, KC_MINS, KC_LBRC, _______, _______, _______, _______, KC_RBRC, KC_UNDS, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_FUN] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLU,
XXXXXXX, OS_LGUI, OS_LALT, OS_LCTL, OS_LSFT, XXXXXXX, XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLD,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_MUTE,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_NUM] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_PLUS, XXXXXXX,
XXXXXXX, OS_LGUI, OS_LALT, OS_LCTL, OS_LSFT, XXXXXXX, KC_0, KC_4, KC_5, KC_6, KC_DOT, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, KC_7, KC_8, KC_9, KC_SLSH, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
// [_LAYERINDEX] = LAYOUT(
// XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
// ),
};
// clang-format on
void keyboard_pre_init_user(void) {
gpio_set_pin_output(24);
gpio_write_pin_high(24);
}
typedef enum {
os_up_unqueued = 0,
os_up_queued,
os_down_unused,
os_down_used,
os_locked
} oneshot_mode_t;
typedef struct {
uint16_t time;
uint16_t mod;
uint16_t trigger;
oneshot_mode_t mode;
} oneshot_state_t;
oneshot_state_t oneshot_state[4] = {{0, KC_LSFT, OS_LSFT, os_up_unqueued},
{0, KC_LCTL, OS_LCTL, os_up_unqueued},
{0, KC_LALT, OS_LALT, os_up_unqueued},
{0, KC_LGUI, OS_LGUI, os_up_unqueued}};
bool is_oneshot_ignored_key(uint16_t keycode) {
switch (keycode) {
case OS_LSFT:
case OS_LCTL:
case OS_LALT:
case OS_LGUI:
case NAV:
case SYM:
case NUM:
case FUN:
return true;
default:
return false;
}
}
bool is_oneshot_cancel_key(uint16_t keycode, oneshot_mode_t mode) {
return keycode == KC_NO || (keycode == KC_ESCAPE && mode == os_locked);
}
// Based on
// https://github.com/qmk/qmk_firmware/blob/user-keymaps-still-present/users/callum/oneshot.c
void update_oneshot(oneshot_state_t *state, uint16_t keycode, keyrecord_t *record) {
if (keycode == state->trigger) {
if (record->event.pressed) {
// Trigger keydown
switch (state->mode) {
case os_up_queued:
state->mode = os_locked;
break;
case os_up_unqueued:
register_code(state->mod);
state->time = timer_read();
state->mode = os_down_unused;
break;
case os_locked:
state->mode = os_down_used;
break;
default:
state->mode = os_down_unused;
break;
}
} else {
// Trigger keyup
switch (state->mode) {
case os_down_unused:
// If we didn't use the mod while trigger was held, queue it.
if (timer_elapsed(state->time) < 1000) {
state->mode = os_up_queued;
} else {
state->mode = os_up_unqueued;
unregister_code(state->mod);
}
break;
case os_down_used:
// If we did use the mod while trigger was held, unregister it.
state->mode = os_up_unqueued;
unregister_code(state->mod);
break;
default:
break;
}
}
} else {
if (record->event.pressed) {
if (is_oneshot_cancel_key(keycode, state->mode) && state->mode != os_up_unqueued) {
// Cancel oneshot on designated cancel keydown.
state->mode = os_up_unqueued;
unregister_code(state->mod);
}
} else {
if (!is_oneshot_ignored_key(keycode)) {
// On non-ignored keyup, consider the oneshot used.
switch (state->mode) {
case os_down_unused:
state->mode = os_down_used;
break;
case os_up_queued:
state->mode = os_up_unqueued;
unregister_code(state->mod);
break;
default:
break;
}
}
}
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_oneshot(&oneshot_state[0], keycode, record);
update_oneshot(&oneshot_state[1], keycode, record);
update_oneshot(&oneshot_state[2], keycode, record);
update_oneshot(&oneshot_state[3], keycode, record);
if (oneshot_state[0].mode == os_locked && keycode == KC_SPACE) {
if (record->event.pressed) {
register_code(KC_MINUS);
} else {
unregister_code(KC_MINUS);
}
return false;
}
return true;
}
@@ -1,2 +0,0 @@
CONVERT_TO = liatris
SWAP_HANDS_ENABLE = yes
Submodule qmk_firmware deleted from 85886db43b