From fc54d62111204a01b75dc24a427c2f5aa2ea3c3c Mon Sep 17 00:00:00 2001
From: Cosmin Cojocar <cosmc@microsoft.com>
Date: Wed, 6 Dec 2017 12:11:43 +0100
Subject: [PATCH] Add a slightly modified ordinary layout for OSX

---
 .../community/ergodox/ordinary_osx/keymap.c   | 504 ++++++++++++++++++
 .../ergodox/ordinary_osx/ordinary-base.txt    |  27 +
 .../ergodox/ordinary_osx/ordinary-media.txt   |  27 +
 .../ergodox/ordinary_osx/ordinary-special.txt |  27 +
 .../ergodox/ordinary_osx/ordinary-symbol.txt  |  27 +
 .../community/ergodox/ordinary_osx/readme.md  |   3 +
 6 files changed, 615 insertions(+)
 create mode 100644 layouts/community/ergodox/ordinary_osx/keymap.c
 create mode 100644 layouts/community/ergodox/ordinary_osx/ordinary-base.txt
 create mode 100644 layouts/community/ergodox/ordinary_osx/ordinary-media.txt
 create mode 100644 layouts/community/ergodox/ordinary_osx/ordinary-special.txt
 create mode 100644 layouts/community/ergodox/ordinary_osx/ordinary-symbol.txt
 create mode 100644 layouts/community/ergodox/ordinary_osx/readme.md

