1
0
Fork 0

Remove complex fn_actions macros (#14662)

* Remove complex `fn_actions` macros

* Remove additional `KC_FN*` instances
This commit is contained in:
Ryan 2021-11-01 09:27:54 +11:00 committed by GitHub
parent b25218ccc1
commit 928d9f90ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 379 additions and 5036 deletions

View file

@ -43,8 +43,8 @@ LAYOUT(
),
LAYOUT(
KC_FN6, KC_FN7, KC_FN8, KC_FN9, KC_FN10, KC_FN11, KC_FN12, KC_FN13, KC_FN14, KC_FN15, KC_FN16, KC_DELETE,
_______, _______, _______, _______, _______, _______, _______, KC_FN17, KC_FN18, KC_FN19, KC_FN20, KC_FN21,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DELETE,
_______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
_______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
),

View file

@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
KC_PGDN,KC_TAB,KC_ENT

View file

@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
KC_PGDN,KC_TAB,KC_ENT

View file

@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL,KC_LALT,
KC_HOME,
KC_BSPC,KC_DEL ,KC_END ,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_FN0, RESET,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_NO, RESET,
KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,
KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS,
KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,

View file

@ -32,7 +32,7 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[QWERTY] = LAYOUT_pretty(
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_PSCR, KC_SLCK, KC_PAUS, KC_FN0, RESET,
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_PSCR, KC_SLCK, KC_PAUS, KC_NO, RESET,
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,

View file

@ -17,7 +17,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_HOME,
KC_BSPC, KC_DEL, KC_END,
// right hand
KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_FN0, RESET,
KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, RESET,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
KC_D, KC_H, KC_T, KC_N, KC_S, KC_BSLS,

View file

@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL,KC_LALT,
KC_LGUI,
KC_BSPC,KC_ESC ,KC_END ,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_FN0, RESET,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_NO, RESET,
KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,
KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS,
KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,

View file

@ -15,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_RCTL,KC_LALT,
KC_HOME,
KC_SPC ,KC_LSFT,KC_BSPC ,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_PAUS,KC_FN0 ,RESET,
KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_PAUS,KC_NO ,RESET,
KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,DE_SS ,
KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,DE_ADIA,
KC_H ,KC_J ,KC_K ,KC_L ,DE_SLSH,DE_ODIA,

View file

@ -20,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
_______, KC_LCTRL, KC_LALT, KC_LGUI, KC_FN13, KC_SPC, KC_SPC, KC_FN23, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
_______, KC_LCTRL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
[1] = LAYOUT_ortho_4x12(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,

View file

@ -68,9 +68,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_NAV] = LAYOUT_planck_grid(
KC_MS_ACCEL2, KC_FN1, KC_FN2, KC_FN3, KC_FN4, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, XXXXXXX,
KC_MS_ACCEL2, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, XXXXXXX,
KC_MS_ACCEL1, KC_MS_BTN4, KC_MS_BTN3, KC_MS_BTN2, KC_MS_BTN1, XXXXXXX, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, XXXXXXX, XXXXXXX,
KC_MS_ACCEL0, KC_FN9, KC_FN10, KC_FN11, KC_FN12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_MS_ACCEL0, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),

View file

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 3 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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,229 +0,0 @@
<!-- -*- mode: markdown; fill-column: 8192 -*- -->
## v1.12
*2018-11-22*
### Overall changes
* Updated to work with QMK master.
### Miscellaneous
* The `😂` symbol can be entered with UCIS.
* `LEAD r` now inputs `Right Alt`.
## v1.11
*2017-10-01*
### Overall changes
* Updated to work with QMK master.
* The `$` and `^` symbols on the number row were swapped on both the base and the ADORE layers.
* The bracket tap-dance keys can now be used to input Japanese brackets, `「` and `」` with a third tap.
* The second column of the top row on the right side will act as a "Social" application selector on the `AppSel` layer.
* The third key on the same column will select a password manager.
* The `GUI` key will now launch `rofi` when triple-tapped.
### Miscellaneous
* The `👶` symbol can be entered with UCIS.
* The `👪` symbol can be entered with UCIS.
### Tools
* `tools/hid-commands` can now find the `Mstdn`, not just `Slack`, as the "Slack"/chat app.
* `tools/hid-commands` can now find the Plex web app as a music/media player.
* `tools/hid-commands` now understands the "Social" application selector. It raises the `Mstdn` and `Tweetdeck` windows, but keeps focus on the previous window.
* `tools/hid-commands` now understands the "Social2" application selector, which raises `Signal` and `Viber`, but keeps focus on the previous window.
* `tools/hid-commands` is now able to select a password manager (KeePass*).
* `tools/hid-commands` can now run `rofi` when receiving an `appsel_helper` command (triggered by a triple-tapped `GUI` key).
## v1.10
*2016-12-28*
### Miscellaneous
* `µ` can now be entered with UCIS.
* `™` can now be entered with UCIS.
### Tools
* `tools/hid-commands` can now find Banshee, and prefers it over Kodi.
* `tools/hid-commands` can now find Chrome too, not juts Chromium.
## v1.9
*2016-10-16*
### Overall changes
* `F12` was replaced by an `Fx` key, that activate the **Media** layer as a one-shot layer, and also `Alt` as a one-shot modifier.
### Base layer changes
* The `Media Stop` key is now a tap-dance key, and resets the device for programming on the fourth tap.
### Miscellaneous
* `π` can now be entered with UCIS.
* `🐁` can now be entered with UCIS.
### Tools
* The `tools/layer-notify` tool was removed, it was an example, which I don't use.
#### `tools/hid-commands`
* Now looks at the `DISABLE_APPSEL_START` environment value, and does not display an AppSel notification if it is non-empty.
* Will attempt to re-program the keyboard when receiving a `reflash` command.
* No longer tries to select Emacs 24 on `APPSEL_EMACS`, rather, it goes for any Emacs.
* The `APPSEL_MUSIC` command now includes Kodi in the list too, as the last choice.
## v1.8
*2016-10-03*
### ADORE
* Major rearrangements were made, to reduce pinky use, and to balance out the hand usage.
### Tools
* The `hid-commands` tool will now display a notification when the **AppSel** layer is triggered.
* The `log-to-heatmap.py` tool now treats the innermost keys on the bottom row as thumb keys, as far as statistics are concerned.
### Miscellaneous
* Fixed the **Steno** toggle key.
## v1.7
*2016-09-18*
### Overall changes
* The number row has been completely rearranged on both the **Base** and the **ADORE** layers.
* The number/function key behavior was changed: function keys are now on the **Media**.
* The `:`/`;` and `-`/`_` keys were put back to their thumb position on the bottom row, on both the **Base** and **ADORE** layers.
* The bottom large keys on the inner side of each half now function as [tmux](http://tmux.github.io/) keys: the left to send the prefix, the right to send the `display-panes` key. The left also doubles as a GNU screen prefix key, and sends `C-a` when double tapped.
* A number of functions, such as the **AppSel** layer, now require the `hid-commands` tool to be running, with the output of `hid_listen` being piped to it.
### ADORE
* `Y` and `X` have been swapped again.
### Media/Navigation layer
* The function keys are now on this layer.
* Mouse keys have been removed.
* Media start/stop/prev/next have been removed.
* `Print screen` has been removed.
* There is only one screen lock key now.
### Heatmap
* Fixed a few issues in the finger-stats calculation.
* The tool now also timestamps and saves all input lines to a logfile, which it loads on start, allowing one to continue the collection after upgrading the tool.
* The heatmap tool will now colorize the stats by default.
* The periodic stats are now printed in a more compact format.
### Tools
* Added a new tool, `tools/layer-notify` that listens to layer change events on the HID console, and pops up a notification on layer changes.
* Another new tool, `tools/text-to-log.py` has been added that converts arbitrary text to a keylogger output, which can be fed to the heatmap generator.
* A number of features have been moved to the `tools/hid-commands` utility. These generally are OS dependent, and are easier to implement on the software side.
## v1.6
*2016-08-24*
### Base layer changes
* The parentheses & bracket keys have been merged: tapping them results in `[` or `{` (if it was shifted), double tapping leads to `(`.
* The `:;` and `-_` keys are now available on the base layer, on their **ADORE** location, too, just below `[{(`/`]})`.
* The `Apps` key has been replaced by `F12`.
* The `-`/`_` is no longer a tap-dance key.
### ADORE layer changes
* Adjustments were made to the **ADORE** layer, to separate some inconvenient combinations.
### Miscellaneous changes
* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one.
* The mouse acceleration keys on the **Navigation/Media** layer have been turned into toggles: tap them once to turn them on, until tapped again. Tapping an accelerator button will turn all the others off.
* When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
### Heatmap
* The built-in keylogger has been greatly enhanced, it now outputs the pressed state, and the layer (Dvorak or ADORE). As such, the `ADORE_AUTOLOG` option has been removed, instead there is `AUTOLOG_ENABLE` now, which when enabled, makes the keylogger start when the keyboard boots. It defaults to off.
* The heatmap generator received a lot of updates.
## v1.5
*2016-08-12*
* The **1HAND** layer has been removed.
* A `Delete` key is now available on the right thumb cluster.
* The **ADORE** layer received a major update, see the layout image above.
* It is now possible to enable automatic logging for the **ADORE** layer, by setting the `ADORE_AUTOLOG` makefile variable to `yes` when compiling the keymap. It is off by default.
* The `~` key and the `Media Next/Prev` key have been swapped on the **Base** layer.
* On the **ARROW** layer, `Backspace` has been replaced by `Enter`.
* There is some experimental support for entering Unicode symbols.
## v1.4
*2016-07-29*
* When toggling the key logging on or off, the LEDs will do a little dance.
* The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it.
* The `TAB`/`ARRW` key was turned into a tap-dance key, allowing one to toggle the **ARROW** layer on by double-tapping, and as such, avoid the need to hold the key.
* The `-`/`_` key was turned into a tap-dance key too.
* There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`.
## v1.3
*2016-07-06*
* Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a *heatmap* out of the logs.
* The arrow and navigation keys were rearranged again, and now require an additional key being held to activate. See the **Base** layer for an image that shows where arrows are.
* The **experimental** layer has been redone, and is now called **ADORE**, and as such, can be enabled by `LEAD a` now.
* Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot.
## v1.2
*2016-06-22*
* The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with certain operating systems.
* The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted.
* The `=` and `\` keys were swapped, `=` moved to the home row, on both the **Base** and the **experimental** layers.
* The arrow and navigation keys were redone, they are now more accessible, but the navigation keys require an extra tap to access.
* The **Emacs** layer is gone, replaced by a simplified **navigation and media** layer.
* `LEAD v` types the firmware version, and the keymap version.
* On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped.
* The **Steno** layer gained a few more `#` and `*` keys, to make it easier on my fingers.
## v1.1
*2016-06-14*
* The keyboard starts in NKRO mode, bootmagic and other things are disabled.
* A **Steno** layer was added, to be used with Plover.
* An **experimental** layer was added, something halfway between Dvorak and Capewell-Dvorak. A work in progress.
* `LEAD y` types `\o/`.
* Some keys on the **Base** layer have been moved around:
- `?` moved to the left pinky, left of `Q`.
- `=` shifted one row down, but `F11` stayed where it was.
- `-` on the left half was replaced by `Tab`.
- `Tab`'s original position is taken by a `Media Next`/`Media Prev` key.
- `:` now inputs `;` when shifted.
* `ESC` cancels the **Hungarian** layer too, not just modifiers.
## v1.0
*2016-05-26*
Initial version.

View file

@ -1,22 +0,0 @@
#pragma once
#undef MOUSEKEY_TIME_TO_MAX
#undef MOUSEKEY_MAX_SPEED
#define MOUSEKEY_TIME_TO_MAX 1
#define MOUSEKEY_MAX_SPEED 2
#undef MOUSEKEY_DELAY
#define MOUSEKEY_DELAY 0
#undef MOUSEKEY_WHEEL_DELAY
#define MOUSEKEY_WHEEL_DELAY 0
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 3000
#undef LOCKING_SUPPORT_ENABLE
#undef LOCKING_RESYNC_ENABLE
#undef LEADER_TIMEOUT
#define LEADER_TIMEOUT 1000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,152 +0,0 @@
<!-- -*- mode: markdown; fill-column: 8192 -*- -->
algernon's layout
=======================
This is the layout I used to use on my [ErgoDox EZ][ez], while I was using [QMK][qmk]. I no longer do so, and this repository is obsolete, and not updated anymore. My current firmware is based on [Kaleidoscope][kaleidoscope], and is located [elsewhere][ergodox-sketch]. I'm keeping the repo around for historical and educational purposes.
[kaleidoscope]: https://github.com/keyboardio/Kaleidoscope
[ergodox-sketch]: https://git.madhouse-project.org/algernon/ErgoDox-sketch
Nevertheless, this is an unconventional layout for the [ErgoDox EZ][ez]. For more details about the history of the layout, see my [blog posts about my ErgoDox journey][blog-ergodox].
[ez]: https://ergodox-ez.com/
[blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/
Some of the things in the layout only work when one uses [Spacemacs][spacemacs] and [GNOME][gnome] under Linux. Your mileage may vary.
[spacemacs]: http://spacemacs.org/
[gnome]: https://www.gnome.org/
## Table of Contents
* [Layouts](#layouts)
- [Base layer](#base-layer)
- [ADORE layer](#adore-layer)
- [Steno layer](#steno-layer)
- [LED states](#led-states)
* [Tools](#tools)
- [Heatmap](#heatmap)
- [Layer notification](#layer-notification)
* [Special features](#special-features)
- [Unicode Symbol Input](#unicode-symbol-input)
* [Building](#building)
- [Using on Windows](#using-on-windows)
* [Changelog](https://github.com/algernon/ergodox-layout/blob/master/NEWS.md#readme)
* [License](#license)
# Layouts
## Base layer
[![Base layer](https://github.com/algernon/ergodox-layout/raw/master/images/base-layer.png)](http://www.keyboard-layout-editor.com/#/gists/28f7eb305fdbff943613e1dc7aa9e82b)
At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave:
* The number row is the same as in the [ADORE](#adore-layer) layer. The function keys are on the **Media** layer.
* The `Shift`, `Alt`, and `Control` modifiers are one-shot. When tapped, they are considered active for the next key press only. When double tapped, they toggle on, until a third, single tap sometime later. When held, they act as expected. My usual pattern is that I use these for the next keypress only, so this behaviour is perfect. If I need them held, I'll just double-tap.
* The `GUI` key is special, because while a single tap works as usual, when double-tapped, it turns the number row into an application selector, and when triple tapped, it runs an application selector program on the host.
* The `ESC` key also doubles as a one-shot cancel key: if tapped while any of the one-shot modifiers are in-flight (as in, single-tapped, and not expired yet), it cancels all one-shot modifiers. It also cancels the **Hun** layer, if active. Otherwise it sends the usual keycode.
* The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle.
* The **Fx** key is one-shot, and activates the **Media** layer, along with a one-shot `Alt`.
* When holding the `Tab`/**Arrow** key, the arrow layer activates while the key is held. Tapping the key produces the normal, `Tab` key. Double-tapping it toggles the **Arrow** layer on until a third tap.
* Tapping the `:` key once yields `:`, tapping it twice yields `;`.
* Tapping the `[{(`/`)}]` keys once yields `[` (or `{` when shifted), tapping them twice yields `(`.
* The **Lead** key allows me to type in a sequence of keys, and trigger some actions:
- `LEAD l` uses the unicode input method to enter a `λ`.
- `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯`
- `LEAD y` types `\o/`.
- `LEAD w m` maximises the currently focused window.
- `LEAD a` makes the [ADORE layer](#adore-layer) the default.
- `LEAD v` prints the firmware version, the keyboard and the keymap.
- `LEAD d` toggles logging keypress positions to the HID console.
- `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader.
- `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
- `LEAD r` inputs `Right Alt`, which is the `Compose` key of my choice.
The symbols on the front in the image above have the same color as the key that activates them, with the exception of the **Arrow** layer, which is just black on the front.
## ADORE layer
[![ADORE layer](https://github.com/algernon/ergodox-layout/raw/master/images/adore-layer.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a)
My experimental layout, that I keep tweaking. No full description here, because things are very much in flux.
Note that the **HUN** layer does not work well with ADORE: it still has the same layout as on the [Base](#base-layer) layer. This will remain until ADORE becomes the default.
## Steno layer
[![Steno layer for Plover](https://github.com/algernon/ergodox-layout/raw/master/images/steno-layer.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667)
This is to be used with [Plover](http://www.openstenoproject.org/plover/), nothing really fancy here. The **STENO** key toggles the layer on and off, and sends the toggle command to Plover too.
## LED states
The primary purpose of the LEDs is to show the modifier status, a secondary, to show which layer is active. Each modifier, `Shift`, `Alt` and `Control` each have their designated LEDs: the *red*, *green* and *blue*, respectively. When a modifier is in a one-shot state, the respective LED will turn on with a dimmer light. If the modifier is toggled on, the brightness of the LED turns full.
For the layers, the following rules apply:
* When the [ADORE layer](#adore-layer) is toggled on, LEDs will light up from left to right in a sequence, then turn off. When the layer is toggled off, the LEDs light up and turn off in the other direction. No LEDs are on while the layer is active.
* When the **Hungarian** layer is active, the *green* and *blue* LEDs are on.
* When the **Media** layer is active, the *red* and *green* ones are on.
* When the **ARROW** layer is active, the *red* and *blue* ones are on.
* For the [Steno layer](#steno-layer), all LEDs will be turned on.
Unless noted otherwise, the layers use a dim light for the LEDs, while modifiers use a stronger one, and modifiers override any layer preferences. For example, when on the one-handed layer, with the left side active (*red* light blinking), if `Shift` is on, the *red* light will be constantly on.
# Special features
## Unicode Symbol Input
Once in the Unicode Symbol Input mode, one is able to type in symbol names, press `Enter` or `Space`, and get the Unicode symbol itself back. When in the mode, a capital `U` is printed first. Once the sequence is finished, all of it is erased by sending enough `Backspace` taps, and the firmware starts the OS-specific unicode input sequence. Then, it looks up the symbol name, and enters the associated code. If it is not found, it will just replay the pressed keycodes.
For the list of supported symbols, please see the source.
This is an experimental feature, and may or may not work reliably.
# Tools
## Heatmap
When the keypress logging functionality is enabled (by `LEAD d`), the keyboard will output a line every time a key is pressed, containing the position of the key in the matrix. This allows one to collect this information, and build analytics over it, such as a heat map, including dead keys too.
Included with the firmware is a small tool that can parse these logs, and create a heatmap that one can import into [KLE][kle]. To use it, either pipe the output of `hid_listen` into it, or pipe it an already saved log, and it will save the results into files in an output directory (given on the command-line). See the output of `tools/log-to-heatmap.py --help` for more information.
[kle]: http://www.keyboard-layout-editor.com/
The generated heatmap looks somewhat like this:
![Heatmap](https://github.com/algernon/ergodox-layout/raw/master/images/heatmap.png)
## Layer notification
There is a very small tool in `tools/layer-notify`, that listens to the HID console, looking for layer change events, and pops up a notification for every detected change. It is a very simple tool, mainly serving as an example.
# Building
To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `layouts/community/algernon_master`, or symlinked there. One way to achieve that is this:
[algernon:ez-layout]: https://github.com/algernon/ergodox-layout
[qmk]: https://github.com/qmk/qmk_firmware
```
$ git clone https://github.com/qmk/qmk_firmware.git
$ cd qmk_firmware
$ git clone https://github.com/algernon/ergodox-layout.git \
layouts/community/ergodox/algernon_master
$ make ergodox_ez:algernon_master
```
From time to time, updates may be submitted back to the QMK repository. If you are reading it there, you can build the firmware like any other firmware included with it (assuming you are in the root directory of the firmware):
```
$ make ergodox_ez:algernon
```
## Using on Windows
The keymap default to forcing NKRO, which seems to upset Windows, and except the modifiers, none of them work. If you experience this problem, recompile the firmware with `FORCE_NKRO=no` added to the `make` command line.
# License
The layout, being a derivative of the original TMK firmware which is under the GPL-2+, this layout is under the GPL as well, but GPL-3+, rather than the older version.

View file

@ -1,43 +0,0 @@
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
COMMAND_ENABLE=no
SLEEP_LED_ENABLE=no
FORCE_NKRO ?= yes
DEBUG_ENABLE = no
CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes
KEYLOGGER_ENABLE ?= yes
UCIS_ENABLE = yes
MOUSEKEY_ENABLE = no
LEADER_ENABLE = yes
RGBLIGHT_ENABLE = no
AUTOLOG_ENABLE ?= yes
ifeq (${FORCE_NKRO},yes)
OPT_DEFS += -DFORCE_NKRO
endif
ifeq (${AUTOLOG_ENABLE},yes)
KEYLOGGER_ENABLE = yes
OPT_DEFS += -DAUTOLOG_ENABLE
endif
ifeq (${KEYLOGGER_ENABLE},yes)
OPT_DEFS += -DKEYLOGGER_ENABLE
CONSOLE_ENABLE = yes
endif
OPT_DEFS += -DUSER_PRINT
LAYOUT_ergodox_VERSION = $(shell \
if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
cd "${LAYOUT_ergodox_PATH}" && git describe --abbrev=6 --dirty --always --tags --match 'v*' 2>/dev/null; \
else echo QMK; fi)
LAYOUT_ergodox_BRANCH = $(shell \
if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
cd "${LAYOUT_ergodox_PATH}"; \
fi; \
git rev-parse --abbrev-ref HEAD 2>/dev/null)
OPT_DEFS += -DLAYOUT_ergodox_VERSION=\"$(LAYOUT_ergodox_VERSION)\\\#$(LAYOUT_ergodox_BRANCH)\"

View file

@ -1,486 +0,0 @@
[
{
"backcolor": "#ffffff",
"name": "ErgoDox - algernon's layout: Heatmap",
"author": "Gergely Nagy <kbd@gergo.csillger.hu>",
"notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Tea",
"pcb": true,
"css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
},
[
{
"x": 3.5,
"fa": [
0,
0,
2
]
},
"*\n5\nF5",
{
"x": 10.5,
"a": 4,
"fa": [
0,
0,
2
]
},
"#\n4\nF4"
],
[
{
"y": -0.875,
"x": 2.5
},
"@\n7\nF7",
{
"x": 1
},
"^\n3\nF3",
{
"x": 8.5
},
"!\n2\nF2",
{
"x": 1
},
"&\n6\nF6"
],
[
{
"y": -0.875,
"x": 5.5
},
"$\n1\nF1",
{
"a": 7,
"f": 3
},
"F11",
{
"x": 4.5,
"f": 3
},
"Fx",
{
"a": 4,
"f": 3,
"fa": [
0,
0,
2
]
},
"%\n0\nF10"
],
[
{
"y": -0.875,
"f": 9,
"a": 6,
"w": 1.5
},
"\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{
"f": 3,
"a": 4,
"fa": [
0,
0,
2
]
},
" \n9\nF9",
{
"x": 14.5
},
" \n8\nF8",
{
"a": 7,
"w": 1.5
},
"STENO"
],
[
{
"y": -0.375,
"x": 3.5,
"a": 6
},
"C",
{
"x": 10.5
},
"L"
],
[
{
"y": -0.875,
"x": 2.5,
"a": 6
},
"W",
{
"x": 1,
"a": 6
},
"H",
{
"x": 8.5
},
"G",
{
"x": 1
},
"P"
],
[
{
"y": -0.875,
"x": 5.5
},
"F",
{
"a": 4,
"fa": [0, 0, 0],
"h": 1.5
},
"{\n(\n[",
{
"x": 4.5,
"h": 1.5
},
"}\n)\n]",
{
"a": 6
},
"M"
],
[
{
"y": -0.875,
"f": 3,
"a": 4,
"w": 1.5
},
"\n\n|\n\\",
{
"a": 6,
"f": 3
},
"X",
{
"x": 14.5,
"a": 4
},
"/\n?",
{
"a": 4,
"w": 1.5
},
"~\n`"
],
[
{
"y": -0.375,
"x": 3.5,
"a": 6
},
"E",
{
"x": 10.5
},
"T"
],
[
{
"y": -0.875,
"x": 2.5
},
"O",
{
"x": 1,
"n": true
},
"I",
{
"x": 8.5,
"n": true
},
"R",
{
"x": 1
},
"N"
],
[
{
"y": -0.875,
"x": 5.5
},
"U",
{
"x": 6.5
},
"D"
],
[
{
"y": -0.875,
"fa": [
6
],
"w": 1.5
},
"<i class='fa fa-arrows'></i>\n\nTab",
{
"f": 3
},
"A",
{
"x": 14.5,
"f": 3
},
"S",
{
"a": 4,
"fa": [
0,
0,
0,
0,
0,
0,
0,
6
],
"w": 1.5
},
"+\n="
],
[
{
"y": -0.625,
"x": 6.5,
"a": 7,
"f": 9,
"h": 1.5
},
"<i class='fa fa-columns'></i>",
{
"x": 4.5,
"h": 1.5
},
"<i class='fa fa-table'></i>"
],
[
{
"y": -0.75,
"x": 3.5,
"a": 4,
"f": 3
},
"\"\n'",
{
"x": 10.5,
"a": 6,
"f": 3
},
"V"
],
[
{
"y": -0.875,
"x": 2.5,
"a": 6
},
"Q",
{
"x": 1,
"a": 4
},
"<\n,",
{
"x": 8.5,
"a": 6
},
"K",
{
"x": 1
},
"Y"
],
[
{
"y": -0.875,
"x": 5.5,
"a": 4
},
">\n.",
{
"x": 6.5,
"a": 6
},
"B"
],
[
{
"y": -0.875,
"f": 9,
"w": 1.5,
"g": true
},
"",
{
"a": 6,
"f": 3,
"g": false
},
"Z",
{
"x": 14.5
},
"J",
{
"f": 9,
"g": true,
"w": 1.5,
"a": 4
},
""
],
[
{
"y": -0.375,
"x": 3.5,
"g": true,
"a": 7,
"f": 3
},
"",
{
"x": 10.5
},
""
],
[
{
"y": -0.875,
"x": 2.5
},
"",
{
"x": 1,
"g": false,
"a": 5
},
";\n:",
{
"x": 8.5
},
"_\n-",
{
"x": 1,
"g": true,
"a": 7
},
""
],
[
{
"y": -0.75,
"x": 0.5
},
"",
{},
"",
{
"x": 14.5
},
"",
{},
""
],
[
{
"r": 30,
"rx": 6.5,
"ry": 4.25,
"y": -1,
"x": 1,
"g": false
},
"Alt",
{
"a": 4,
"fa": [
0,
0,
0,
9
]
},
"\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
],
[
{
"a": 7,
"f": 9,
"h": 2
},
"<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
{
"h": 2
},
"<i class='fa fa-angle-double-up'></i>",
{
"f": 3
},
"Ctrl"
],
[
{
"x": 2
},
"ESC"
],
[
{
"r": -30,
"rx": 13,
"y": -1,
"x": -3,
"f": 2
},
"MEDIA",
{},
"DEL"
],
[
{
"x": -3
},
"HUN",
{
"f": 9,
"h": 2
},
"<i class='kb kb-Return-2'></i>",
{
"f": 3,
"h": 2
},
"SPC"
],
[
{
"x": -3,
"f": 2
},
"LEAD"
]
]

View file

@ -1,477 +0,0 @@
[
{
"backcolor": "#ffffff",
"name": "ErgoDox - algernon's layout: Heatmap",
"author": "Gergely Nagy <kbd@gergo.csillger.hu>",
"notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Tea",
"pcb": true,
"css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
},
[
{
"x": 3.5,
"fa": [
0,
0,
2
]
},
"*\n5\nF5",
{
"x": 10.5,
"a": 4,
"fa": [
0,
0,
2
]
},
"#\n4\nF4"
],
[
{
"y": -0.875,
"x": 2.5
},
"@\n7\nF7",
{
"x": 1
},
"^\n3\nF3",
{
"x": 8.5
},
"!\n2\nF2",
{
"x": 1
},
"&\n6\nF6"
],
[
{
"y": -0.875,
"x": 5.5
},
"$\n1\nF1",
{
"a": 7,
"f": 3
},
"F11",
{
"x": 4.5,
"f": 3
},
"Fx",
{
"a": 4,
"f": 3,
"fa": [
0,
0,
2
]
},
"%\n0\nF10"
],
[
{
"y": -0.875,
"f": 6,
"a": 6,
"w": 1.5
},
"<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
{
"f": 3,
"a": 4,
"fa": [
0,
0,
2
]
},
" \n9\nF9",
{
"x": 14.5
},
" \n8\nF8",
{
"a": 7,
"w": 1.5
},
"STENO"
],
[
{
"y": -0.375,
"x": 3.5,
"a": 4
},
">\n.",
{
"x": 10.5,
"a": 6
},
"C"
],
[
{
"y": -0.875,
"x": 2.5,
"a": 4
},
"<\n,",
{
"x": 1,
"a": 6
},
"P",
{
"x": 8.5
},
"G",
{
"x": 1
},
"R"
],
[
{
"y": -0.875,
"x": 5.5
},
"Y",
{
"a": 4,
"h": 1.5
},
"{\n(\n[",
{
"x": 4.5,
"h": 1.5
},
"}\n)\n]",
{
"a": 6
},
"F"
],
[
{
"y": -0.875,
"f": 3,
"a": 4,
"w": 1.5
},
"\n\n~\n`",
{
"a": 4,
"f": 3
},
"\"\n'",
{
"x": 14.5,
"a": 6
},
"L",
{
"a": 4,
"w": 1.5
},
"|\n\\"
],
[
{
"y": -0.375,
"x": 3.5,
"a": 6
},
"E",
{
"x": 10.5
},
"T"
],
[
{
"y": -0.875,
"x": 2.5
},
"O",
{
"x": 1,
"n": true
},
"U",
{
"x": 8.5,
"n": true
},
"H",
{
"x": 1
},
"N"
],
[
{
"y": -0.875,
"x": 5.5
},
"I",
{
"x": 6.5
},
"D"
],
[
{
"y": -0.875,
"fa": [
6
],
"w": 1.5
},
"<i class='fa fa-arrows'></i>\n\nTab",
{
"f": 3
},
"A",
{
"x": 14.5,
"f": 3
},
"S",
{
"a": 4,
"fa": [
0,
0,
0,
0,
0,
0,
0,
6
],
"w": 1.5
},
"+\n="
],
[
{
"y": -0.625,
"x": 6.5,
"a": 7,
"f": 9,
"h": 1.5
},
"<i class='fa fa-columns'></i>",
{
"x": 4.5,
"h": 1.5
},
"<i class='fa fa-table'></i>"
],
[
{
"y": -0.75,
"x": 3.5,
"f": 3,
"a": 6
},
"J",
{
"x": 10.5
},
"W"
],
[
{
"y": -0.875,
"x": 2.5
},
"Q",
{
"x": 1
},
"K",
{
"x": 8.5
},
"M",
{
"x": 1
},
"V"
],
[
{
"y": -0.875,
"x": 5.5
},
"X",
{
"x": 6.5
},
"B"
],
[
{
"y": -0.875,
"f": 9,
"w": 1.5
},
"\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{
"a": 4,
"f": 3
},
"?\n/",
{
"x": 14.5,
"a": 6
},
"Z",
{
"f": 9,
"w": 1.5
},
"<i class='kb kb-Multimedia-Stop'></i>"
],
[
{
"y": -0.375,
"x": 3.5,
"g": true,
"a": 7,
"f": 3
},
"",
{
"x": 10.5
},
""
],
[
{
"y": -0.875,
"x": 2.5
},
"",
{
"x": 1,
"g": false,
"a": 5
},
";\n:",
{
"x": 8.5
},
"_\n-",
{
"x": 1,
"g": true,
"a": 7
},
""
],
[
{
"y": -0.75,
"x": 0.5
},
"",
{},
"",
{
"x": 14.5
},
"",
{},
""
],
[
{
"r": 30,
"rx": 6.5,
"ry": 4.25,
"y": -1,
"x": 1,
"g": false
},
"Alt",
{
"a": 4,
"fa": [
0,
0,
0,
9
]
},
"\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
],
[
{
"a": 7,
"f": 9,
"h": 2
},
"<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
{
"h": 2
},
"<i class='fa fa-angle-double-up'></i>",
{
"f": 3
},
"Ctrl"
],
[
{
"x": 2
},
"ESC"
],
[
{
"r": -30,
"rx": 13,
"y": -1,
"x": -3,
"f": 2
},
"MEDIA",
{},
"DEL"
],
[
{
"x": -3
},
"LEAD",
{
"f": 9,
"h": 2
},
"<i class='kb kb-Return-2'></i>",
{
"f": 3,
"h": 2
},
"SPC"
],
[
{
"x": -3,
"f": 2
},
"HUN"
]
]

View file

@ -1,113 +0,0 @@
#!/bin/bash
set -e
LAST_APPSEL_START=0
cmd_wm () {
WIN="$(xdotool getactivewindow)"
wmctrl -i -r ${WIN} -b remove,maximized_vert,maximized_horz
xdotool windowsize ${WIN} 100% 100%
wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz
}
cmd_appsel_helper () {
rofi -show window
}
_cmd_appsel () {
wmctrl -x -a $1 || true
xdotool key Escape
}
cmd_appsel_music () {
wmctrl -x -a rhythmbox || wmctrl -x -a spotify || \
wmctrl -x -a banshee || wmctrl -x -a kodi || \
wmctrl -x -a plex || true
xdotool key Escape
}
cmd_appsel_slack () {
wmctrl -x -a slack || wmctrl -x -a Mstdn || true
xdotool key Escape
}
cmd_appsel_emacs () {
_cmd_appsel emacs
}
cmd_appsel_term () {
_cmd_appsel gnome-terminal
}
cmd_appsel_chrome () {
wmctrl -x -a chrom || wmctrl -x -a Chrome || true
xdotool key Escape
}
cmd_appsel_start () {
if [ ! -z "${DISABLE_APPSEL_START}" ]; then
return
fi
APPSEL_START=$(date +%s)
if [ $APPSEL_START -lt $(expr $LAST_APPSEL_START + 10) ]; then
return
fi
LAST_APPSEL_START=$APPSEL_START
notify-send -t 1000 "Please select an application!" -c device -u low \
-i /usr/share/icons/Adwaita/24x24/devices/video-display.png
}
cmd_appsel_social () {
# Save the current window
a=$(xdotool getactivewindow)
# Raise & Focus Mstdn & Tweetdeck
wmctrl -x -a trunk.mad-scientist.club.Google-chrome || true; wmctrl -x -a tweetdeck || true
# Focus the previously active window
xdotool windowfocus $a || true; xdotool windowactivate $a || true
xdotool key Escape
}
cmd_appsel_social2 () {
# Save the current window
a=$(xdotool getactivewindow)
# Raise & Focus Viber & Signal
wmctrl -x -a Viber || true; wmctrl -a Signal || true
# Focus the previously active window
xdotool windowfocus $a || true; xdotool windowactivate $a || true
xdotool key Escape
}
cmd_appsel_pwmgr () {
_cmd_appsel keepass
}
cmd_reflash () {
teensy_loader_cli -v -w ~/src/ext/qmk_firmware/algernon.hex --mcu atmega32u4 || true
}
cmd_help () {
cat <<EOF
Use the source, Luke!
EOF
}
while read l; do
case "$l" in
"CMD:"*)
;;
*)
continue
;;
esac
cmd="$(echo $l | cut -d: -f2-)"
echo "Got command: ${cmd}"
if type cmd_${cmd} >/dev/null 2>&1; then
cmd_${cmd}
fi
done

View file

@ -1,342 +0,0 @@
#! /usr/bin/env python3
import json
import os
import sys
import re
import argparse
import time
from math import floor
from os.path import dirname
from blessings import Terminal
class Heatmap(object):
coords = [
[
# Row 0
[ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
[ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
],
[
# Row 1
[ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
[ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
],
[
# Row 2
[12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
[ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
],
[
# Row 3
[17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
[13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
],
[
# Row 4
[20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
[19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [], [], [], []
],
[
# Row 5
[ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
[24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
],
]
def set_attr_at(self, block, n, attr, fn, val):
blk = self.heatmap[block][n]
if attr in blk:
blk[attr] = fn(blk[attr], val)
else:
blk[attr] = fn(None, val)
def coord(self, col, row):
return self.coords[row][col]
@staticmethod
def set_attr(orig, new):
return new
def set_bg(self, coords, color):
(block, n) = coords
self.set_attr_at(block, n, "c", self.set_attr, color)
#self.set_attr_at(block, n, "g", self.set_attr, False)
def set_tap_info(self, coords, count, cap):
(block, n) = coords
def _set_tap_info(o, _count, _cap):
ns = 4 - o.count ("\n")
return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
if not cap:
cap = 1
self.heatmap[block][n + 1] = _set_tap_info (self.heatmap[block][n + 1], count, cap)
@staticmethod
def heatmap_color (v):
colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
fb = 0
if v <= 0:
idx1, idx2 = 0, 0
elif v >= 1:
idx1, idx2 = len(colors) - 1, len(colors) - 1
else:
val = v * (len(colors) - 1)
idx1 = int(floor(val))
idx2 = idx1 + 1
fb = val - float(idx1)
r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
r, g, b = [x * 255 for x in (r, g, b)]
return "#%02x%02x%02x" % (int(r), int(g), int(b))
def __init__(self, layout):
self.log = {}
self.total = 0
self.max_cnt = 0
self.layout = layout
def update_log(self, coords):
(c, r) = coords
if not (c, r) in self.log:
self.log[(c, r)] = 0
self.log[(c, r)] = self.log[(c, r)] + 1
self.total = self.total + 1
if self.max_cnt < self.log[(c, r)]:
self.max_cnt = self.log[(c, r)]
def get_heatmap(self):
with open("%s/heatmap-layout.%s.json" % (dirname(sys.argv[0]), self.layout), "r") as f:
self.heatmap = json.load (f)
## Reset colors
for row in self.coords:
for coord in row:
if coord != []:
self.set_bg (coord, "#d9dae0")
for (c, r) in self.log:
coords = self.coord(c, r)
cap = self.max_cnt
if cap == 0:
cap = 1
v = float(self.log[(c, r)]) / cap
self.set_bg (coords, self.heatmap_color (v))
self.set_tap_info (coords, self.log[(c, r)], self.total)
return self.heatmap
def get_stats(self):
usage = [
# left hand
[0, 0, 0, 0, 0],
# right hand
[0, 0, 0, 0, 0]
]
finger_map = [0, 0, 1, 2, 3, 3, 3, 1, 1, 1, 2, 3, 4, 4]
for (c, r) in self.log:
if r == 5: # thumb cluster
if c <= 6: # left side
usage[0][4] = usage[0][4] + self.log[(c, r)]
else:
usage[1][0] = usage[1][0] + self.log[(c, r)]
elif r == 4 and (c == 4 or c == 9): # bottom row thumb keys
if c <= 6: # left side
usage[0][4] = usage[0][4] + self.log[(c, r)]
else:
usage[1][0] = usage[1][0] + self.log[(c, r)]
else:
fc = c
hand = 0
if fc >= 7:
hand = 1
fm = finger_map[fc]
usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
hand_usage = [0, 0]
for f in usage[0]:
hand_usage[0] = hand_usage[0] + f
for f in usage[1]:
hand_usage[1] = hand_usage[1] + f
total = self.total
if total == 0:
total = 1
stats = {
"total-keys": total,
"hands": {
"left": {
"usage": round(float(hand_usage[0]) / total * 100, 2),
"fingers": {
"pinky": 0,
"ring": 0,
"middle": 0,
"index": 0,
"thumb": 0,
}
},
"right": {
"usage": round(float(hand_usage[1]) / total * 100, 2),
"fingers": {
"thumb": 0,
"index": 0,
"middle": 0,
"ring": 0,
"pinky": 0,
}
},
}
}
hmap = ['left', 'right']
fmap = ['pinky', 'ring', 'middle', 'index', 'thumb',
'thumb', 'index', 'middle', 'ring', 'pinky']
for hand_idx in range(len(usage)):
hand = usage[hand_idx]
for finger_idx in range(len(hand)):
stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = round(float(hand[finger_idx]) / total * 100, 2)
return stats
def dump_all(out_dir, heatmaps):
stats = {}
t = Terminal()
t.clear()
sys.stdout.write("\x1b[2J\x1b[H")
print ('{t.underline}{outdir}{t.normal}\n'.format(t=t, outdir=out_dir))
keys = list(heatmaps.keys())
keys.sort()
for layer in keys:
if len(heatmaps[layer].log) == 0:
continue
with open ("%s/%s.json" % (out_dir, layer), "w") as f:
json.dump(heatmaps[layer].get_heatmap(), f)
stats[layer] = heatmaps[layer].get_stats()
left = stats[layer]['hands']['left']
right = stats[layer]['hands']['right']
print ('{t.bold}{layer}{t.normal} ({total:,} taps):'.format(t=t, layer=layer,
total=int(stats[layer]['total-keys'] / 2)))
print (('{t.underline} | ' + \
'left ({l[usage]:6.2f}%) | ' + \
'right ({r[usage]:6.2f}%) |{t.normal}').format(t=t, l=left, r=right))
print ((' {t.bright_magenta}pinky{t.white} | {left[pinky]:6.2f}% | {right[pinky]:6.2f}% |\n' + \
' {t.bright_cyan}ring{t.white} | {left[ring]:6.2f}% | {right[ring]:6.2f}% |\n' + \
' {t.bright_blue}middle{t.white} | {left[middle]:6.2f}% | {right[middle]:6.2f}% |\n' + \
' {t.bright_green}index{t.white} | {left[index]:6.2f}% | {right[index]:6.2f}% |\n' + \
' {t.bright_red}thumb{t.white} | {left[thumb]:6.2f}% | {right[thumb]:6.2f}% |\n' + \
'').format(left=left['fingers'], right=right['fingers'], t=t))
def process_line(line, heatmaps, opts, stamped_log = None):
m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
if not m:
return False
if stamped_log is not None:
if line.startswith("KL:"):
print ("%10.10f %s" % (time.time(), line),
file = stamped_log, end = '')
else:
print (line,
file = stamped_log, end = '')
stamped_log.flush()
(c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
if (c, r) not in opts.allowed_keys:
return False
heatmaps[l].update_log ((c, r))
return True
def setup_allowed_keys(opts):
if len(opts.only_key):
incmap={}
for v in opts.only_key:
m = re.search ('(\d+),(\d+)', v)
if not m:
continue
(c, r) = (int(m.group(1)), int(m.group(2)))
incmap[(c, r)] = True
else:
incmap={}
for r in range(0, 6):
for c in range(0, 14):
incmap[(c, r)] = True
for v in opts.ignore_key:
m = re.search ('(\d+),(\d+)', v)
if not m:
continue
(c, r) = (int(m.group(1)), int(m.group(2)))
del(incmap[(c, r)])
return incmap
def main(opts):
heatmaps = {"Dvorak": Heatmap("Dvorak"),
"ADORE": Heatmap("ADORE")
}
cnt = 0
out_dir = opts.outdir
if not os.path.exists(out_dir):
os.makedirs(out_dir)
opts.allowed_keys = setup_allowed_keys(opts)
if not opts.one_shot:
try:
with open("%s/stamped-log" % out_dir, "r") as f:
while True:
line = f.readline()
if not line:
break
if not process_line(line, heatmaps, opts):
continue
except Exception:
pass
stamped_log = open ("%s/stamped-log" % (out_dir), "a+")
else:
stamped_log = None
while True:
line = sys.stdin.readline()
if not line:
break
if not process_line(line, heatmaps, opts, stamped_log):
continue
cnt = cnt + 1
if opts.dump_interval != -1 and cnt >= opts.dump_interval and not opts.one_shot:
cnt = 0
dump_all(out_dir, heatmaps)
dump_all (out_dir, heatmaps)
if __name__ == "__main__":
parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
parser.add_argument ('outdir', action = 'store',
help = 'Output directory')
parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int,
default = 100, help = 'Dump stats and heatmap at every Nth event, -1 for dumping at EOF only')
parser.add_argument ('--ignore-key', dest = 'ignore_key', action = 'append', type = str,
default = [], help = 'Ignore the key at position (x, y)')
parser.add_argument ('--only-key', dest = 'only_key', action = 'append', type = str,
default = [], help = 'Only include key at position (x, y)')
parser.add_argument ('--one-shot', dest = 'one_shot', action = 'store_true',
help = 'Do not load previous data, and do not update it, either.')
args = parser.parse_args()
if len(args.ignore_key) and len(args.only_key):
print ("--ignore-key and --only-key are mutually exclusive, please only use one of them!",
file = sys.stderr)
sys.exit(1)
main(args)

View file

@ -1,106 +0,0 @@
#!/usr/bin/env python3
import sys
charmap = {
'9': [[1, 0]],
'7': [[2, 0]], '@': [[2, 5], [2, 0]],
'5': [[3, 0]], '*': [[2, 5], [3, 0]],
'3': [[4, 0]], '^': [[2, 5], [4, 0]],
'1': [[5, 0]], '$': [[2, 5], [5, 0]],
'0': [[8, 0]], '%': [[2, 5], [8, 0]],
'2': [[9, 0]], '!': [[2, 5], [9, 0]],
'4': [[10, 0]], '#': [[2, 5], [10, 0]],
'6': [[11, 0]], '&': [[2, 5], [11, 0]],
'8': [[12, 0]],
'\\': [[0, 1]], '|': [[2, 5], [0, 1]],
'x': [[1, 1]], 'X': [[2, 5], [1, 1]],
'w': [[2, 1]], 'W': [[2, 5], [2, 1]],
'c': [[3, 1]], 'C': [[2, 5], [3, 1]],
'h': [[4, 1]], 'H': [[2, 5], [4, 1]],
'f': [[5, 1]], 'F': [[2, 5], [5, 1]],
'[': [[6, 1]], '{': [[2, 5], [6, 1]], '(': [[6, 1], [6, 1]],
']': [[7, 1]], '}': [[2, 5], [7, 1]], ')': [[7, 1], [7, 1]],
'm': [[8, 1]], 'M': [[2, 5], [8, 1]],
'g': [[9, 1]], 'G': [[2, 5], [9, 1]],
'l': [[10, 1]], 'L': [[2, 5], [10, 1]],
'p': [[11, 1]], 'P': [[2, 5], [11, 1]],
'/': [[12, 1]], '?': [[2, 5], [12, 1]],
'`': [[13, 1]], '~': [[2, 5], [13, 1]],
'\t': [[0, 2]],
'a': [[1, 2]], 'A': [[2, 5], [1, 2]],
'o': [[2, 2]], 'O': [[2, 5], [2, 2]],
'e': [[3, 2]], 'E': [[2, 5], [3, 2]],
'i': [[4, 2]], 'I': [[2, 5], [4, 2]],
'u': [[5, 2]], 'U': [[2, 5], [5, 2]],
'd': [[8, 2]], 'D': [[2, 5], [8, 2]],
'r': [[9, 2]], 'R': [[2, 5], [9, 2]],
't': [[10, 2]], 'T': [[2, 5], [10, 2]],
'n': [[11, 2]], 'N': [[2, 5], [11, 2]],
's': [[12, 2]], 'S': [[2, 5], [12, 2]],
'=': [[13, 2]], '+': [[2, 5], [13, 2]],
'z': [[1, 3]], 'Z': [[2, 5], [1, 3]],
'q': [[2, 3]], 'Q': [[2, 5], [2, 3]],
'\'': [[3, 3]], '"': [[2, 5], [3, 3]],
',': [[4, 3]], '<': [[2, 5], [4, 3]],
'.': [[5, 3]], '>': [[2, 5], [5, 3]],
'b': [[8, 3]], 'B': [[2, 5], [8, 3]],
'k': [[9, 3]], 'K': [[2, 5], [9, 3]],
'v': [[10, 3]], 'V': [[2, 5], [10, 3]],
'y': [[11, 3]], 'Y': [[2, 5], [11, 3]],
'j': [[12, 3]], 'J': [[2, 5], [12, 3]],
':': [[4, 4]], ';': [[4, 4], [4, 4]],
'-': [[9, 4]], '_': [[2, 5], [9, 4]],
' ': [[10, 5]],
'\n': [[11, 5]],
## Layered things
# Hungarian
'á': [[9, 5], [1, 2]], 'Á': [[2, 5], [9, 5], [1, 2]],
'ó': [[9, 5], [2, 2]], 'Ó': [[2, 5], [9, 5], [2, 2]],
'ő': [[9, 5], [2, 1]], 'Ő': [[2, 5], [9, 5], [2, 1]],
'ö': [[9, 5], [2, 3]], 'Ö': [[2, 5], [9, 5], [2, 3]],
'é': [[9, 5], [3, 2]], 'É': [[2, 5], [9, 5], [3, 2]],
'ú': [[9, 5], [4, 2]], 'Ú': [[2, 5], [9, 5], [4, 2]],
'ű': [[9, 5], [4, 1]], 'Ű': [[2, 5], [9, 5], [4, 1]],
'ü': [[9, 5], [4, 3]], 'Ü': [[2, 5], [9, 5], [4, 3]],
'í': [[9, 5], [5, 2]], 'Í': [[2, 5], [9, 5], [5, 2]],
}
def lookup_char(layer, ch):
if ch in charmap:
return charmap[ch]
return None
def process_char(layer, ch, out=sys.stdout):
keys = lookup_char(layer, ch)
if not keys:
print ("Unknown char: %s" % ch, file=sys.stderr)
else:
for (c, r) in keys:
print ("KL: col=%d, row=%d, pressed=1, layer=%s" % (r, c, layer), file=out)
print ("KL: col=%d, row=%d, pressed=0, layer=%s" % (r, c, layer), file=out)
def process_file(fn, layer, out=sys.stdout):
with open(fn, "r") as f:
ch = f.read(1)
while ch:
process_char(layer, ch, out)
ch = f.read(1)
if sys.argv[1] == '-':
out='/dev/stdin'
else:
out=sys.argv[1]
if len(sys.argv) >= 2:
layer = 'ADORE'
else:
layer = sys.argv[2]
process_file(out, layer = layer)

View file

@ -164,7 +164,7 @@ LAYOUT_ergodox(
KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_FN4, KC_NO,
KC_NO, KC_NO,
KC_NO,
KC_C, KC_V, KC_NO,
// right hand

View file

@ -122,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_FN4, KC_NO,
KC_NO, KC_NO,
KC_NO,
KC_C, KC_V, KC_NO,
// right hand

View file

@ -55,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_F, KC_G, KC_C, KC_R, KC_L, LT(MEDIA, KC_BSLS),
KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
MEH_T(KC_NO), KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC,
ALT_T(KC_UP), KC_DOWN, KC_LBRC, KC_RBRC, KC_FN2,
ALT_T(KC_UP), KC_DOWN, KC_LBRC, KC_RBRC, KC_NO,
KC_PGUP, CTL_T(KC_ESC),
KC_PGDN,
LCTL(KC_B), LT(MEDIA, KC_TAB), LT(SYMBOLS, KC_ENT)

View file

@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN2,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
KC_LGUI, KC_RCTL,
KC_PGUP,
KC_PGDN, KC_ENT, KC_SPC

View file

@ -1,21 +1,20 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "keymap_colemak.h"
enum {
enum layer_names {
BASE = 0,
BASE_CM,
SYMB,
MACR
};
enum {
LWIN = 1,
PC1,
PC2,
PC3,
PC4
enum custom_keycodes {
LWIN = SAFE_RANGE,
KC_PC1,
KC_PC2,
KC_PC3,
KC_PC4
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -50,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_EQL,
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
KC_LALT, F(LWIN),
KC_LALT, LWIN,
KC_HOME,
SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
// right hand
@ -94,7 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D,
KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, KC_EQL,
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
KC_LALT, F(LWIN),
KC_LALT, LWIN,
KC_HOME,
SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
// right hand
@ -174,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MACR] = LAYOUT_ergodox(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO,
KC_NO, KC_PC1, KC_PC2, KC_PC3, KC_PC4, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS,KC_TRNS,
@ -192,72 +191,60 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
const uint16_t PROGMEM fn_actions[] = {
[LWIN] = ACTION_MACRO(LWIN),
[PC1] = ACTION_MACRO(PC1),
[PC2] = ACTION_MACRO(PC2),
[PC3] = ACTION_MACRO(PC3),
[PC4] = ACTION_MACRO(PC4)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
break;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LWIN:
if (record->event.pressed) {
register_code(KC_RSFT);
unregister_code(KC_RSFT);
tap_code(KC_RSFT);
register_code(KC_LGUI);
} else {
unregister_code(KC_LGUI);
}
break;
case PC1:
if (!record->event.pressed) {
return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(1), W(50), T(ENT), END);
return false;
case KC_PC1:
if (record->event.pressed) {
tap_code_delay(KC_SLCK, 50);
wait_ms(50);
tap_code_delay(KC_1, 50);
tap_code(KC_ENT);
}
break;
case PC2:
if (!record->event.pressed) {
return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(2), W(50), T(ENT), END);
return false;
case KC_PC2:
if (record->event.pressed) {
tap_code_delay(KC_SLCK, 50);
wait_ms(50);
tap_code_delay(KC_2, 50);
tap_code(KC_ENT);
}
break;
case PC3:
if (!record->event.pressed) {
return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(3), W(50), T(ENT), END);
return false;
case KC_PC3:
if (record->event.pressed) {
tap_code_delay(KC_SLCK, 50);
wait_ms(50);
tap_code_delay(KC_3, 50);
tap_code(KC_ENT);
}
break;
case PC4:
if (!record->event.pressed) {
return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(4), W(50), T(ENT), END);
return false;
case KC_PC4:
if (record->event.pressed) {
tap_code_delay(KC_SLCK, 50);
wait_ms(50);
tap_code_delay(KC_4, 50);
tap_code(KC_ENT);
}
break;
return false;
}
return MACRO_NONE;
return true;
}
// 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) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
switch (get_highest_layer(layer_state)) {
// TODO: Make this relevant to the ErgoDox EZ.
case SYMB:
ergodox_right_led_1_on();
@ -269,4 +256,4 @@ void matrix_scan_user(void) {
// none
break;
}
};
}

View file

@ -1,34 +1,12 @@
#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
enum layer_names {
BASE, // default layer
SYMB, // symbols layer
MDIA, // media layer
SPEC, // special layer
RBASE // reverse default layer
};
/*
* The Ordinary Layout for the Ergodox EZ keyboard, v5
@ -69,18 +47,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[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 ,KC_LBRC
,M(LSymb) ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G
KC_NO ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,KC_NO ,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 ,LSFT(KC_TAB)
,KC_LCTL ,MEH_T(KC_NO) ,ALL_T(KC_NO),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_RBRC ,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_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),KC_NO
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_RGUI ,KC_RALT,KC_HYPR,KC_MEH ,KC_RCTL
,KC_LEFT ,KC_RGHT
@ -116,9 +94,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,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_NO
,KC_NO
,KC_PLUS ,KC_EQL ,M(NotEq)
,KC_PLUS ,KC_EQL ,KC_NO
// 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
@ -127,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_NO ,KC_NO
,KC_NO
,M(DeRef) ,LSFT(KC_MINS),KC_MINS
,KC_NO ,LSFT(KC_MINS),KC_MINS
),
/******* Media Layer *******************************************************************************************************
@ -154,9 +132,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_POWER ,KC_NO ,KC_MS_U ,KC_NO ,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_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
@ -257,248 +235,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
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))) {
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)) {
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)) {
if (layer_state & (1UL<<MDIA)) {
ergodox_right_led_3_on();
} else {
ergodox_right_led_3_off();
}
};
}

View file

@ -1,34 +1,12 @@
#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
enum layer_names {
BASE, // default layer
SYMB, // symbols layer
MDIA, // media layer
SPEC, // special layer
RBASE // reverse default layer
};
/*
* The Ordinary Layout for the Ergodox EZ keyboard, v5
@ -69,18 +47,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[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_NO ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,LSFT(KC_TAB)
,KC_NO ,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_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
,KC_TAB ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),KC_NO
,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
@ -116,9 +94,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,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_NO
,KC_NO
,KC_PLUS ,KC_EQL ,M(NotEq)
,KC_PLUS ,KC_EQL ,KC_NO
// 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
@ -127,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_NO ,KC_NO
,KC_NO
,M(DeRef) ,LSFT(KC_MINS),KC_MINS
,KC_NO ,LSFT(KC_MINS),KC_MINS
),
/******* Media Layer *******************************************************************************************************
@ -154,9 +132,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_POWER ,KC_NO ,KC_MS_U ,KC_NO ,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_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
@ -257,248 +235,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
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))) {
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)) {
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)) {
if (layer_state & (1UL<<MDIA)) {
ergodox_right_led_3_on();
} else {
ergodox_right_led_3_off();
}
};
}

View file

@ -4,21 +4,17 @@
*/
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "timer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
enum layer_names {
BASE, // default layer
SYMB, // symbols
MDIA // media keys
};
#define BLINK_BASE 150U // timer threshold for blinking on MDIA layer
typedef enum onoff_t {OFF, ON} onoff;
#define caps_led_on ergodox_right_led_2_on
#define caps_led_off ergodox_right_led_2_off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
@ -45,18 +41,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, M(KC_Q), M(KC_W), M(KC_E), M(KC_R), M(KC_T), KC_LBRC,
M(KC_CAPS), M(KC_A), M(KC_S), M(KC_D), M(KC_F), M(KC_G),
KC_LSFT, M(KC_Z), M(KC_X), M(KC_C), M(KC_V), M(KC_B), MO(SYMB),
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, MO(SYMB),
KC_LCTL, KC_LALT, KC_LGUI, KC_LEFT, KC_RGHT,
KC_TRNS, F(1),
KC_TRNS, TG(SYMB),
KC_HOME,
KC_BSPC, KC_DEL, KC_END,
// right hand
KC_GRV, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
KC_RBRC, M(KC_Y), M(KC_U), M(KC_I), M(KC_O), M(KC_P), KC_BSLS,
M(KC_H), M(KC_J), M(KC_K), M(KC_L), KC_SCLN, KC_QUOT,
MO(SYMB), M(KC_N), M(KC_M), KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MO(SYMB), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_DOWN, KC_UP, KC_RCTL, KC_RGUI, KC_RALT,
KC_RALT, KC_RCTL,
KC_PGUP,
@ -91,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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,
F(3), F(2),
TG(SYMB),TG(MDIA),
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
@ -132,7 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO,
F(4), KC_NO,
TG(MDIA),KC_NO,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
@ -147,64 +143,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_ON(SYMB,ON_RELEASE), // FN1 - Enable Layer 1 (Symbols)
[2] = ACTION_LAYER_ON(MDIA,ON_RELEASE), // FN2 - Enable Layer 2 (Media)
[3] = ACTION_LAYER_OFF(SYMB,ON_RELEASE), // FN3 - Disable Layer 1 (Symbols)
[4] = ACTION_LAYER_OFF(MDIA,ON_RELEASE), // FN4 - Disable Layer 2 (MMedia)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
static onoff caps_state = OFF;
switch(id) {
case KC_CAPS:
if (record->event.pressed) {
// Toggle caps state;
if (caps_state == OFF) {
// Turn it on then!
caps_led_on();
caps_state = ON;
} else {
caps_led_off();
caps_state = OFF;
}
}
break;
default:
if (record->event.pressed) {
bool shifted = false;
if (caps_state == ON && get_mods() == 0) {
register_code(KC_LSFT);
shifted = true;
}
register_code(id);
if(shifted) {
unregister_code(KC_LSFT);
}
} else {
unregister_code(id);
}
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) {
uint8_t layer = biton32(layer_state);
uint8_t layer = get_highest_layer(layer_state);
static onoff board_led_state = OFF;
static uint16_t dt = 0;
static uint8_t oldlayer = 0;
if(oldlayer != layer) {
if (oldlayer != layer) {
// Layer was just toggled.
if(layer == BASE) {
if (layer == BASE) {
ergodox_board_led_off();
board_led_state = OFF;
} else {
@ -213,10 +162,10 @@ void matrix_scan_user(void) {
}
} else if (layer >= MDIA) {
// We need to do blinking.
if(timer_elapsed(dt) > BLINK_BASE) {
if (timer_elapsed(dt) > BLINK_BASE) {
// toggle
dt = timer_read();
if(board_led_state == OFF) {
if (board_led_state == OFF) {
ergodox_board_led_on();
board_led_state = ON;
} else {

View file

@ -164,7 +164,7 @@ LAYOUT_ergodox(
KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_FN4, KC_NO,
KC_NO, KC_NO,
KC_NO,
KC_C, KC_V, KC_NO,
// right hand

View file

@ -1,6 +1,4 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
@ -36,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC,
KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(SYMB),
F(0), KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN,
KC_NO, KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN,
LGUI(KC_LALT), KC_LALT,
KC_HOME,
KC_BSPC, KC_ESC, KC_END,
@ -45,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
TG(MDIA), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, F(1),
KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, KC_NO,
KC_RALT, KC_MPLY,
KC_PGUP,
KC_PGDN, KC_ENT, KC_SPC
@ -135,85 +133,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MACRO_TAP(0), // FN0 - Ctrl + a (For screen/tmux)
[1] = ACTION_MACRO_TAP(1) // FN1 - Ctrl + ` (For quake style console)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
{
switch(id) {
case 0:
if (record->event.pressed) {
if (record->tap.count) {
if (record->tap.interrupted) {
record->tap.count = 0;
// hold press action
register_code(KC_LCTL);
} else {
// tap press action
return MACRO( D(LCTL), T(A), U(LCTL), END );
}
} else {
// hold press action
register_code(KC_LCTL);
}
} else {
if (record->tap.count) {
// tap release action
} else {
// hold release action
unregister_code(KC_LCTL);
}
record->tap.count = 0;
}
break;
case 1:
if (record->event.pressed) {
if (record->tap.count) {
if (record->tap.interrupted) {
record->tap.count = 0;
// hold press action
register_code(KC_RCTL);
} else {
// tap press action
return MACRO( DOWN(KC_RCTL), TYPE(KC_GRV), UP(KC_RCTL), END );
}
} else {
// hold press action
register_code(KC_RCTL);
}
} else {
if (record->tap.count) {
// tap release action
} else {
// hold release action
unregister_code(KC_RCTL);
}
record->tap.count = 0;
}
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) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
switch (get_highest_layer(layer_state)) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
@ -225,5 +152,4 @@ void matrix_scan_user(void) {
// none
break;
}
};
}

View file

@ -1,28 +1,11 @@
#include QMK_KEYBOARD_H
#include "led.h"
#include "debug.h"
#include "action_layer.h"
#include "action_util.h"
#include "mousekey.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols layer
#define MDIA 2 // media layer
#define SPEC 3 // special layer
#define LCaps 10 // left caps-shift key
#define LSymb 11 // left symbol-shift key
#define LMdia 12 // left media-shift key
#define LSpec 13 // left special-shift key
#define RCaps 14 // right caps-shift key
#define RSymb 15 // right symbol-shift key
#define RMdia 16 // right media-shift key
#define RSpec 17 // right special-shift key
#define MUL 20 // mouse up left
#define MUR 21 // mouse up right
#define MDL 22 // mouse down left
#define MDR 23 // mouse down right
enum layer_names {
BASE, // default layer
SYMB, // symbols layer
MDIA, // media layer
SPEC // special layer
};
/*
* teckinesis layout for ErgoDox (EZ)
@ -62,19 +45,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[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 ,KC_LBRC
,M(LSymb) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,M(LCaps) ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
KC_NO ,KC_1,KC_2,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,KC_NO ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_NO ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL,MEH_T(KC_BSLS),ALL_T(KC_SLSH),KC_LALT,KC_LGUI
,KC_HOME,KC_END
,KC_PGUP
,KC_BSPC,KC_DEL ,KC_PGDN
// right hand
,KC_GRV ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia)
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,F(RSymb)
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,M(RCaps)
,KC_GRV ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_NO
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_NO
,KC_RGUI,KC_RALT,ALL_T(KC_LBRC),MEH_T(KC_RBRC),KC_RCTL
,KC_LEFT ,KC_RGHT
,KC_UP
@ -147,9 +130,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MDIA] = LAYOUT_ergodox(
// left hand
KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC
,KC_TRNS ,KC_NO ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U
,KC_TRNS ,KC_NO ,KC_NO ,KC_MS_U ,KC_NO ,KC_VOLU ,KC_WH_U
,KC_TRNS ,KC_NO ,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_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
,KC_LCTL ,KC_MEH ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
@ -210,246 +193,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
const uint16_t PROGMEM fn_actions[] = {
// the faux shift keys are implemented as macro taps
[LCaps] = ACTION_MACRO_TAP(LCaps)
,[LSymb] = ACTION_MACRO_TAP(LSymb)
,[LMdia] = ACTION_MACRO_TAP(LMdia)
,[LSpec] = ACTION_MACRO_TAP(LSpec)
,[RCaps] = ACTION_MACRO_TAP(RCaps)
,[RSymb] = ACTION_MACRO_TAP(RSymb)
,[RMdia] = ACTION_MACRO_TAP(RMdia)
,[RSpec] = ACTION_MACRO_TAP(RSpec)
};
uint16_t caps_shift = 0;
uint16_t symb_shift = 0;
uint16_t mdia_shift = 0;
bool symb_lock = false;
bool mdia_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. If both are pressed at the same time
// then the layer is locked (or unlocked). 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 LCaps: // both caps-shift keys trigger Left Shift
case RCaps: // so they don't interfere with the magic combo
if (record->event.pressed && !record->tap.count) {
if(++caps_shift > 2) caps_shift = 2;
if(caps_shift == 2) {
register_code(KC_CAPS);
unregister_code(KC_CAPS);
} else if(caps_shift == 1) {
register_code(KC_LSFT);
}
} else {
if(--caps_shift < 0) caps_shift = 0;
if(caps_shift == 0) unregister_code(KC_LSFT);
}
break;
case LSymb:
if (record->event.pressed) {
if(++symb_shift > 2) symb_shift = 2;
if(symb_shift == 2) {
symb_lock = !symb_lock;
} else if(symb_shift == 1) {
layer_on(SYMB);
}
} else {
if(--symb_shift < 0) symb_shift = 0;
if((symb_shift == 0) && (!symb_lock)) layer_off(SYMB);
}
break;
case LMdia:
if (record->event.pressed) {
if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
register_code(KC_TAB);
} else {
if(++mdia_shift > 2) mdia_shift = 2;
if(mdia_shift == 2) {
mdia_lock = !mdia_lock;
} else if(mdia_shift == 1) {
layer_on(MDIA);
}
}
} else {
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
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) {
if (record->tap.count && !record->tap.interrupted) {
register_code(KC_EQL);
} else {
layer_on(SPEC);
}
} else {
if(record->tap.count && !record->tap.interrupted) {
unregister_code(KC_EQL);
} else {
layer_off(SPEC);
}
}
break;
case RSymb:
if (record->event.pressed) {
if (record->tap.count && (!symb_shift) && (!symb_lock)) {
register_code(KC_QUOT);
} else {
if(++symb_shift > 2) symb_shift = 2;
if(symb_shift == 2) {
symb_lock = !symb_lock;
} else if(symb_shift == 1) {
layer_on(SYMB);
}
}
} else {
if(record->tap.count && symb_shift == 0) {
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)) {
register_code(KC_BSLS);
} else {
if(++mdia_shift > 2) mdia_shift = 2;
if(mdia_shift == 2) {
mdia_lock = !mdia_lock;
} else if(mdia_shift == 1) {
layer_on(MDIA);
}
}
} else {
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
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 (record->tap.count && !record->tap.interrupted) {
register_code(KC_MINS);
} else {
layer_on(SPEC);
}
} else {
if(record->tap.count && !record->tap.interrupted) {
unregister_code(KC_MINS);
} else {
layer_off(SPEC);
}
}
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(caps_shift || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
if((keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_led_state().caps_lock)) {
ergodox_right_led_1_on();
} else {
ergodox_right_led_1_off();
}
// Symbol layer turns on green light
if(layer_state & (1UL<<SYMB)) {
if(IS_LAYER_ON(SYMB)) {
ergodox_right_led_2_on();
} else {
ergodox_right_led_2_off();
}
// Media layer turns on blue light
if(layer_state & (1UL<<MDIA)) {
if(IS_LAYER_ON(MDIA)) {
ergodox_right_led_3_on();
} else {
ergodox_right_led_3_off();
}
};
}

View file

@ -1,6 +1,5 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
// readme
// This keyboard layout is based on the [Workman Dead layout](https://github.com/ojbucao/Workman/tree/master/mac#workman-dead-for-programmers), which uses the comma as a dead key to trigger a second layer.
// Since I have more keys at my disposal on the ErgoDox, I moved the dead key to the bottom right. There are still a lot of
@ -9,12 +8,46 @@
// triggers the key you pressed AND switches the layout back to the original. For now I do this with a super kludgey macro and I
// look forward to learning about a more elegant way to do the same thing. Until then, this will have to do.
enum layer_names {
BASE, // default layer
SYMB, // symbols
MDIA, // media keys
DEAD // dead version of the symbols layer
};
// TODO: Define layer names that make sense for the ErgoDox EZ.
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define DEAD 3 // dead version of the symbols layer
enum custom_keycodes {
M_100 = SAFE_RANGE,
M_101,
M_102,
M_103,
M_104,
M_105,
M_106,
M_107,
M_108,
M_109,
M_110,
M_111,
M_112,
M_113,
M_114,
M_115,
M_116,
M_117,
M_118,
M_119,
M_120,
M_121,
M_122,
M_123,
M_124,
M_125,
M_126,
M_127,
M_128,
M_129,
M_130
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@ -43,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(1),
KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(SYMB),
ALL_T(KC_ESC), KC_A, KC_S, KC_H, KC_T, KC_G,
KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_NO,
KC_NO, KC_NO, KC_LCTL,KC_LALT,KC_LGUI,
@ -52,10 +85,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_BSPC,KC_SPC,KC_END,
// right hand
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
TG(1), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS,
TG(SYMB), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS,
KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT,
MEH_T(KC_NO),KC_K, KC_L, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, F(4),
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, TG(DEAD),
KC_NO, KC_NO,
KC_PGUP,
KC_PGDN,KC_SPC,KC_ENT
@ -168,18 +201,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[DEAD] = LAYOUT_ergodox(
// left hand
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS, M(100), M(101), M(102), M(103), M(104), KC_TRNS,
KC_TRNS, M(109), M(110), M(111), M(112), M(113),
KC_TRNS, M(120), M(121), M(122), M(123), M(124), KC_TRNS,
KC_TRNS, M_100, M_101, M_102, M_103, M_104, KC_TRNS,
KC_TRNS, M_109, M_110, M_111, M_112, M_113,
KC_TRNS, M_120, M_121, M_122, M_123, M_124, 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_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, M(105), M(106), M(107), M(108), M(130), KC_F12,
M(114), M(115), M(116), M(117), M(118), M(119),
KC_TRNS, M(125), M(126), M(127), M(128), M(129), KC_TRNS,
KC_TRNS, M_105, M_106, M_107, M_108, M_130, KC_F12,
M_114, M_115, M_116, M_117, M_118, M_119,
KC_TRNS, M_125, M_126, M_127, M_128, M_129, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
@ -187,169 +220,181 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_LAYER_ON(BASE,0), // FN2 - Go back to the base layer
[3] = ACTION_LAYER_ON(DEAD,0),
[4] = ACTION_LAYER_TOGGLE(DEAD),
};
void tap_dead_code(uint16_t keycode) {
layer_clear();
tap_code16(keycode);
layer_on(DEAD);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case M_100:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
tap_dead_code(S(KC_5));
}
break;
case 100:
layer_clear();
return MACRODOWN(D(LSFT), T(5), U(LSFT), T(FN4), END);
break;
case 101:
layer_clear();
return MACRODOWN(D(LSFT), T(7), U(LSFT), T(FN4), END);
break;
case 102:
layer_clear();
return MACRODOWN(D(LSFT), T(SLSH), U(LSFT), T(FN4), END);
break;
case 103:
layer_clear();
return MACRODOWN(D(LSFT), T(EQL), U(LSFT), T(FN4), END);
break;
case 104:
layer_clear();
return MACRODOWN(D(LSFT), T(2), U(LSFT), T(FN4), END);
break;
case 105:
layer_clear();
return MACRODOWN(D(LSFT), T(4), U(LSFT), T(FN4), END);
break;
case 106:
layer_clear();
return MACRODOWN(D(LSFT), T(MINS), U(LSFT), T(FN4), END);
break;
case 107:
layer_clear();
return MACRODOWN(T(LBRC), T(FN4), END);
break;
case 108:
layer_clear();
return MACRODOWN(T(RBRC), T(FN4), END);
break;
case 130:
layer_clear();
return MACRODOWN(D(LSFT), T(1), U(LSFT), T(FN4), END);
break;
case 109:
layer_clear();
return MACRODOWN(T(SLSH), T(FN4), END);
break;
case 110:
layer_clear();
return MACRODOWN(D(LSFT), T(9), U(LSFT), T(FN4), END);
break;
case 111:
layer_clear();
return MACRODOWN(T(EQL), T(FN4), END);
break;
case 112:
layer_clear();
return MACRODOWN(T(0), T(FN4), END);
break;
case 113:
layer_clear();
return MACRODOWN(D(LSFT), T(LBRC), U(LSFT), T(FN4), END);
break;
case 114:
layer_clear();
return MACRODOWN(D(LSFT), T(RBRC), U(LSFT), T(FN4), END);
break;
case 115:
layer_clear();
return MACRODOWN(T(1), T(FN4), END);
break;
case 116:
layer_clear();
return MACRODOWN(D(LSFT), T(8), U(LSFT), T(FN4), END);
break;
case 117:
layer_clear();
return MACRODOWN(D(LSFT), T(0), U(LSFT), T(FN4), END);
break;
case 118:
layer_clear();
return MACRODOWN(T(MINS), T(FN4), END);
break;
case 119:
layer_clear();
return MACRODOWN(D(LSFT), T(QUOT), U(LSFT), T(FN4), END);
break;
case 120:
layer_clear();
return MACRODOWN(T(6), T(FN4), END);
break;
case 121:
layer_clear();
return MACRODOWN(T(7), T(FN4), END);
break;
case 122:
layer_clear();
return MACRODOWN(T(8), T(FN4), END);
break;
case 123:
layer_clear();
return MACRODOWN(T(9), T(FN4), END);
break;
case 124:
layer_clear();
return MACRODOWN(D(LSFT), T(BSLS), U(LSFT), T(FN4), END);
break;
case 125:
layer_clear();
return MACRODOWN(T(BSLS), T(FN4), END);
break;
case 126:
layer_clear();
return MACRODOWN(T(2), T(FN4), END);
break;
case 127:
layer_clear();
return MACRODOWN(T(3), T(FN4), END);
break;
case 128:
layer_clear();
return MACRODOWN(T(4), T(FN4), END);
break;
case 129:
layer_clear();
return MACRODOWN(T(5), T(FN4), END);
break;
default:
return MACRO_NONE;
return false;
case M_101:
if (record->event.pressed) {
tap_dead_code(S(KC_7));
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
return false;
case M_102:
if (record->event.pressed) {
tap_dead_code(S(KC_SLSH));
}
return false;
case M_103:
if (record->event.pressed) {
tap_dead_code(S(KC_EQL));
}
return false;
case M_104:
if (record->event.pressed) {
tap_dead_code(S(KC_2));
}
return false;
case M_105:
if (record->event.pressed) {
tap_dead_code(S(KC_4));
}
return false;
case M_106:
if (record->event.pressed) {
tap_dead_code(S(KC_MINS));
}
return false;
case M_107:
if (record->event.pressed) {
tap_dead_code(KC_LBRC);
}
return false;
case M_108:
if (record->event.pressed) {
tap_dead_code(KC_RBRC);
}
return false;
case M_109:
if (record->event.pressed) {
tap_dead_code(KC_SLSH);
}
return false;
case M_110:
if (record->event.pressed) {
tap_dead_code(S(KC_9));
}
return false;
case M_111:
if (record->event.pressed) {
tap_dead_code(KC_EQL);
}
return false;
case M_112:
if (record->event.pressed) {
tap_dead_code(KC_0);
}
return false;
case M_113:
if (record->event.pressed) {
tap_dead_code(S(KC_LBRC));
}
return false;
case M_114:
if (record->event.pressed) {
tap_dead_code(S(KC_RBRC));
}
return false;
case M_115:
if (record->event.pressed) {
tap_dead_code(KC_1);
}
return false;
case M_116:
if (record->event.pressed) {
tap_dead_code(S(KC_8));
}
return false;
case M_117:
if (record->event.pressed) {
tap_dead_code(S(KC_0));
}
return false;
case M_118:
if (record->event.pressed) {
tap_dead_code(KC_MINS);
}
return false;
case M_119:
if (record->event.pressed) {
tap_dead_code(S(KC_QUOT));
}
return false;
case M_120:
if (record->event.pressed) {
tap_dead_code(KC_6);
}
return false;
case M_121:
if (record->event.pressed) {
tap_dead_code(KC_7);
}
return false;
case M_122:
if (record->event.pressed) {
tap_dead_code(KC_8);
}
return false;
case M_123:
if (record->event.pressed) {
tap_dead_code(KC_9);
}
return false;
case M_124:
if (record->event.pressed) {
tap_dead_code(S(KC_BSLS));
}
return false;
case M_125:
if (record->event.pressed) {
tap_dead_code(KC_BSLS);
}
return false;
case M_126:
if (record->event.pressed) {
tap_dead_code(KC_2);
}
return false;
case M_127:
if (record->event.pressed) {
tap_dead_code(KC_3);
}
return false;
case M_128:
if (record->event.pressed) {
tap_dead_code(KC_4);
}
return false;
case M_129:
if (record->event.pressed) {
tap_dead_code(KC_5);
}
return false;
case M_130:
if (record->event.pressed) {
tap_dead_code(S(KC_1));
}
return false;
}
return true;
}
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
switch (get_highest_layer(layer_state)) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
@ -361,5 +406,4 @@ void matrix_scan_user(void) {
// none
break;
}
};
}