Coder Social home page Coder Social logo

gittyeric / ergodox-macro-hax Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phoscur/oryx-macro-hax

29.0 4.0 0.0 74 KB

A hack to get around the 4-button max Macro limit in Oryx for Ergodox / Moonlander keyboards.

TypeScript 100.00%
moonlander ergodox ergodox-ez ergodox-firmware

ergodox-macro-hax's Introduction

Ergodox Macro Hax

This is a quick and dirty script to nicely get around the annoying (though reasonable) limitation of Ergodox / Moonlander keyboards in the Oryx configurator where macros can only be 4 key sequences for security reasons.

This hack is a post-processor that'll take your raw "Source" Oryx configuration and extend your macros to be any arbitrary sequence.

(Migration Notice!)

Sadly gittyeric no longer has a Moonlander / Ergodox, but Phoscur has kindly agree to take stewardship in his fork! When migration of this fork is complete this section will be updated with git migration commands to switch your fork's base.

Complete configuration flow

0. Initial setup

To compile the firmware, setup the ZSA QMK Fork with guide referenced

qmk setup zsa/qmk_firmware -b firmware20

Install on the command line (with Node.js installed) using:

cd ~/qmk_firmware
git clone <your fork of this repo>
cd ergodox-macro-hax
npm install

1. Configuring with Oryx

Configure in Oryx just as you normally would, except make sure each macro you'd like to extend beyond 4 button presses is a unique set of alphanumeric button presses that act as a unique ID to find in post-processing. Let's say you want a keyboard to type "whale", you could just write a macro with keys "whal" or get really detailed with numeric IDs and type "1234". Remember these IDs for later. DO NOT use any key modifiers, custom delays or non-alphanumeric keys in your extendable macros, you can specify those yourself later.

When done, take a note of the layout hash ID in the URL or download the source manually into the keymap_src folder.

It is also recommended to git branch <your layout name> and gitignore allowlist !layout_src/<your layout name>.

2. Create a mapping in this script

cd ~/qmk_firmware/ergodox-macro-hax

npm run get -- <oryxLayoutHashId>

Grab my-illicit-macros.ts and change it to what you need, starting with the absolute directory path SOURCE_DIR pointed to the unzipped directory that contains the "keymap.c" file (NOT usually in the root directory!) you noted in step 1. Now open my-illicit-macros.ts and modify to match your configuration.

Here's an example of creating an extended (more than 4 button) macro:

const macro = newMacro()
    .typeAlphanumeric("function") // Supports a-z and 0-9
    .sendRawCmd("SS_DELAY(100)") // Raw commands in the C file
    .tapKey("X_SPACE") // Tap a raw key code
    .delay(50) // Delay for 50 ms

Now just map the original 4 character macro to your newer, longer macro. See what's already in my-illicit-macros.ts for fuller examples.

3. Run the post-processor

Run npm run hax to modify your config and extend your macros. Run npm run copy to copy the processed keymap to the parent keymaps folder (keymaps/neo).

4. Build Modified Source and Flash it!

Use the normal QMK/ZSA Wally software to compile and flash.

qmk compile -kb moonlander -km neo

If you want Github to build the firmware for you, create repository action secrets LAYOUT_ID, set it to the hashId of your layout keymap, as well as LAYOUT_FOLDER with the name of the folder of your keymap in the source archive. (Extract it from your ORYX link: https://configure.zsa.io/moonlander/layouts/<hashId>/latest/0) then you can use Github Actions to build the firmware for you.

Note: Figuring out key codes

I'm too lazy to list them for you, when I need a keycode such as "X_SPACE", I just put it in a macro and find it in the keymap.c file, then reference that name from then on out.

ergodox-macro-hax's People

Contributors

daynosaurusrex avatar gittyeric avatar phoscur avatar storcium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ergodox-macro-hax's Issues

Build in Github Pipeline

Hi!
I am just setting up my QMK build env - still new to my Moonlander - but I am already wondering if we could use Github to download from ORXY and build firmware on demand in a reusable way (and maybe skipping a local QMK install)...

What do you think of the idea of making it easy to create and publish macros by forking/configuring your TypeScript helper?

Ideas & feedback concerning Macro reconfigurability by forking the repo

As of #1, we are now able to build and release firmware binaries, but it might not be straight forward/well documented enough. (Readme could use some redaction and simplification after we finish this draft)

Because I added my-macros.ts with my configuration, only that one is currently being used, so to take advantage that file needs to be modified by someone forking (in addition to the Github Secrets LAYOUT_ID & LAYOUT_FOLDER to be filled for the forked repo pipeline).

My idea yesterday suggests to move my-macros.ts categorically into macros/<username>.ts, I think I can get the username of the repo owner in the pipeline, else this may become a third configuration by secret e.g. MACRO_FILE.

Copy layers from multiple layouts: Layer Boilerplates

I can't decide which Oryx Layout to use as a base, because I want layers from multiple sources!

Then, I have something for you, now!
Generated an API Client SDK and created a little CLI prompter to copy layers from other layouts:
https://github.com/Phoscur/oryx-layer-inserter

Best regards,
Phoscur
(shameless self-advertisement)

Feel free to brainstorm what we can achieve by merging the repos, or maybe making use out of the API Client SDK through npm dependency!

  • Layer Boilerplates: e.g. Bone/Neo(Qwertz) Layers 1-6 + Variants + Extras
  • Macro Groups/Prototypes with Key Selection (+automatic modification/maintenance)
  • Applied Guide: Like the new Oryx Tour feature, but with the option to copy keys one by one to your own layout

Add instructions to switch git upstream and forward collaborators to Phoscur's fork

Split from #7 see infos in comment why this needs to be approached slowly

Keep collaborator motivation while slowly migrating

push the idea again of your fork becoming the canonical one and I can update the README here to link to yours whenever you're ready for it

What's the default process for this? Does every fork need to adopt the new upstream then, or can it be forwarded somehow? I guess you are adding git add remote upstream and git branch --set-upstream-to instructions to the README?

@gittyeric I think we can/should already start adding infos about this upcoming migration, but please give it lots of time until we close here!

Application Quick Launches

The lauch application macros are commented out, why?

Maybe it would be better to use Win+R instead of going through the search?

Addition of macros in the dance actions

Made a fork and allowed the SINGLE_TAP, SINGLE_HOLD, DOUBLE_TAP and DOUBLE_HOLD steps in the dance function be replaced with macros without having to have a fully manual keymap. You can modify via onyx and use this to get the latest and patch.

Also moved to use .env file and environment variables to remove hard coding.

Leaving a message here in case anyone wants to use this.

Compile error: all warnings being treated as errors

Hi, I have some issue when I try to compile the new template using QMK.

Looks like there are some warning that are treates as error at compilation time.

error.txt

Someone else are facing the same issue? Is this project still working?

Am I in the right path or am I missing something related to the "Build Modified Source and Flash it!" section?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.