diff --git a/layouts/community/ergodox/ordinary_osx/keymap.c b/layouts/community/ergodox/ordinary_osx/keymap.c
new file mode 100644
index 0000000000..17c1c837da
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/keymap.c
@@ -0,0 +1,504 @@
+#include QMK_KEYBOARD_H
+#include "led.h"
+#include "mousekey.h"
+#include "debug.h"
+#include "action_layer.h"
+#include "action_util.h"
+
+#define BASE   0 // default layer
+#define SYMB   1 // symbols layer
+#define MDIA   2 // media layer
+#define SPEC   3 // special layer
+#define RBASE  4 // reverse default layer
+
+#define LSymb 10 // left symbol-shift key
+#define LMdia 11 // left media-shift key
+#define LSpec 12 // left special-shift key
+#define RSymb 13 // right symbol-shift key
+#define RMdia 14 // right media-shift key
+#define RSpec 15 // right special-shift key
+
+#define NotEq 16 // != macro
+#define GrtEq 17 // >= macro
+#define LesEq 18 // <= macro
+#define DeRef 19 // -> macro
+
+#define MUL   20 // mouse up left
+#define MUR   21 // mouse up right
+#define MDL   22 // mouse down left
+#define MDR   23 // mouse down right
+
+
+
+/*
+ * The Ordinary Layout for the Ergodox EZ keyboard, v5
+ *
+ * Modifications from the default Ergodox EZ layout
+ * by Nicholas Keene ergodoxez@nicholaskeene.com
+ *
+ * No rights reserved. This software is in the public domain.
+ * Credit me if you are friendly but if you're a jerk don't bother.
+ * If you use or modify this layout I would love to hear from you.
+ *
+ * Details: readme.md
+ *          https://github.com/nrrkeene/qmk_firmware/tree/master/keyboards/ergodox/keymaps/ordinary
+ */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/******* Base Layer ****************************************************************************************************
+ *
+ * ,------------------------------------------------------.       ,------------------------------------------------------.
+ * | Special `~ |   1  |   2  |   3  |   4  |   5  | ESC  |       |  -   |   6  |   7  |   8  |   9  |   0  | =+ Special |
+ * |------------+------+------+------+------+-------------|       |------+------+------+------+------+------+------------|
+ * | Media  Tab |   Q  |   W  |   E  |   R  |   T  |Shift |       | Tab  |   Y  |   U  |   I  |   O  |   P  | \|   Media |
+ * |------------+------+------+------+------+------|-Tab  |       |      |------+------+------+------+------+------------|
+ * | Symbol     |  ^A  |   S  |   D  |  ^F  |   G  |------|       |------|   H  |  ^J  |   K  |   L  |  ^;  | '"  Symbol |
+ * |------------+------+------+------+------+------|  [   |       |  ]   |------+------+------+------+------+------------|
+ * | Capitals   |   Z  |   X  |   C  |   V  |   B  |      |       |      |   N  |   M  |   ,  |   .  |  /   |   Capitals |
+ * `------------+------+------+------+------+-------------'       `-------------+------+------+------+------+------------'
+ *      | Left | Right | LCtrl | LAlt | LGui|                                   | RGui | RAlt | RCtrl | Up |  Down  |
+ *      `-----------------------------------'                                   `-----------------------------------'
+ *                                          ,-------------.       ,-------------.
+ *                                          | Home | End  |       | Left | Right|
+ *                                   ,------|------|------|       |------+------+------.
+ *                                   |      |      | PgUp |       |  Up  |      |      |
+ *                                   |Backsp| Del  |------|       |------| Enter| Space|
+ *                                   |      |      | PgDn |       | Down |      |      |
+ *                                   `--------------------'       `--------------------'
+ */
+[BASE] = LAYOUT_ergodox(
+// left hand
+ F(LSpec)  ,KC_1           ,KC_2   ,KC_3   ,KC_4  ,KC_5  ,KC_ESC
+,F(LMdia)  ,KC_Q           ,KC_W   ,KC_E   ,KC_R  ,KC_T  ,LSFT(KC_TAB)
+,M(LSymb)  ,LT(RBASE, KC_A),KC_S   ,KC_D   ,LT(RBASE, KC_F)  ,KC_G
+,KC_LSFT   ,KC_Z           ,KC_X   ,KC_C   ,KC_V  ,KC_B  ,KC_LBRC
+,KC_LEFT   ,KC_RIGHT       ,KC_LCTL,KC_LALT,KC_LGUI
+                                         ,KC_HOME,KC_END
+                                                 ,KC_PGUP
+                                 ,KC_BSPC,KC_DEL ,KC_PGDN
+                                                                  // right hand
+                                                                 ,KC_MINS ,KC_6 ,KC_7           ,KC_8   ,KC_9   ,KC_0             ,F(RSpec)
+                                                                 ,KC_TAB  ,KC_Y ,KC_U           ,KC_I   ,KC_O   ,KC_P             ,F(RMdia)
+                                                                          ,KC_H ,LT(RBASE, KC_J),KC_K   ,KC_L   ,LT(RBASE,KC_SCLN),F(RSymb)
+                                                                 ,KC_RBRC ,KC_N ,KC_M           ,KC_COMM,KC_DOT ,KC_SLSH          ,KC_RSFT
+                                                                                ,KC_RGUI        ,KC_RALT,KC_RCTL,KC_UP            ,KC_DOWN
+                                                                 ,KC_LEFT ,KC_RGHT
+                                                                 ,KC_UP
+                                                                 ,KC_DOWN ,KC_ENT ,KC_SPC
+),
+
+/******* Symbols Layer *************************************************************************************************
+ *
+ * ,-----------------------------------------------------.       ,-----------------------------------------------------.
+ * |           |  F1  |  F2  |  F3  |  F4  |  F5  | Esc  |       |  -   |  F6  |  F7  |  F8  |  F9  |  F10 |           |
+ * |-----------+------+------+------+------+-------------|       |------+------+------+------+------+------+-----------|
+ * |           |   !  |   @  |   {  |   }  |   &  |  <   |       |  >   |   |  |   7  |   8  |   9  |   /  |           |
+ * |-----------+------+------+------+------+------|      |       |      |------+------+------+------+------+-----------|
+ * |           |   #  |   $  |   (  |   )  |   `  |------|       |------|   /  |   4  |   5  |   6  |   *  |           |
+ * |-----------+------+------+------+------+------|  '   |       |  "   |------+------+------+------+------+-----------|
+ * |           |   %  |   ^  |   [  |   ]  |   ~  |      |       |      |   \  |   1  |   2  |   3  |   -  |           |
+ * `-----------+------+------+------+------+-------------'       `-------------+------+------+------+------+-----------'
+ *     |   ;   |   &  |   *  |   <  |   >  |                                   |   0  |   .  |   =  |   +  | Enter |
+ *     `-----------------------------------'                                   `-----------------------------------'
+ *                                         ,-------------.       ,-------------.
+ *                                         | |||| | |||| |       | |||| | |||| |
+ *                                  ,------|------|------|       |------+------+------.
+ *                                  | Plus | Equal| |||| |       | |||| | Under| Dash |
+ *                                  |      |      |------|       |------| Score|      |
+ *                                  |  +   |   =  |  !=  |       |  ->  |  _   |  -   |
+ *                                  `--------------------'       `--------------------'
+ */
+[SYMB] = LAYOUT_ergodox(
+// left hand
+ KC_TRNS ,KC_F1       ,KC_F2        ,KC_F3   ,KC_F4   ,KC_F5   ,KC_ESC
+,KC_TRNS ,KC_EXLM     ,KC_AT        ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
+,KC_TRNS ,KC_HASH     ,KC_DLR       ,KC_LPRN ,KC_RPRN ,KC_GRV
+,KC_TRNS ,KC_PERC     ,KC_CIRC      ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT
+,KC_SCLN ,KC_AMPR     ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT)
+                                                      ,M(GrtEq),M(LesEq)
+                                                               ,KC_NO
+                                             ,KC_PLUS ,KC_EQL  ,M(NotEq)
+                                                                 // right hand
+                                                                 ,KC_MINS     ,KC_F6        ,KC_F7 ,KC_F8  ,KC_F9 ,KC_F10  ,KC_TRNS
+                                                                 ,LSFT(KC_DOT),KC_PIPE      ,KC_7  ,KC_8   ,KC_9  ,KC_SLSH ,KC_TRNS
+                                                                              ,KC_SLSH      ,KC_4  ,KC_5   ,KC_6  ,KC_ASTR ,KC_TRNS
+                                                                 ,LSFT(KC_QUOT),KC_BSLS     ,KC_1  ,KC_2   ,KC_3  ,KC_MINS ,KC_TRNS
+                                                                                            ,KC_0  ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
+                                                                 ,KC_NO       ,KC_NO
+                                                                 ,KC_NO
+                                                                 ,M(DeRef)    ,LSFT(KC_MINS),KC_MINS
+),
+
+/******* Media Layer *******************************************************************************************************
+ *
+ * ,---------------------------------------------------------------.    ,---------------------------------------------------------------.
+ * |      |   F11   |   F12   |   F13   |   F14   |   F15   | Esc  |    | |||| |   F16   |   F17   |   F18   |   F19   |   F20   |      |
+ * |------+---------+---------+---------+---------+----------------|    |------+---------+---------+---------+---------+---------+------|
+ * |      |Shut Down|MouseUpLf|Mouse Up |MouseUpRg|Volume Up|Scroll|    |Scroll|PrintScrn|   Home  |    Up   |   PgUp  |   Mail  |      |
+ * |------+---------+---------+---------+---------+---------|  Up  |    |  Up  |---------+---------+---------+---------+---------+------|
+ * |      |  Sleep  |MouseLeft|MouseDown|MouseRght|Volume Dn|------|    |------| Num Lock|   Left  |   Down  |   Right | MyComp  |      |
+ * |------+---------+---------+---------+---------+---------|Scroll|    |Scroll|---------+---------+---------+---------+---------+------|
+ * |      |  ||||   |MouseDnLf|MouseDown|MouseDnRg|  Mute   | Down |    | Down |  ||||   |   End   |   Down  |   PgDn  |  ||||   |      |
+ * `------+---------+---------+---------+---------+----------------'    `----------------+---------+---------+---------+---------+------'
+ *  | ||| |  ||||   |  MClick | LClick  |  R Click|                                      |  Insert |   Del   |   ||||  |  ||||   | ||| |
+ *  `---------------------------------------------'                                      `---------------------------------------------'
+ *                                                   ,-------------.    ,-------------.
+ *                                                   | Stop |Refrsh|    | Prev | Next |
+ *                                            ,------|------|------|    |------+------+------.
+ *                                            |Brwser|Brwser|Search|    |VolUp |      |      |
+ *                                            |Back  | Fwd  |------|    |------| Stop | Play-|
+ *                                            |      |      | Home |    |VolDn |      | Pause|
+ *                                            `--------------------'    `--------------------'
+ */
+[MDIA] = LAYOUT_ergodox(
+// left hand
+ KC_TRNS ,KC_F11   ,KC_F12  ,KC_F13   ,KC_F14  ,KC_F15  ,KC_ESC
+,KC_TRNS ,KC_POWER ,M(MUL)  ,KC_MS_U  ,M(MUR)  ,KC_VOLU ,KC_WH_U
+,KC_TRNS ,KC_SLEP  ,KC_MS_L ,KC_MS_D  ,KC_MS_R ,KC_VOLD
+,KC_TRNS ,KC_NO    ,M(MDL)  ,KC_MS_D  ,M(MDR)  ,KC_MUTE ,KC_WH_D
+,KC_NO ,KC_NO   ,KC_BTN3 ,KC_BTN1  ,KC_BTN2
+                                               ,KC_WSTP ,KC_WREF
+                                                        ,KC_WSCH
+                                      ,KC_WBAK ,KC_NO   ,KC_WHOM
+                                                                     // right hand
+                                                                     ,KC_NO    ,KC_F16  ,KC_F17       ,KC_F18       ,KC_F19  ,KC_F20  ,KC_TRNS
+                                                                     ,KC_WH_U  ,KC_PSCR ,KC_HOME      ,KC_UP        ,KC_PGUP ,KC_MAIL ,KC_TRNS
+                                                                               ,KC_NLCK ,KC_LEFT      ,KC_DOWN      ,KC_RIGHT,KC_MYCM ,KC_TRNS
+                                                                     ,KC_WH_D  ,KC_NO   ,KC_END       ,KC_DOWN      ,KC_PGDN ,KC_NO   ,KC_TRNS
+                                                                                        ,KC_INS       ,KC_DEL       ,KC_NO   ,KC_NO   ,KC_NO
+                                                                     ,KC_MPRV  ,KC_MNXT
+                                                                     ,KC_VOLU
+                                                                     ,KC_VOLD  ,KC_MSTP ,KC_MPLY
+),
+
+/******* Special Layer *****************************************************************************************************
+ *
+ * ,-------------------------------------------------------.    ,-------------------------------------------------------.
+ * |             |  Esc |      |      |      |      |      |    |      |      |      |      |   -  | Bspc |             |
+ * |-------------+------+------+------+------+-------------|    |------+------+------+------+------+------+-------------|
+ * | Media Lock  |      |      |      |      |      |      |    |      |      |      |      |  [   |   ]  | Media Lock  |
+ * |-------------+------+------+------+------+------|      |    |      |------+------+------+------+------+-------------|
+ * | Symbol Lock |      |      |      |      |      |------|    |------|      |      |      |      |      | Symbol Lock |
+ * |-------------+------+------+------+------+------|      |    |      |------+------+------+------+------+-------------|
+ * | Caps Lock   |      |      |      |      |      |      |    |      |      |      |      |      |      | Caps Lock   |
+ * `-------------+------+------+------+------+-------------'    `-------------+------+------+------+------+-------------'
+ *      |        |      |      |      |      |                                |      |      |      |      |        |
+ *      `------------------------------------'                                `------------------------------------'
+ *                                         ,-------------.     ,-------------.
+ *                                         |      |      |     |      |      |
+ *                                  ,------|------|------|     |------+------+------.
+ *                                  |      |      |      |     |      |      |      |
+ *                                  |      |      |------|     |------|      |      |
+ *                                  |      |      |      |     |      |      |      |
+ *                                  `--------------------'     `--------------------'
+ */
+[SPEC] = LAYOUT_ergodox(
+// left hand
+ KC_TRNS ,KC_ESC  ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_CAPS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+                                             ,KC_TRNS ,KC_TRNS
+                                                      ,KC_TRNS
+                                     ,KC_TRNS,KC_TRNS ,KC_TRNS
+                                                             // right hand
+                                                             ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_MINS ,KC_BSPC ,KC_TRNS
+                                                             ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_LBRC ,KC_RBRC ,KC_TRNS
+                                                                      ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+                                                             ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
+                                                                               ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+                                                             ,KC_TRNS ,KC_TRNS
+                                                             ,KC_TRNS
+                                                             ,KC_TRNS ,KC_TRNS ,KC_TRNS
+),
+
+/******* Reverse Base Layer *********************************************************************************************
+ *
+ * ,------------------------------------------------------.       ,------------------------------------------------------.
+ * |    =+      |   0  |   9  |   8  |   7  |   6  |  -   |       |  Esc |   5  |   4  |   3  |   2  |   1  |    `~      |
+ * |------------+------+------+------+------+-------------|       |------+------+------+------+------+------+------------|
+ * |    \|      |   P  |   O  |   I  |   U  |   Y  |   ]  |       |  [   |   T  |   R  |   E  |   W  |   Q  |    Tab     |
+ * |------------+------+------+------+------+------|      |       |      |------+------+------+------+------+------------|
+ * |    '"      |   ;  |   L  |   K  |   J  |   H  |------|       |------|   G  |   F  |   D  |   S  |  A   |            |
+ * |------------+------+------+------+------+------| Tab  |       |Shift |------+------+------+------+------+------------|
+ * | Capitals   |   /  |   .  |   ,  |   M  |   N  |      |       | -Tab |   B  |   V  |   C  |   X  |  Z   |   Capitals |
+ * `------------+------+------+------+------+-------------'       `-------------+------+------+------+------+------------'
+ *      | LCtrl | Meh  |Hyper | LAlt | LGui |                                   | RGui | RAlt | Hyper|  Meh | RCtrl |
+ *      `-----------------------------------'                                   `-----------------------------------'
+ *                                         ,-------------.       ,-------------.
+ *                                         | Left | Right|       | Home | End  |
+ *                                  ,------|------|------|       |------+------+------.
+ *                                  |      |      |  Up  |       | PgUp |      |      |
+ *                                  |Space |Enter |------|       |------|BackSp| Del  |
+ *                                  |      |      | Down |       | PgDn |      |      |
+ *                                  `--------------------'       `--------------------'
+ */
+[RBASE] = LAYOUT_ergodox(
+// left hand
+ KC_EQL    ,KC_0        ,KC_9   ,KC_8   ,KC_7  ,KC_6  ,KC_MINS
+,KC_BSLS   ,KC_P        ,KC_O   ,KC_I   ,KC_U  ,KC_Y  ,KC_RBRC
+,KC_QUOT     ,LT(RBASE, KC_SCLN)     ,KC_L   ,KC_K   ,LT(RBASE, KC_J)  ,KC_H
+,KC_RSFT   ,KC_SLSH     ,KC_DOT ,KC_COMM,KC_M  ,KC_N  ,KC_TAB
+,KC_RCTL   ,MEH_T(KC_NO),ALL_T(KC_NO),KC_RALT,KC_RGUI
+                                             ,KC_LEFT ,KC_RGHT
+                                                      ,KC_UP
+                                    ,KC_SPC  ,KC_ENT  ,KC_DOWN
+                                                                  // right hand
+                                                                 ,KC_ESC      ,KC_5   ,KC_4   ,KC_3   ,KC_2    ,KC_1  ,KC_GRV
+                                                                 ,KC_LBRC     ,KC_T   ,KC_R   ,KC_E   ,KC_W    ,KC_Q  ,KC_TAB
+                                                                              ,KC_G   ,LT(RBASE, KC_F),KC_D   ,KC_S   ,LT(RBASE, KC_A)  ,KC_NO
+                                                                 ,LSFT(KC_TAB),KC_B   ,KC_V   ,KC_C   ,KC_X    ,KC_Z  ,KC_LSFT
+                                                                                      ,KC_LGUI,KC_LALT,KC_HYPR ,KC_MEH,KC_LCTL
+                                                                 ,KC_HOME     ,KC_END
+                                                                 ,KC_PGUP
+                                                                 ,KC_PGDN     ,KC_BSPC ,KC_DEL
+)
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+     // the faux shift keys are implemented as macro taps
+     [LSymb] = ACTION_MACRO_TAP(LSymb)
+    ,[LMdia] = ACTION_MACRO_TAP(LMdia)
+    ,[LSpec] = ACTION_MACRO_TAP(LSpec)
+    ,[RSymb] = ACTION_MACRO_TAP(RSymb)
+    ,[RMdia] = ACTION_MACRO_TAP(RMdia)
+    ,[RSpec] = ACTION_MACRO_TAP(RSpec)
+};
+
+uint16_t symb_shift = 0;
+uint16_t mdia_shift = 0;
+uint16_t spec_shift = 0;
+
+bool mdia_lock = false;
+bool symb_lock = false;
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+    switch(id) {
+        // There are two shift keys for each layer so we increment a layer_shift var when one
+        // is pressed and decrement when one is released. The shift counts are bound between 0 and 2
+        // only because sometimes rapid pressing led to irregular events; this way the states
+        // are self healing during use.
+
+        case LSymb:                                               //
+        if (record->event.pressed) {                              // when the LSymb button is pressed
+            if(++symb_shift > 2) symb_shift = 2;                  // increment the symb shift count, max two
+            if(spec_shift) symb_lock = !symb_lock;                // if the Special layer is on, toggle the shift lock
+            layer_on(SYMB);                                       // in any case, turn on the Symbols layer
+        } else {                                                  // when the LSymb button is released
+            if(--symb_shift < 0) symb_shift = 0;                  // decrement the shift count, minimum zero
+            if((!symb_shift) && (!symb_lock)) layer_off(SYMB);    // if both shifts are released and the lock is off, turn off the Symbols layer
+        }
+        break;
+
+        case LMdia:
+        if (record->event.pressed) {
+           if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
+                register_code(KC_TAB);
+            } else {
+                if(spec_shift) mdia_lock = !mdia_lock;
+                if(++mdia_shift > 2) mdia_shift = 2;
+                layer_on(MDIA);
+            }
+        } else {
+            if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
+                unregister_code(KC_TAB);
+            } else {
+                if(--mdia_shift < 0) mdia_shift = 0;
+                if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
+            }
+        }
+        break;
+
+        case LSpec:
+        if (record->event.pressed) {                                     // when the LSpec button is pressed
+            if(symb_shift) symb_lock = !symb_lock;                       // if another layer button is engaged, then
+            else if(mdia_shift) mdia_lock = !mdia_lock;                  // lock that layer, be it caps or symb or mdia
+            else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
+                register_code(KC_GRV);                                   // otherwise, if it's an uninterrupted tap, emit a char
+            } else {
+                if(++spec_shift > 2) spec_shift = 2;
+                layer_on(SPEC);                                          // otherwise, turn on the Special layer
+            }
+        } else {
+            if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
+                unregister_code(KC_GRV);
+            } else {
+                if(--spec_shift < 0) spec_shift = 0;
+                if(!spec_shift) layer_off(SPEC);
+            }
+        }
+        break;
+
+        case RSymb:
+        if (record->event.pressed) {
+            if (record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
+                register_code(KC_QUOT);
+            } else {
+                if(++symb_shift > 2) symb_shift = 2;
+                if(spec_shift) symb_lock = !symb_lock;
+                layer_on(SYMB);
+            }
+        } else {
+            if(record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
+                unregister_code(KC_QUOT);
+            } else {
+                if(--symb_shift < 0) symb_shift = 0;
+                if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
+            }
+        }
+        break;
+
+        case RMdia:
+        if (record->event.pressed) {
+            if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
+                register_code(KC_BSLS);
+            } else {
+                if(++mdia_shift > 2) mdia_shift = 2;
+                if(spec_shift) mdia_lock = !mdia_lock;
+                layer_on(MDIA);
+            }
+        } else {
+            if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
+                unregister_code(KC_BSLS);
+            } else {
+                if(--mdia_shift < 0) mdia_shift = 0;
+                if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
+            }
+        }
+        break;
+
+        case RSpec:
+        if (record->event.pressed) {
+            if(symb_shift) symb_lock = !symb_lock;
+            else if(mdia_shift) mdia_lock = !mdia_lock;
+            else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
+                register_code(KC_EQL);
+            } else {
+                if(++spec_shift > 2) spec_shift = 2;
+                layer_on(SPEC);
+            }
+        } else {
+            if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
+                unregister_code(KC_EQL);
+            } else {
+                if(--spec_shift < 0) spec_shift = 0;
+                if(!spec_shift) layer_off(SPEC);
+            }
+        }
+        break;
+
+        case NotEq:
+        if (record->event.pressed) {
+            return MACRO( I(10), D(LSFT), T(1), U(LSFT), T(EQL), END  ); // !=
+        }
+        break;
+
+        case GrtEq:
+        if (record->event.pressed) {
+            return MACRO( I(10), D(LSFT), T(COMM), U(LSFT), T(EQL), END  ); // <=
+        }
+        break;
+
+        case LesEq:
+        if (record->event.pressed) {
+            return MACRO( I(10), D(LSFT), T(DOT), U(LSFT), T(EQL), END  ); // >=
+        }
+        break;
+
+        case DeRef:
+        if (record->event.pressed) {
+            return MACRO( I(10), T(MINS), D(LSFT), T(DOT), U(LSFT), END  ); // ->
+        }
+        break;
+
+        // mouse diagonals
+
+        case MUL: // mouse up left
+        if (record->event.pressed) {
+            mousekey_on(KC_MS_UP);
+            mousekey_on(KC_MS_LEFT);
+            mousekey_send();
+        } else {
+            mousekey_off(KC_MS_UP);
+            mousekey_off(KC_MS_LEFT);
+            mousekey_send();
+        }
+        break;
+
+        case MUR: // mouse up right
+        if (record->event.pressed) {
+            mousekey_on(KC_MS_UP);
+            mousekey_on(KC_MS_RIGHT);
+            mousekey_send();
+        } else {
+            mousekey_off(KC_MS_UP);
+            mousekey_off(KC_MS_RIGHT);
+            mousekey_send();
+        }
+        break;
+
+        case MDL: // mouse down left
+        if (record->event.pressed) {
+            mousekey_on(KC_MS_DOWN);
+            mousekey_on(KC_MS_LEFT);
+            mousekey_send();
+        } else {
+            mousekey_off(KC_MS_DOWN);
+            mousekey_off(KC_MS_LEFT);
+            mousekey_send();
+        }
+        break;
+
+        case MDR: // mouse down right
+        if (record->event.pressed) {
+            mousekey_on(KC_MS_DOWN);
+            mousekey_on(KC_MS_RIGHT);
+            mousekey_send();
+        } else {
+            mousekey_off(KC_MS_DOWN);
+            mousekey_off(KC_MS_RIGHT);
+            mousekey_send();
+        }
+        break;
+
+        default:
+            // none
+            break;
+    }
+
+    return MACRO_NONE;
+};
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+// Runs constantly in the background, in a loop.
+void matrix_scan_user(void) {
+    // shift or caps lock turns on red light
+    if((keyboard_report->mods & MOD_BIT(KC_LSFT))
+    || (keyboard_report->mods & MOD_BIT(KC_RSFT))
+    || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
+        ergodox_right_led_1_on();
+    } else {
+        ergodox_right_led_1_off();
+    }
+
+    // Symbol layer turns on green light
+    if(layer_state & (1UL<<SYMB)) {
+        ergodox_right_led_2_on();
+    } else {
+        ergodox_right_led_2_off();
+    }
+
+    // Media layer turns on blue light
+    if(layer_state & (1UL<<MDIA)) {
+        ergodox_right_led_3_on();
+    } else {
+        ergodox_right_led_3_off();
+    }
+};
diff --git a/layouts/community/ergodox/ordinary_osx/ordinary-base.txt b/layouts/community/ergodox/ordinary_osx/ordinary-base.txt
new file mode 100644
index 0000000000..4fc11faf94
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/ordinary-base.txt
@@ -0,0 +1,27 @@
+[{x:3.5},"#\n3",{x:10.5},"*\n8"],
+[{y:-0.875,x:2.5},"@\n2",{x:1},"$\n4",{x:8.5},"&\n7",{x:1},"(\n9"],
+[{y:-0.875,x:5.5},"%\n5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc"},"_\n\n\n\n\n\n-","^\n6"],
+[{y:-0.875,c:"#c6c600",w:1.5},"Special\n\n~\n\n\n\nShift\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{c:"#c6c600",w:1.5},"+\n\nSpecial\n\n\n\n=\nShift"],
+[{y:-0.375,x:3.5,c:"#cccccc"},"E",{x:10.5},"I"],
+[{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"],
+[{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"],
+[{y:-0.875,c:"#c6c600",t:"#002299",w:1.5},"Media\n\nTab\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"Q",{x:14.5},"P",{c:"#c6c600",t:"#002299",w:1.5},"|\n\\\nMedia\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000"},"D",{x:10.5},"K"],
+[{y:-0.875,x:2.5},"S",{x:1,fa:[0,0,0,1]},"F\n\n\nreverse",{x:8.5},"J\n\n\nreverse",{x:1},"L"],
+[{y:-0.875,x:5.5},"G",{x:6.5},"H"],
+[{y:-0.875,c:"#c6c600",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"A\n\n\nreverse",{x:14.5},":\n;\n\nreverse",{c:"#c6c600",t:"#007d00",w:1.5},"\"\n'\nSymbols\n\n\n\n\nShift"],
+[{y:-0.625,x:6.5,c:"#ff8500",t:"#000000",h:1.5},"< Tab\n\n\nShift Tab",{x:4.5,h:1.5},"Tab >\n\n\nTab"],
+[{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"],
+[{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."],
+[{y:-0.875,x:5.5},"B",{x:6.5},"N"],
+[{y:-0.875,c:"#c6c600",t:"#9e0000",w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"Z",{x:14.5},"?\n/",{c:"#c6c600",t:"#9e0000",w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#dddd77",t:"#000000"},"Option\n\n\nLAlt",{x:10.5},"Option\n\n\nRAlt"],
+[{y:-0.875,x:2.5},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5},"Cmd\n\n\nSuper",{x:1},"Hyper"],
+[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Ctrl\n\n\nRCtrl"],
+[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#ff8500"},"Home","End"],
+[{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete","Page\n\n\n\n\n\nUp"],
+[{x:2},"Page\n\n\n\n\n\nDown"],
+[{r:-30,rx:13,y:-1,x:-3},"Left","Right"],
+[{x:-3},"Up",{h:2},"Enter",{h:2},"Space"],
+[{x:-3},"Down"]
+
diff --git a/layouts/community/ergodox/ordinary_osx/ordinary-media.txt b/layouts/community/ergodox/ordinary_osx/ordinary-media.txt
new file mode 100644
index 0000000000..67b7840b52
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/ordinary-media.txt
@@ -0,0 +1,27 @@
+[{x:3.5,c:"#99de2a"},"F13",{x:10.5},"F18"],
+[{y:-0.875,x:2.5},"F12",{x:1},"F14",{x:8.5},"F17",{x:1},"F19"],
+[{y:-0.875,x:5.5},"F15",{c:"#ff4444"},"Esc",{x:4.5,c:"#737373",a:7},"",{c:"#99de2a",a:4},"F16"],
+[{y:-0.875,c:"#c6c600",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F11",{x:14.5},"F20",{c:"#c6c600",w:1.5},"\n\nShift\n\n\n\n\nLock"],
+[{y:-0.375,x:3.5,c:"#0066cc"},"Mouse\n\n\n\n\n\nUp",{x:10.5},"Cursor\n\n\n\n\n\nUp"],
+[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nUpLeft",{x:1},"Mouse\n\n\n\n\n\nUpRgt",{x:8.5,c:"#1e8fff"},"Home",{x:1},"Page\n\n\n\n\n\nUp"],
+[{y:-0.875,x:5.5,c:"#9977ee"},"Vol\n\n\n\n\n\nUp",{c:"#1e8fff",h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#9977ee"},"Print\n\n\n\n\n\nScreen"],
+[{y:-0.875,c:"#000000",t:"#3f68ff",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#9977ee",t:"#000000"},"Shut\n\n\n\n\n\nDown",{x:14.5},"Mail",{c:"#000000",t:"#3f68ff",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#0066cc",t:"#000000"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
+[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nLeft",{x:1},"Mouse\n\n\n\n\n\nRight",{x:8.5},"Cursor\n\n\n\n\n\nLeft",{x:1},"Cursor\n\n\n\n\n\nRight"],
+[{y:-0.875,x:5.5,c:"#9977ee"},"Vol\n\n\n\n\n\nDown",{x:6.5},"Num\n\n\n\n\n\nLock"],
+[{y:-0.875,c:"#c6c600",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#9977ee",t:"#000000"},"Sleep",{x:14.5},"My\n\n\n\n\n\nComp",{c:"#c6c600",t:"#007d00",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
+[{y:-0.625,x:6.5,c:"#1e8fff",t:"#000000",h:1.5},"Scroll\n\n\n\n\n\nDown",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nDown"],
+[{y:-0.75,x:3.5,c:"#0066cc"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
+[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nDnLeft",{x:1},"Mouse\n\n\n\n\n\nDnRgt",{x:8.5,c:"#1e8fff"},"End",{x:1},"Page\n\n\n\n\n\nDown"],
+[{y:-0.875,x:5.5,c:"#9977ee"},"Mute",{x:6.5,c:"#737373",a:7},""],
+[{y:-0.875,c:"#c6c600",t:"#9e0000",a:4,w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#737373",t:"#000000",a:7},"",{x:14.5},"",{c:"#c6c600",t:"#9e0000",a:4,w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#0066cc",t:"#000000"},"Middle\n\n\n\n\n\nClick",{x:10.5,c:"#1e8fff"},"Delete"],
+[{y:-0.875,x:2.5,c:"#0066cc"},"Left\n\n\n\n\n\nClick",{x:1},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#1e8fff"},"Insert",{x:1,c:"#737373",a:7},""],
+[{y:-0.75,x:0.5},"","",{x:14.5},"",""],
+[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#6633ee",a:4,fa:[0,0,0,1]},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
+[{h:2},"< Web\n\n\nBrowser",{h:2},"Web >\n\n\nBrowser","Search\n\n\nBrowser"],
+[{x:2},"Home\n\n\nBrowser"],
+[{r:-30,rx:13,y:-1,x:-3},"Prev\n\n\nAudio\n\n\nTrack","Next\n\n\nAudio\n\n\nTrack"],
+[{x:-3,c:"#9977ee"},"Vol\n\n\n\n\n\nUp",{c:"#6633ee",h:2},"Stop\n\n\nAudio",{h:2},"Play\n\n\nAudio\n\n\nPause"],
+[{x:-3,c:"#9977ee"},"Vol\n\n\n\n\n\nDown"]
+
diff --git a/layouts/community/ergodox/ordinary_osx/ordinary-special.txt b/layouts/community/ergodox/ordinary_osx/ordinary-special.txt
new file mode 100644
index 0000000000..97f40f9dbc
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/ordinary-special.txt
@@ -0,0 +1,27 @@
+[{x:3.5,a:7},"",{x:10.5},""],
+[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1,a:4},"_\n\n\n\n\n\n-"],
+[{y:-0.875,x:5.5,a:7},"",{c:"#ff4444",a:4},"Esc",{x:4.5,c:"#cccccc",a:7},"",""],
+[{y:-0.875,c:"#000000",t:"#ff0000",a:4,w:1.5},"Special\n\n\n\n\n\nShift",{c:"#ff4444",t:"#000000"},"Esc",{x:14.5,c:"#ff8500"},"Back\n\n\n\n\n\nspace",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSpecial\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000",a:7},"",{x:10.5},""],
+[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1,a:4},"{\n["],
+[{y:-0.875,x:5.5,a:7},"",{h:1.5},"",{x:4.5,h:1.5},"",""],
+[{y:-0.875,c:"#c6c600",t:"#002299",a:4,w:1.5},"Media\n\n\n\n\n\nLock",{c:"#cccccc",t:"#000000",a:7},"",{x:14.5,a:4},"\n\n}\n]",{c:"#c6c600",t:"#002299",w:1.5},"Media\n\n\n\n\n\nLock"],
+[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000",a:7},"",{x:10.5},""],
+[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
+[{y:-0.875,x:5.5},"",{x:6.5},""],
+[{y:-0.875,c:"#c6c600",t:"#007d00",a:4,w:1.5},"Symbols\n\n\n\n\n\nLock",{c:"#cccccc",t:"#000000",a:7},"",{x:14.5},"",{c:"#c6c600",t:"#007d00",a:4,w:1.5},"Symbols\n\n\n\n\n\nLock"],
+[{y:-0.625,x:6.5,c:"#cccccc",t:"#000000",a:7,h:1.5},"",{x:4.5,h:1.5},""],
+[{y:-0.75,x:3.5},"",{x:10.5},""],
+[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
+[{y:-0.875,x:5.5},"",{x:6.5},""],
+[{y:-0.875,c:"#c6c600",t:"#9e0000",a:4,w:1.5},"Capitals\n\n\n\n\n\nLock",{c:"#cccccc",t:"#000000",a:7},"",{x:14.5},"",{c:"#c6c600",t:"#9e0000",a:4,w:1.5},"Capitals\n\n\n\n\n\nLock"],
+[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000",a:7},"",{x:10.5},""],
+[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
+[{y:-0.75,x:0.5},"","",{x:14.5},"",""],
+[{r:30,rx:6.5,ry:4.25,y:-1,x:1},"",""],
+[{h:2},"",{h:2},"",""],
+[{x:2},""],
+[{r:-30,rx:13,y:-1,x:-3},"",""],
+[{x:-3},"",{h:2},"",{h:2},""],
+[{x:-3},""]
+
diff --git a/layouts/community/ergodox/ordinary_osx/ordinary-symbol.txt b/layouts/community/ergodox/ordinary_osx/ordinary-symbol.txt
new file mode 100644
index 0000000000..65eca9d6a5
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/ordinary-symbol.txt
@@ -0,0 +1,27 @@
+[{x:3.5,c:"#99de2a"},"F3",{x:10.5},"F8"],
+[{y:-0.875,x:2.5},"F2",{x:1},"F4",{x:8.5},"F7",{x:1},"F9"],
+[{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#bbddbb"},"_\n\n\n\n\n\n-",{c:"#99de2a"},"F6"],
+[{y:-0.875,c:"#c6c600",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F1",{x:14.5},"F10",{c:"#c6c600",w:1.5},"\n\nShift\n\n\n\n\nLock"],
+[{y:-0.375,x:3.5,c:"#bbddbb"},"{",{x:10.5,c:"#89b087"},"8"],
+[{y:-0.875,x:2.5,c:"#bbddbb"},"@",{x:1},"}",{x:8.5,c:"#89b087"},"7",{x:1},"9"],
+[{y:-0.875,x:5.5,c:"#bbddbb"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"],
+[{y:-0.875,c:"#c6c600",t:"#002299",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"!",{x:14.5,c:"#89b087"},"/",{c:"#c6c600",t:"#002299",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#bbddbb",t:"#000000"},"(",{x:10.5,c:"#89b087"},"5"],
+[{y:-0.875,x:2.5,c:"#bbddbb"},"$",{x:1},")",{x:8.5,c:"#89b087"},"4",{x:1},"6"],
+[{y:-0.875,x:5.5,c:"#bbddbb"},"`",{x:6.5},"/"],
+[{y:-0.875,c:"#000000",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"#",{x:14.5,c:"#89b087"},"*",{c:"#000000",t:"#007d00",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
+[{y:-0.625,x:6.5,c:"#bbddbb",t:"#000000",a:6,h:1.5},"'",{x:4.5,h:1.5},"\""],
+[{y:-0.75,x:3.5,a:4},"[",{x:10.5,c:"#89b087"},"2"],
+[{y:-0.875,x:2.5,c:"#bbddbb"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
+[{y:-0.875,x:5.5,c:"#bbddbb"},"~",{x:6.5},"\\"],
+[{y:-0.875,c:"#c6c600",t:"#9e0000",w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"%",{x:14.5,c:"#89b087"},"-",{c:"#c6c600",t:"#9e0000",w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
+[{y:-0.375,x:3.5,c:"#bbddbb",t:"#000000"},"<",{x:10.5,c:"#89b087"},"."],
+[{y:-0.875,x:2.5,c:"#bbddbb"},"*",{x:1},">",{x:8.5,c:"#89b087"},"0",{x:1},"="],
+[{y:-0.75,x:0.5,c:"#bbddbb"},";","&",{x:14.5,c:"#89b087"},"+","Enter"],
+[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#bbddbb"},"<=",">="],
+[{a:7,h:2},"+",{h:2},"=",{c:"#737373"},""],
+[{x:2,c:"#bbddbb",a:4},"!="],
+[{r:-30,rx:13,y:-1,x:-3,c:"#737373",a:7},"",""],
+[{x:-3},"",{c:"#bbddbb",h:2},"_",{h:2},"-"],
+[{x:-3,a:4},"->"]
+
diff --git a/layouts/community/ergodox/ordinary_osx/readme.md b/layouts/community/ergodox/ordinary_osx/readme.md
new file mode 100644
index 0000000000..90ff500440
--- /dev/null
+++ b/layouts/community/ergodox/ordinary_osx/readme.md
@@ -0,0 +1,3 @@
+# The Ordinary Layout for OSX #
+
+It is based on [Ordinary Layout](../ordinary/readme.md) with some keys re-mapped for OSX.