aboutsummaryrefslogtreecommitdiff
path: root/layouts/community/ergodox/algernon
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/community/ergodox/algernon')
-rw-r--r--layouts/community/ergodox/algernon/COPYING674
-rw-r--r--layouts/community/ergodox/algernon/NEWS.md189
-rw-r--r--layouts/community/ergodox/algernon/config.h27
-rw-r--r--layouts/community/ergodox/algernon/keymap.c1108
-rw-r--r--layouts/community/ergodox/algernon/readme.md149
-rw-r--r--layouts/community/ergodox/algernon/rules.mk43
-rw-r--r--layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json486
-rw-r--r--layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json477
-rw-r--r--layouts/community/ergodox/algernon/tools/hid-commands80
-rw-r--r--layouts/community/ergodox/algernon/tools/log-to-heatmap.py344
-rw-r--r--layouts/community/ergodox/algernon/tools/text-to-log.py107
11 files changed, 3684 insertions, 0 deletions
diff --git a/layouts/community/ergodox/algernon/COPYING b/layouts/community/ergodox/algernon/COPYING
new file mode 100644
index 000000000..94a9ed024
--- /dev/null
+++ b/layouts/community/ergodox/algernon/COPYING
@@ -0,0 +1,674 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The GNU General Public License is a free, copyleft license for
11software and other kinds of works.
12
13 The licenses for most software and other practical works are designed
14to take away your freedom to share and change the works. By contrast,
15the GNU General Public License is intended to guarantee your freedom to
16share and change all versions of a program--to make sure it remains free
17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
20your programs, too.
21
22 When we speak of free software, we are referring to freedom, not
23price. Our General Public Licenses are designed to make sure that you
24have the freedom to distribute copies of free software (and charge for
25them if you wish), that you receive source code or can get it if you
26want it, that you can change the software or use pieces of it in new
27free programs, and that you know you can do these things.
28
29 To protect your rights, we need to prevent others from denying you
30these rights or asking you to surrender the rights. Therefore, you have
31certain responsibilities if you distribute copies of the software, or if
32you modify it: responsibilities to respect the freedom of others.
33
34 For example, if you distribute copies of such a program, whether
35gratis or for a fee, you must pass on to the recipients the same
36freedoms that you received. You must make sure that they, too, receive
37or can get the source code. And you must show them these terms so they
38know their rights.
39
40 Developers that use the GNU GPL protect your rights with two steps:
41(1) assert copyright on the software, and (2) offer you this License
42giving you legal permission to copy, distribute and/or modify it.
43
44 For the developers' and authors' protection, the GPL clearly explains
45that there is no warranty for this free software. For both users' and
46authors' sake, the GPL requires that modified versions be marked as
47changed, so that their problems will not be attributed erroneously to
48authors of previous versions.
49
50 Some devices are designed to deny users access to install or run
51modified versions of the software inside them, although the manufacturer
52can do so. This is fundamentally incompatible with the aim of
53protecting users' freedom to change the software. The systematic
54pattern of such abuse occurs in the area of products for individuals to
55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
67
68 The precise terms and conditions for copying, distribution and
69modification follow.
70
71 TERMS AND CONDITIONS
72
73 0. Definitions.
74
75 "This License" refers to version 3 of the GNU General Public License.
76
77 "Copyright" also means copyright-like laws that apply to other kinds of
78works, such as semiconductor masks.
79
80 "The Program" refers to any copyrightable work licensed under this
81License. Each licensee is addressed as "you". "Licensees" and
82"recipients" may be individuals or organizations.
83
84 To "modify" a work means to copy from or adapt all or part of the work
85in a fashion requiring copyright permission, other than the making of an
86exact copy. The resulting work is called a "modified version" of the
87earlier work or a work "based on" the earlier work.
88
89 A "covered work" means either the unmodified Program or a work based
90on the Program.
91
92 To "propagate" a work means to do anything with it that, without
93permission, would make you directly or secondarily liable for
94infringement under applicable copyright law, except executing it on a
95computer or modifying a private copy. Propagation includes copying,
96distribution (with or without modification), making available to the
97public, and in some countries other activities as well.
98
99 To "convey" a work means any kind of propagation that enables other
100parties to make or receive copies. Mere interaction with a user through
101a computer network, with no transfer of a copy, is not conveying.
102
103 An interactive user interface displays "Appropriate Legal Notices"
104to the extent that it includes a convenient and prominently visible
105feature that (1) displays an appropriate copyright notice, and (2)
106tells the user that there is no warranty for the work (except to the
107extent that warranties are provided), that licensees may convey the
108work under this License, and how to view a copy of this License. If
109the interface presents a list of user commands or options, such as a
110menu, a prominent item in the list meets this criterion.
111
112 1. Source Code.
113
114 The "source code" for a work means the preferred form of the work
115for making modifications to it. "Object code" means any non-source
116form of a work.
117
118 A "Standard Interface" means an interface that either is an official
119standard defined by a recognized standards body, or, in the case of
120interfaces specified for a particular programming language, one that
121is widely used among developers working in that language.
122
123 The "System Libraries" of an executable work include anything, other
124than the work as a whole, that (a) is included in the normal form of
125packaging a Major Component, but which is not part of that Major
126Component, and (b) serves only to enable use of the work with that
127Major Component, or to implement a Standard Interface for which an
128implementation is available to the public in source code form. A
129"Major Component", in this context, means a major essential component
130(kernel, window system, and so on) of the specific operating system
131(if any) on which the executable work runs, or a compiler used to
132produce the work, or an object code interpreter used to run it.
133
134 The "Corresponding Source" for a work in object code form means all
135the source code needed to generate, install, and (for an executable
136work) run the object code and to modify the work, including scripts to
137control those activities. However, it does not include the work's
138System Libraries, or general-purpose tools or generally available free
139programs which are used unmodified in performing those activities but
140which are not part of the work. For example, Corresponding Source
141includes interface definition files associated with source files for
142the work, and the source code for shared libraries and dynamically
143linked subprograms that the work is specifically designed to require,
144such as by intimate data communication or control flow between those
145subprograms and other parts of the work.
146
147 The Corresponding Source need not include anything that users
148can regenerate automatically from other parts of the Corresponding
149Source.
150
151 The Corresponding Source for a work in source code form is that
152same work.
153
154 2. Basic Permissions.
155
156 All rights granted under this License are granted for the term of
157copyright on the Program, and are irrevocable provided the stated
158conditions are met. This License explicitly affirms your unlimited
159permission to run the unmodified Program. The output from running a
160covered work is covered by this License only if the output, given its
161content, constitutes a covered work. This License acknowledges your
162rights of fair use or other equivalent, as provided by copyright law.
163
164 You may make, run and propagate covered works that you do not
165convey, without conditions so long as your license otherwise remains
166in force. You may convey covered works to others for the sole purpose
167of having them make modifications exclusively for you, or provide you
168with facilities for running those works, provided that you comply with
169the terms of this License in conveying all material for which you do
170not control copyright. Those thus making or running the covered works
171for you must do so exclusively on your behalf, under your direction
172and control, on terms that prohibit them from making any copies of
173your copyrighted material outside their relationship with you.
174
175 Conveying under any other circumstances is permitted solely under
176the conditions stated below. Sublicensing is not allowed; section 10
177makes it unnecessary.
178
179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
181 No covered work shall be deemed part of an effective technological
182measure under any applicable law fulfilling obligations under article
18311 of the WIPO copyright treaty adopted on 20 December 1996, or
184similar laws prohibiting or restricting circumvention of such
185measures.
186
187 When you convey a covered work, you waive any legal power to forbid
188circumvention of technological measures to the extent such circumvention
189is effected by exercising rights under this License with respect to
190the covered work, and you disclaim any intention to limit operation or
191modification of the work as a means of enforcing, against the work's
192users, your or third parties' legal rights to forbid circumvention of
193technological measures.
194
195 4. Conveying Verbatim Copies.
196
197 You may convey verbatim copies of the Program's source code as you
198receive it, in any medium, provided that you conspicuously and
199appropriately publish on each copy an appropriate copyright notice;
200keep intact all notices stating that this License and any
201non-permissive terms added in accord with section 7 apply to the code;
202keep intact all notices of the absence of any warranty; and give all
203recipients a copy of this License along with the Program.
204
205 You may charge any price or no price for each copy that you convey,
206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
485this License.
486
487 Each contributor grants you a non-exclusive, worldwide, royalty-free
488patent license under the contributor's essential patent claims, to
489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
543otherwise) that contradict the conditions of this License, they do not
544excuse you from the conditions of this License. If you cannot convey a
545covered work so as to satisfy simultaneously your obligations under this
546License and any other pertinent obligations, then as a consequence you may
547not convey it at all. For example, if you agree to terms that obligate you
548to collect a royalty for further conveying from those to whom you convey
549the Program, the only way you could satisfy both those terms and this
550License would be to refrain entirely from conveying the Program.
551
552 13. Use with the GNU Affero General Public License.
553
554 Notwithstanding any other provision of this License, you have
555permission to link or combine any covered work with a work licensed
556under version 3 of the GNU Affero General Public License into a single
557combined work, and to convey the resulting work. The terms of this
558License will continue to apply to the part which is the covered work,
559but the special requirements of the GNU Affero General Public License,
560section 13, concerning interaction through a network will apply to the
561combination as such.
562
563 14. Revised Versions of this License.
564
565 The Free Software Foundation may publish revised and/or new versions of
566the GNU General Public License from time to time. Such new versions will
567be similar in spirit to the present version, but may differ in detail to
568address new problems or concerns.
569
570 Each version is given a distinguishing version number. If the
571Program specifies that a certain numbered version of the GNU General
572Public License "or any later version" applies to it, you have the
573option of following the terms and conditions either of that numbered
574version or of any later version published by the Free Software
575Foundation. If the Program does not specify a version number of the
576GNU General Public License, you may choose any version ever published
577by the Free Software Foundation.
578
579 If the Program specifies that a proxy can decide which future
580versions of the GNU General Public License can be used, that proxy's
581public statement of acceptance of a version permanently authorizes you
582to choose that version for the Program.
583
584 Later license versions may give you additional or different
585permissions. However, no additional obligations are imposed on any
586author or copyright holder as a result of your choosing to follow a
587later version.
588
589 15. Disclaimer of Warranty.
590
591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
600 16. Limitation of Liability.
601
602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615above cannot be given local legal effect according to their terms,
616reviewing courts shall apply local law that most closely approximates
617an absolute waiver of all civil liability in connection with the
618Program, unless a warranty or assumption of liability accompanies a
619copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
624
625 If you develop a new program, and you want it to be of the greatest
626possible use to the public, the best way to achieve this is to make it
627free software which everyone can redistribute and change under these terms.
628
629 To do so, attach the following notices to the program. It is safest
630to attach them to the start of each source file to most effectively
631state the exclusion of warranty; and each file should have at least
632the "copyright" line and a pointer to where the full notice is found.
633
634 <one line to give the program's name and a brief idea of what it does.>
635 Copyright (C) <year> <name of author>
636
637 This program is free software: you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
640 (at your option) any later version.
641
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
646
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
649
650Also add information on how to contact you by electronic and paper mail.
651
652 If the program does terminal interaction, make it output a short
653notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 This is free software, and you are welcome to redistribute it
658 under certain conditions; type `show c' for details.
659
660The hypothetical commands `show w' and `show c' should show the appropriate
661parts of the General Public License. Of course, your program's commands
662might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665if any, to sign a "copyright disclaimer" for the program, if necessary.
666For more information on this, and how to apply and follow the GNU GPL, see
667<http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670into proprietary programs. If your program is a subroutine library, you
671may consider it more useful to permit linking proprietary applications with
672the library. If this is what you want to do, use the GNU Lesser General
673Public License instead of this License. But first, please read
674<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/layouts/community/ergodox/algernon/NEWS.md b/layouts/community/ergodox/algernon/NEWS.md
new file mode 100644
index 000000000..ee9d60670
--- /dev/null
+++ b/layouts/community/ergodox/algernon/NEWS.md
@@ -0,0 +1,189 @@
1<!-- -*- mode: markdown; fill-column: 8192 -*- -->
2
3## v1.10
4
5*2016-12-28*
6
7### Miscellaneous
8
9* `µ` can now be entered with UCIS.
10* `™` can now be entered with UCIS.
11
12### Tools
13
14* `tools/hid-commands` can now find Banshee, and prefers it over Kodi.
15* `tools/hid-commands` can now find Chrome too, not juts Chromium.
16
17## v1.9
18
19*2016-10-16*
20
21### Overall changes
22
23* `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.
24
25### Base layer changes
26
27* The `Media Stop` key is now a tap-dance key, and resets the device for programming on the fourth tap.
28
29### Miscellaneous
30
31* `π` can now be entered with UCIS.
32* `🐁` can now be entered with UCIS.
33
34### Tools
35
36* The `tools/layer-notify` tool was removed, it was an example, which I don't use.
37
38#### `tools/hid-commands`
39
40* Now looks at the `DISABLE_APPSEL_START` environment value, and does not display an AppSel notification if it is non-empty.
41* Will attempt to re-program the keyboard when receiving a `reflash` command.
42* No longer tries to select Emacs 24 on `APPSEL_EMACS`, rather, it goes for any Emacs.
43* The `APPSEL_MUSIC` command now includes Kodi in the list too, as the last choice.
44
45## v1.8
46
47*2016-10-03*
48
49### ADORE
50
51* Major rearrangements were made, to reduce pinky use, and to balance out the hand usage.
52
53### Tools
54
55* The `hid-commands` tool will now display a notification when the **AppSel** layer is triggered.
56* The `log-to-heatmap.py` tool now treats the innermost keys on the bottom row as thumb keys, as far as statistics are concerned.
57
58### Miscellaneous
59
60* Fixed the **Steno** toggle key.
61
62## v1.7
63
64*2016-09-18*
65
66### Overall changes
67
68* The number row has been completely rearranged on both the **Base** and the **ADORE** layers.
69* The number/function key behavior was changed: function keys are now on the **Media**.
70* The `:`/`;` and `-`/`_` keys were put back to their thumb position on the bottom row, on both the **Base** and **ADORE** layers.
71* 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.
72* 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.
73
74### ADORE
75
76* `Y` and `X` have been swapped again.
77
78### Media/Navigation layer
79
80* The function keys are now on this layer.
81* Mouse keys have been removed.
82* Media start/stop/prev/next have been removed.
83* `Print screen` has been removed.
84* There is only one screen lock key now.
85
86### Heatmap
87
88* Fixed a few issues in the finger-stats calculation.
89* 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.
90* The heatmap tool will now colorize the stats by default.
91* The periodic stats are now printed in a more compact format.
92
93### Tools
94
95* 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.
96* 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.
97* 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.
98
99## v1.6
100
101*2016-08-24*
102
103### Base layer changes
104
105* The parentheses & bracket keys have been merged: tapping them results in `[` or `{` (if it was shifted), double tapping leads to `(`.
106* The `:;` and `-_` keys are now available on the base layer, on their **ADORE** location, too, just below `[{(`/`]})`.
107* The `Apps` key has been replaced by `F12`.
108* The `-`/`_` is no longer a tap-dance key.
109
110### ADORE layer changes
111
112* Adjustments were made to the **ADORE** layer, to separate some inconvenient combinations.
113
114### Miscellaneous changes
115
116* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one.
117* 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.
118* When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
119
120### Heatmap
121
122* 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.
123* The heatmap generator received a lot of updates.
124
125## v1.5
126
127*2016-08-12*
128
129* The **1HAND** layer has been removed.
130* A `Delete` key is now available on the right thumb cluster.
131* The **ADORE** layer received a major update, see the layout image above.
132* 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.
133* The `~` key and the `Media Next/Prev` key have been swapped on the **Base** layer.
134* On the **ARROW** layer, `Backspace` has been replaced by `Enter`.
135* There is some experimental support for entering Unicode symbols.
136
137## v1.4
138
139*2016-07-29*
140
141* When toggling the key logging on or off, the LEDs will do a little dance.
142* The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it.
143* 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.
144* The `-`/`_` key was turned into a tap-dance key too.
145* There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`.
146
147## v1.3
148
149*2016-07-06*
150
151* Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a *heatmap* out of the logs.
152* 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.
153* The **experimental** layer has been redone, and is now called **ADORE**, and as such, can be enabled by `LEAD a` now.
154* Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot.
155
156## v1.2
157
158*2016-06-22*
159
160* The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with certain operating systems.
161* The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted.
162* The `=` and `\` keys were swapped, `=` moved to the home row, on both the **Base** and the **experimental** layers.
163* The arrow and navigation keys were redone, they are now more accessible, but the navigation keys require an extra tap to access.
164* The **Emacs** layer is gone, replaced by a simplified **navigation and media** layer.
165* `LEAD v` types the firmware version, and the keymap version.
166* On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped.
167* The **Steno** layer gained a few more `#` and `*` keys, to make it easier on my fingers.
168
169## v1.1
170
171*2016-06-14*
172
173* The keyboard starts in NKRO mode, bootmagic and other things are disabled.
174* A **Steno** layer was added, to be used with Plover.
175* An **experimental** layer was added, something halfway between Dvorak and Capewell-Dvorak. A work in progress.
176* `LEAD y` types `\o/`.
177* Some keys on the **Base** layer have been moved around:
178 - `?` moved to the left pinky, left of `Q`.
179 - `=` shifted one row down, but `F11` stayed where it was.
180 - `-` on the left half was replaced by `Tab`.
181 - `Tab`'s original position is taken by a `Media Next`/`Media Prev` key.
182 - `:` now inputs `;` when shifted.
183* `ESC` cancels the **Hungarian** layer too, not just modifiers.
184
185## v1.0
186
187*2016-05-26*
188
189Initial version.
diff --git a/layouts/community/ergodox/algernon/config.h b/layouts/community/ergodox/algernon/config.h
new file mode 100644
index 000000000..8c115e21a
--- /dev/null
+++ b/layouts/community/ergodox/algernon/config.h
@@ -0,0 +1,27 @@
1#ifndef CONFIG_ALGERNON_H
2#define CONFIG_ALGERNON_H
3
4#include QMK_KEYBOARD_CONFIG_H
5
6#undef MOUSEKEY_TIME_TO_MAX
7#undef MOUSEKEY_MAX_SPEED
8
9#define MOUSEKEY_TIME_TO_MAX 1
10#define MOUSEKEY_MAX_SPEED 2
11
12#undef MOUSEKEY_DELAY
13#define MOUSEKEY_DELAY 0
14
15#undef MOUSEKEY_WHEEL_DELAY
16#define MOUSEKEY_WHEEL_DELAY 0
17
18#define ONESHOT_TAP_TOGGLE 2
19#define ONESHOT_TIMEOUT 3000
20
21#undef LOCKING_SUPPORT_ENABLE
22#undef LOCKING_RESYNC_ENABLE
23
24#undef LEADER_TIMEOUT
25#define LEADER_TIMEOUT 1000
26
27#endif
diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c
new file mode 100644
index 000000000..8be54986f
--- /dev/null
+++ b/layouts/community/ergodox/algernon/keymap.c
@@ -0,0 +1,1108 @@
1/*
2 * algernon's ErgoDox EZ layout, please see the readme.md file!
3 */
4
5#include <stdarg.h>
6#include QMK_KEYBOARD_H
7#include "led.h"
8#include "debug.h"
9#include "action_layer.h"
10#include "action_util.h"
11#include "timer.h"
12#include "keymap_plover.h"
13#include "eeconfig.h"
14#include "wait.h"
15#include "version.h"
16
17/* Layers */
18
19enum {
20 BASE = 0,
21 ADORE,
22 ARRW,
23 APPSEL,
24 HUN,
25 NMDIA,
26 PLVR,
27};
28
29/* Macros */
30
31enum {
32 NONE = 0,
33 // Buttons that do extra stuff
34 A_GUI,
35 A_PLVR,
36 A_MPN,
37
38 // Application select keys
39 APP_SLK, // Slack
40 APP_EMCS, // Emacs
41 APP_TERM, // Terminal
42 APP_CHRM, // Chrome
43 APP_MSIC, // Music
44
45 // Hungarian layer keys
46 HU_AA, // Á
47 HU_OO, // Ó
48 HU_EE, // É
49 HU_UU, // Ú
50 HU_II, // Í
51 HU_OE, // Ö
52 HU_UE, // Ü
53 HU_OEE, // Ő
54 HU_UEE, // Ű
55
56 // number/symbol keys
57 A_1, // 1
58 A_2, // 2
59 A_3, // ...
60 A_4,
61 A_5,
62 A_6,
63 A_7,
64 A_8,
65 A_9,
66 A_0,
67
68 // Fx
69 Fx,
70};
71
72/* Fn keys */
73
74enum {
75 F_BSE = 0,
76 F_HUN,
77 F_GUI,
78 F_SFT,
79 F_ALT,
80 F_CTRL
81};
82
83/* Custom keycodes */
84
85enum {
86 CT_CLN = 0,
87 CT_TA,
88 CT_LBP,
89 CT_RBP,
90 CT_TMUX,
91 CT_TPS,
92 CT_SR,
93};
94
95/* States & timers */
96
97uint16_t gui_timer = 0;
98
99#if KEYLOGGER_ENABLE
100# ifdef AUTOLOG_ENABLE
101bool log_enable = true;
102# else
103bool log_enable = false;
104# endif
105#endif
106
107bool time_travel = false;
108bool skip_leds = false;
109
110static uint8_t is_adore = 0;
111
112/* The Keymap */
113
114const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
115
116/* Keymap 0: Base Layer
117 *
118 * ,-----------------------------------------------------. ,-----------------------------------------------------.
119 * | Next/Prev | 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
120 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
121 * | ~ | ' | , | . | P | Y | ( | | ) | F | G | C | R | L | \ |
122 * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
123 * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
124 * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
125 * | Play/Pause| / | Q | J | K | X | | | Pane | B | M | W | V | Z | Stop/Reset|
126 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
127 * | | | | | : | | - | | | | |
128 * `-----------------------------------' `-----------------------------------'
129 * ,-------------. ,-------------.
130 * | LAlt | GUI | | MDIA | Del |
131 * ,------|------|------| |------+------+------.
132 * | | | Ctrl | | LEAD | | |
133 * |Backsp|LShift|------| |------| Enter| Space|
134 * | | | ESC | | HUN | | |
135 * `--------------------' `--------------------'
136 */
137[BASE] = LAYOUT_ergodox(
138// left hand
139 M(A_MPN) ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
140,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,TD(CT_LBP)
141,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
142,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX)
143,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
144
145 ,F(F_ALT),F(F_GUI)
146 ,F(F_CTRL)
147 ,KC_BSPC,F(F_SFT),KC_ESC
148
149 // right hand
150 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
151 ,TD(CT_RBP),KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS
152 ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL
153 ,TD(CT_TPS),KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,TD(CT_SR)
154 ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
155
156 ,OSL(NMDIA),KC_DEL
157 ,KC_LEAD
158 ,F(F_HUN) ,KC_ENT ,KC_SPC
159 ),
160
161/* Keymap 1: Adore layer
162 *
163 * ,-----------------------------------------------------. ,-----------------------------------------------------.
164 * | Play/Pause| 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
165 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
166 * | \ | X | W | C | H | F | ( | | ) | M | G | L | P | / | `~ |
167 * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
168 * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
169 * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
170 * | | Z | Q | ' | , | . | | | pane | B | K | V | Y | J | |
171 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
172 * | | | | | : | | - | | | | |
173 * `-----------------------------------' `-----------------------------------'
174 * ,-------------. ,-------------.
175 * | LAlt | GUI | | MDIA | Del |
176 * ,------|------|------| |------+------+------.
177 * | | | Ctrl | | HUN | | |
178 * |Backsp|LShift|------| |------| Enter| Space|
179 * | | | ESC | | LEAD | | |
180 * `--------------------' `--------------------'
181 */
182[ADORE] = LAYOUT_ergodox(
183// left hand
184 KC_MPLY ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
185,KC_BSLS ,KC_X ,KC_W ,KC_C ,KC_H ,KC_F ,TD(CT_LBP)
186,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U
187,KC_NO ,KC_Z ,KC_Q ,KC_QUOT ,KC_COMM ,KC_DOT ,TD(CT_TMUX)
188,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
189
190 ,F(F_ALT),F(F_GUI)
191 ,F(F_CTRL)
192 ,KC_BSPC,F(F_SFT),KC_ESC
193
194 // right hand
195 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
196 ,TD(CT_RBP),KC_M ,KC_G ,KC_L ,KC_P ,KC_SLSH ,KC_GRV
197 ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
198 ,TD(CT_TPS),KC_B ,KC_K ,KC_V ,KC_Y ,KC_J ,KC_NO
199 ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
200
201 ,OSL(NMDIA),KC_DEL
202 ,F(F_HUN)
203 ,KC_LEAD ,KC_ENT ,KC_SPC
204 ),
205
206/* Keymap 2: Arrow layer
207 *
208 * ,-----------------------------------------------------. ,-----------------------------------------------------.
209 * | | | | | | | | | | | | | | | |
210 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
211 * | | | | | | | | | | | Home | Up | End | | |
212 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
213 * | | | | | | |------| |------| | Left | Down | Rght | | |
214 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
215 * | | | | | | | | | | | | | | | |
216 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
217 * | | | | | | | | | | | |
218 * `----------------------------------' `----------------------------------'
219 * ,-------------. ,-------------.
220 * | | | | | |
221 * ,------|------|------| |------+------+------.
222 * | | | | | | | |
223 * | Enter| |------| |------| PgUp | PgDn |
224 * | | | | | | | |
225 * `--------------------' `--------------------'
226 */
227
228[ARRW] = LAYOUT_ergodox(
229// left hand
230 KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
231,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
232,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
233,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
234,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
235
236 ,KC_TRNS ,KC_TRNS
237 ,KC_TRNS
238 ,KC_ENT ,KC_TRNS ,KC_TRNS
239
240 // right hand
241 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
242 ,KC_TRNS ,KC_TRNS ,KC_HOME ,KC_UP ,KC_END ,KC_TRNS ,KC_TRNS
243 ,KC_TRNS ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_TRNS ,KC_TRNS
244 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
245 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
246
247 ,KC_TRNS ,KC_TRNS
248 ,KC_TRNS
249 ,KC_TRNS ,KC_PGUP ,KC_PGDN
250 ),
251
252/* Keymap 3: Application select layer
253 *
254 * ,-----------------------------------------------------. ,-----------------------------------------------------.
255 * | |Music |Slack |Emacs |Term |Chrome| | | | | | | | | |
256 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
257 * | | | | | | | | | | | | | | | |
258 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
259 * | | | | | | |------| |------| | | | | | |
260 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
261 * | | | | | | | | | | | | | | | |
262 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
263 * | | | | | | | | | | | |
264 * `----------------------------------' `----------------------------------'
265 * ,-------------. ,-------------.
266 * | | | | | |
267 * ,------|------|------| |------+------+------.
268 * | | | | | | | |
269 * | | |------| |------| | |
270 * | | | | | | | |
271 * `--------------------' `--------------------'
272 */
273
274[APPSEL] = LAYOUT_ergodox(
275// left hand
276 KC_TRNS ,M(APP_MSIC),M(APP_SLK),M(APP_EMCS),M(APP_TERM),M(APP_CHRM),KC_TRNS
277,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
278,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
279,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
280,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
281
282 ,KC_TRNS ,KC_TRNS
283 ,KC_TRNS
284 ,KC_TRNS ,KC_TRNS ,KC_TRNS
285
286 // right hand
287 ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_TRNS
288 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
289 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
290 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
291 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
292
293 ,KC_TRNS ,KC_TRNS
294 ,KC_TRNS
295 ,KC_TRNS ,KC_TRNS ,KC_TRNS
296 ),
297
298
299/* Keymap 4: Hungarian Layer
300 *
301 * ,-----------------------------------------------------. ,-----------------------------------------------------.
302 * | | | | | | | | | | | | | | | |
303 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
304 * | | | Ő | | Ű | | | | | | | | | | |
305 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
306 * | | Á | Ó | É | Ú | Í |------| |------| | | | | | |
307 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
308 * | | | Ö | | Ü | | | | | | | | | | |
309 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
310 * | | | | | | | | | | | |
311 * `----------------------------------' `----------------------------------'
312 * ,-------------. ,-------------.
313 * | | | | | |
314 * ,------|------|------| |------+------+------.
315 * | | | | | | | |
316 * | | |------| |------| | |
317 * | | | | | BASE | | |
318 * `--------------------' `--------------------'
319 */
320
321[HUN] = LAYOUT_ergodox(
322// left hand
323 KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
324,KC_NO ,KC_NO ,M(HU_OEE),KC_NO ,M(HU_UEE),KC_NO ,KC_NO
325,KC_NO ,M(HU_AA),M(HU_OO) ,M(HU_EE),M(HU_UU) ,M(HU_II)
326,KC_NO ,KC_NO ,M(HU_OE) ,KC_NO ,M(HU_UE) ,KC_NO ,KC_NO
327,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
328
329 ,KC_NO ,KC_NO
330 ,KC_NO
331 ,KC_NO ,KC_TRNS ,KC_TRNS
332
333 // right hand
334 ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
335 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
336 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
337 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
338 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
339
340 ,KC_NO ,KC_NO
341 ,KC_NO
342 ,F(F_BSE),KC_TRNS ,KC_TRNS
343 ),
344
345/* Keymap 5: Navigation & Media layer
346 *
347 * ,-----------------------------------------------------. ,-----------------------------------------------------.
348 * | | F9 | F7 | F5 | F3 | F1 |ScrLCK| | | F10 | F2 | F4 | F6 | F8 | |
349 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
350 * | | | | | | | | | | | | | | | |
351 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
352 * | | | | | | |------| |------| | | | | | |
353 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
354 * | | | | | | | | | | | | | | | |
355 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
356 * | | | | | | | | | | | |
357 * `----------------------------------' `----------------------------------'
358 * ,-------------. ,-------------.
359 * | Mute | VlUp | | BASE | |
360 * ,------|------|------| |------+------+------.
361 * | | | VlDn | | | | |
362 * | | |------| |------| | |
363 * | | | | | | | |
364 * `--------------------' `--------------------'
365 */
366[NMDIA] = LAYOUT_ergodox(
367// left hand
368 KC_NO ,KC_F9 ,KC_F7 ,KC_F5 ,KC_F3 ,KC_F1 ,LGUI(KC_L)
369,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
370,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
371,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
372,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
373 ,KC_MUTE ,KC_VOLU
374 ,KC_VOLD
375 ,KC_NO ,KC_NO ,KC_TRNS
376
377 // right hand
378 ,KC_TRNS ,KC_F10 ,KC_F2 ,KC_F4 ,KC_F6 ,KC_F8 ,KC_NO
379 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
380 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
381 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
382 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
383
384 ,KC_TRNS ,KC_NO
385 ,KC_NO
386 ,KC_NO ,KC_NO ,KC_NO
387 ),
388
389/* Keymap 6: Steno for Plover
390 *
391 * ,--------------------------------------------------. ,--------------------------------------------------.
392 * | | | | | | | | | | | | | | | BASE |
393 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
394 * | | # | # | # | # | # | # | | # | # | # | # | # | # | # |
395 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
396 * | | | T | P | H | |------| |------| | F | P | L | T | D |
397 * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+------+--------|
398 * | | | K | W | R | | | | | | R | B | G | S | Z |
399 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
400 * | | | | | | | | | | | |
401 * `----------------------------------' `----------------------------------'
402 * ,-------------. ,-------------.
403 * | | | | | |
404 * ,------|------|------| |------+------+------.
405 * | | | | | | | |
406 * | A | O |------| |------| E | U |
407 * | | | | | | | |
408 * `--------------------' `--------------------'
409 */
410
411[PLVR] = LAYOUT_ergodox(
412// left hand
413KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
414KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
415KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR,
416KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR,
417KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
418 KC_NO, KC_NO,
419 KC_NO,
420 PV_A, PV_O, KC_NO,
421
422 // right hand
423 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(A_PLVR),
424 PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
425 PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD,
426 PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ,
427 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
428 KC_NO, KC_NO,
429 KC_NO,
430 KC_NO,PV_E, PV_U
431 ),
432
433};
434
435const uint16_t PROGMEM fn_actions[] = {
436 [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS)
437 ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS)
438 ,[F_GUI] = ACTION_MACRO_TAP(A_GUI)
439 ,[F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT)
440 ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT)
441 ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
442};
443
444static void toggle_steno(int pressed)
445{
446 uint8_t layer = biton32(layer_state);
447
448 if (pressed) {
449 if (layer != PLVR) layer_on(PLVR); else layer_off(PLVR);
450
451 register_code(PV_LP);
452 register_code(PV_LH);
453 register_code(PV_LR);
454 register_code(PV_O);
455 register_code(PV_RL);
456 register_code(PV_RG);
457 } else {
458 unregister_code(PV_LP);
459 unregister_code(PV_LH);
460 unregister_code(PV_LR);
461 unregister_code(PV_O);
462 unregister_code(PV_RL);
463 unregister_code(PV_RG);
464 }
465}
466
467static macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
468{
469 uint8_t need_shift = 0;
470 uint8_t hold_shift = 0;
471
472 if (!record->event.pressed)
473 return MACRO_NONE;
474
475 layer_off (HUN);
476
477 if (keyboard_report->mods & MOD_BIT (KC_LSFT)) {
478 hold_shift = 1;
479 need_shift = 1;
480 unregister_code (KC_LSFT);
481 }
482 if ((get_oneshot_mods () & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out ()) {
483 need_shift = 1;
484 hold_shift = 0;
485 unregister_code (KC_LSFT);
486 }
487
488 clear_oneshot_mods ();
489
490 register_code (KC_RALT);
491 unregister_code (KC_RALT);
492 if (accent == (KC_DQT)) {
493 register_code (KC_RSFT);
494 }
495 register_code (accent);
496 unregister_code (accent);
497 if (need_shift && accent != (KC_DQT)) {
498 register_code (KC_RSFT);
499 } else if (accent == (KC_DQT) && !need_shift) {
500 unregister_code (KC_RSFT);
501 }
502 register_code (hun_char);
503 unregister_code (hun_char);
504 if (need_shift || accent == (KC_DQT))
505 unregister_code (KC_RSFT);
506 if (hold_shift)
507 register_code (KC_LSFT);
508
509 return MACRO_NONE;
510}
511
512static void ang_handle_num_row(uint8_t id, keyrecord_t *record) {
513 uint8_t idx = id - A_1;
514 uint8_t kc;
515 static bool shifted[10];
516
517 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
518 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
519 if (record->event.pressed)
520 shifted[idx] = true;
521 }
522
523 if (!shifted[idx]) {
524 kc = idx + KC_1;
525 } else {
526 switch (id) {
527 case A_8:
528 case A_9:
529 shifted[idx] = false;
530 return;
531
532 case A_7:
533 kc = KC_2;
534 break;
535 case A_5:
536 kc = KC_8;
537 break;
538 case A_3:
539 kc = KC_6;
540 break;
541 case A_1:
542 kc = KC_4;
543 break;
544
545 case A_0:
546 kc = KC_5;
547 break;
548 case A_2:
549 kc = KC_1;
550 break;
551 case A_4:
552 kc = KC_3;
553 break;
554 case A_6:
555 kc = KC_7;
556 break;
557 }
558 }
559
560 if (record->event.pressed) {
561 register_code (kc);
562 } else {
563 unregister_code (kc);
564 shifted[idx] = false;
565 }
566}
567
568const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
569{
570 switch(id) {
571 case A_MPN:
572 if (record->event.pressed) {
573 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
574 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
575 int oneshot = ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out());
576
577 if (oneshot)
578 clear_oneshot_mods ();
579 unregister_code (KC_LSFT);
580
581 register_code (KC_MPRV);
582 unregister_code (KC_MPRV);
583
584 if (!oneshot)
585 register_code (KC_LSFT);
586 } else {
587 return MACRO (T(MNXT), END);
588 }
589 }
590 break;
591
592 /* Hungarian layer */
593 case HU_AA:
594 return ang_do_hun (record, KC_QUOT, KC_A);
595 case HU_OO:
596 return ang_do_hun (record, KC_QUOT, KC_O);
597 case HU_EE:
598 return ang_do_hun (record, KC_QUOT, KC_E);
599 case HU_UU:
600 return ang_do_hun (record, KC_QUOT, KC_U);
601 case HU_II:
602 return ang_do_hun (record, KC_QUOT, KC_I);
603 case HU_OE:
604 return ang_do_hun (record, KC_DQT, KC_O);
605 case HU_UE:
606 return ang_do_hun (record, KC_DQT, KC_U);
607 case HU_OEE:
608 return ang_do_hun (record, KC_EQL, KC_O);
609 case HU_UEE:
610 return ang_do_hun (record, KC_EQL, KC_U);
611
612 /* Plover base */
613 case A_PLVR:
614 toggle_steno(record->event.pressed);
615 break;
616
617 /* Fx */
618 case Fx:
619 if (record->event.pressed) {
620 set_oneshot_mods (MOD_LALT);
621 layer_on (NMDIA);
622 set_oneshot_layer (NMDIA, ONESHOT_START);
623 } else {
624 clear_oneshot_layer_state (ONESHOT_PRESSED);
625 }
626 break;
627
628 /* GUI & AppSel */
629 case A_GUI:
630 if (record->event.pressed) {
631 register_code (KC_LGUI);
632 if (record->tap.count && !record->tap.interrupted) {
633 if (record->tap.count >= 2) {
634 uprintf("CMD:appsel_start\n");
635 layer_on (APPSEL);
636 set_oneshot_layer (APPSEL, ONESHOT_START);
637 }
638 } else {
639 record->tap.count = 0;
640 }
641 gui_timer = 0;
642 } else {
643 if (record->tap.count >= 2)
644 {
645 clear_oneshot_layer_state (ONESHOT_PRESSED);
646 }
647 gui_timer = timer_read ();
648 }
649 break;
650
651 case APP_SLK:
652 if (record->event.pressed)
653 uprintf("CMD:appsel_slack\n");
654 break;
655
656 case APP_EMCS:
657 if (record->event.pressed)
658 uprintf("CMD:appsel_emacs\n");
659 break;
660
661 case APP_TERM:
662 if (record->event.pressed)
663 uprintf("CMD:appsel_term\n");
664 break;
665
666 case APP_CHRM:
667 if (record->event.pressed)
668 uprintf("CMD:appsel_chrome\n");
669 break;
670
671 case APP_MSIC:
672 if (record->event.pressed)
673 uprintf("CMD:appsel_music\n");
674 break;
675
676 // number row and symbols
677 case A_1 ... A_0:
678 ang_handle_num_row(id, record);
679 break;
680 }
681
682 return MACRO_NONE;
683};
684
685// Runs just one time when the keyboard initializes.
686void matrix_init_user(void) {
687 uint8_t dl;
688
689 set_unicode_input_mode(UC_LNX);
690
691 ergodox_led_all_on();
692 for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
693 ergodox_led_all_set (i);
694 wait_ms (5);
695 }
696 wait_ms(1000);
697 for (int i = LED_BRIGHTNESS_LO; i > 0; i--) {
698 ergodox_led_all_set (i);
699 wait_ms (10);
700 }
701 ergodox_led_all_off();
702
703 if (!eeconfig_is_enabled())
704 eeconfig_init();
705 dl = eeconfig_read_default_layer ();
706 if (dl == (1UL << ADORE)) {
707 is_adore = 1;
708 }
709};
710
711LEADER_EXTERNS();
712
713static void ang_tap (uint16_t code, ...) {
714 uint16_t kc = code;
715 va_list ap;
716
717 va_start(ap, code);
718
719 do {
720 register_code16(kc);
721 unregister_code16(kc);
722 wait_ms(50);
723 kc = va_arg(ap, int);
724 } while (kc != 0);
725 va_end(ap);
726}
727
728#define TAP_ONCE(code) \
729 register_code (code); \
730 unregister_code (code)
731
732typedef struct {
733 bool layer_toggle;
734 bool sticky;
735} td_ta_state_t;
736
737static void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
738 td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
739
740 if (td_ta->sticky) {
741 td_ta->sticky = false;
742 td_ta->layer_toggle = false;
743 layer_off (ARRW);
744 return;
745 }
746
747 if (state->count == 1 && !state->pressed) {
748 register_code (KC_TAB);
749 td_ta->sticky = false;
750 td_ta->layer_toggle = false;
751 } else {
752 td_ta->layer_toggle = true;
753 layer_on (ARRW);
754 td_ta->sticky = (state->count == 2);
755 }
756}
757
758static void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) {
759 td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
760
761 if (!td_ta->layer_toggle)
762 unregister_code (KC_TAB);
763 if (!td_ta->sticky)
764 layer_off (ARRW);
765}
766
767static void ang_tap_dance_tmux_finished (qk_tap_dance_state_t *state, void *user_data) {
768 if (state->count == 1) {
769 register_code(KC_LALT);
770 register_code(KC_SPC);
771 unregister_code(KC_SPC);
772 unregister_code(KC_LALT);
773 } else {
774 register_code(KC_LCTL);
775 register_code(KC_A);
776 unregister_code(KC_A);
777 unregister_code(KC_LCTL);
778 }
779}
780
781static void ang_tap_dance_tmux_pane_select (qk_tap_dance_state_t *state, void *user_data) {
782 uint8_t kc = KC_P;
783
784 if (state->count >= 2) {
785 kc = KC_Z;
786 }
787
788 register_code(KC_LALT);
789 register_code(KC_SPC);
790 unregister_code(KC_SPC);
791 unregister_code(KC_LALT);
792
793 register_code(kc);
794 unregister_code(kc);
795}
796
797static void
798_td_sr_each (qk_tap_dance_state_t *state, void *user_data) {
799 skip_leds = true;
800
801 switch (state->count) {
802 case 1:
803 ergodox_right_led_3_on ();
804 break;
805 case 2:
806 ergodox_right_led_2_on ();
807 break;
808 case 3:
809 ergodox_right_led_1_on ();
810 break;
811 case 4:
812 ergodox_right_led_3_off ();
813 wait_ms (50);
814 ergodox_right_led_2_off ();
815 wait_ms (50);
816 ergodox_right_led_1_off ();
817 break;
818 }
819}
820
821static void
822_td_sr_finished (qk_tap_dance_state_t *state, void *user_data) {
823 if (state->count == 1) {
824 register_code (KC_MSTP);
825 }
826 if (state->count >= 4) {
827 uprintf("CMD:reflash\n");
828 wait_ms (1000);
829 reset_keyboard ();
830 reset_tap_dance (state);
831 }
832}
833
834static void
835_td_sr_reset (qk_tap_dance_state_t *state, void *user_data) {
836 ergodox_right_led_1_off ();
837 wait_ms (50);
838 ergodox_right_led_2_off ();
839 wait_ms (50);
840 ergodox_right_led_3_off ();
841
842 if (state->count == 1) {
843 unregister_code (KC_MSTP);
844 }
845}
846
847qk_tap_dance_action_t tap_dance_actions[] = {
848 [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)
849 ,[CT_TA] = {
850 .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset },
851 .user_data = (void *)&((td_ta_state_t) { false, false })
852 }
853 ,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN)
854 ,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN)
855 ,[CT_TMUX]= ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_finished)
856 ,[CT_TPS] = ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_pane_select)
857 ,[CT_SR] = ACTION_TAP_DANCE_FN_ADVANCED (_td_sr_each, _td_sr_finished, _td_sr_reset)
858};
859
860// Runs constantly in the background, in a loop.
861void matrix_scan_user(void) {
862 uint8_t layer = biton32(layer_state);
863 bool is_arrow = false;
864
865 if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM)
866 unregister_code (KC_LGUI);
867
868 if (!skip_leds) {
869 if (layer == HUN) {
870 ergodox_right_led_2_on();
871 ergodox_right_led_3_on();
872 } else if (layer == NMDIA) {
873 ergodox_right_led_1_on();
874 ergodox_right_led_2_on();
875 } else if (layer == PLVR) {
876 ergodox_right_led_1_on ();
877 ergodox_right_led_2_on ();
878 ergodox_right_led_3_on ();
879 } else if (layer == ADORE) {
880 ergodox_right_led_1_on ();
881 ergodox_right_led_2_on ();
882 ergodox_right_led_3_on ();
883
884 ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
885 }
886 }
887
888 if (layer_state & (1UL << ARRW)) {
889 if (!skip_leds) {
890 ergodox_right_led_1_on ();
891 ergodox_right_led_3_on ();
892 }
893 is_arrow = true;
894 }
895
896 if (!skip_leds) {
897 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
898 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
899 ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
900 ergodox_right_led_1_on ();
901 } else {
902 ergodox_right_led_1_set (LED_BRIGHTNESS_LO);
903 if (layer != NMDIA && layer != PLVR && layer != ADORE && !is_arrow)
904 ergodox_right_led_1_off ();
905 }
906
907 if (keyboard_report->mods & MOD_BIT(KC_LALT) ||
908 ((get_oneshot_mods() & MOD_BIT(KC_LALT)) && !has_oneshot_mods_timed_out())) {
909 ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
910 ergodox_right_led_2_on ();
911 } else {
912 ergodox_right_led_2_set (LED_BRIGHTNESS_LO);
913 if (layer != HUN && layer != NMDIA && layer != PLVR && layer != ADORE)
914 ergodox_right_led_2_off ();
915 }
916
917 if (keyboard_report->mods & MOD_BIT(KC_LCTRL) ||
918 ((get_oneshot_mods() & MOD_BIT(KC_LCTRL)) && !has_oneshot_mods_timed_out())) {
919 ergodox_right_led_3_set (LED_BRIGHTNESS_HI);
920 ergodox_right_led_3_on ();
921 } else {
922 ergodox_right_led_3_set (LED_BRIGHTNESS_LO);
923 if (layer != HUN && layer != PLVR && layer != ADORE && !is_arrow)
924 ergodox_right_led_3_off ();
925 }
926 }
927
928 LEADER_DICTIONARY() {
929 leading = false;
930 leader_end ();
931
932 SEQ_ONE_KEY (KC_C) {
933 ang_tap (LSFT(KC_C), KC_S, KC_I, KC_L, KC_L, KC_RALT, KC_QUOT, KC_A, KC_M, KC_A, KC_S,
934 KC_S, KC_Z, KC_O, KC_N, KC_Y, KC_K, KC_RALT, KC_QUOT, KC_A, KC_M, 0);
935 }
936
937 SEQ_ONE_KEY (KC_G) {
938 ang_tap (LSFT(KC_G), KC_E, KC_J, KC_G, KC_RALT, KC_EQL, KC_O,
939 KC_RALT, KC_EQL, KC_O,
940 KC_RALT, KC_EQL, KC_O, 0);
941 }
942
943#if KEYLOGGER_ENABLE
944 SEQ_ONE_KEY (KC_D) {
945 ergodox_led_all_on();
946 wait_ms(100);
947 ergodox_led_all_off();
948 log_enable = !log_enable;
949 }
950#endif
951
952 SEQ_ONE_KEY (KC_T) {
953 time_travel = !time_travel;
954 }
955
956 SEQ_ONE_KEY (KC_U) {
957 qk_ucis_start();
958 }
959
960 SEQ_ONE_KEY (KC_V) {
961 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ (" QMK_VERSION "/" LAYOUT_ergodox_VERSION ")");
962 }
963
964 SEQ_ONE_KEY (KC_L) {
965 /* λ */
966 unicode_input_start();
967 register_hex(0x03bb);
968 unicode_input_finish();
969 }
970
971 SEQ_ONE_KEY (KC_Y) {
972 ang_tap (KC_BSLS, KC_O, KC_SLSH, 0);
973 }
974
975 SEQ_ONE_KEY (KC_S) {
976 unicode_input_start(); register_hex(0xaf); unicode_input_finish();
977 TAP_ONCE (KC_BSLS);
978 register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
979 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
980 register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
981 TAP_ONCE (KC_SLSH);
982 unicode_input_start (); register_hex(0xaf); unicode_input_finish();
983 }
984
985 SEQ_TWO_KEYS (KC_W, KC_M) {
986 uprintf("CMD:wm\n");
987 }
988
989 SEQ_ONE_KEY (KC_A) {
990 if (is_adore == 0) {
991 default_layer_and (0);
992 default_layer_or ((1UL << ADORE));
993 eeconfig_update_default_layer ((1UL << ADORE));
994 is_adore = 1;
995
996 ergodox_led_all_off ();
997 ergodox_right_led_3_on ();
998 wait_ms (100);
999 ergodox_right_led_2_on ();
1000 wait_ms (100);
1001 ergodox_right_led_3_off ();
1002 ergodox_right_led_1_on ();
1003 wait_ms (100);
1004 ergodox_right_led_2_off ();
1005 wait_ms (100);
1006 ergodox_right_led_1_off ();
1007 } else {
1008 is_adore = 0;
1009 default_layer_and (0);
1010 default_layer_or (1UL << BASE);
1011 eeconfig_update_default_layer ((1UL << BASE));
1012
1013 ergodox_led_all_off ();
1014 ergodox_right_led_1_on ();
1015 wait_ms (100);
1016 ergodox_right_led_2_on ();
1017 wait_ms (100);
1018 ergodox_right_led_1_off ();
1019 ergodox_right_led_3_on ();
1020 wait_ms (100);
1021 ergodox_right_led_2_off ();
1022 wait_ms (100);
1023 ergodox_right_led_3_off ();
1024 }
1025 }
1026 }
1027}
1028
1029static uint16_t last4[4];
1030
1031const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
1032(
1033 UCIS_SYM("poop", 0x1f4a9),
1034 UCIS_SYM("rofl", 0x1f923),
1035 UCIS_SYM("kiss", 0x1f619),
1036 UCIS_SYM("snowman", 0x2603),
1037 UCIS_SYM("coffee", 0x2615),
1038 UCIS_SYM("heart", 0x2764),
1039 UCIS_SYM("bolt", 0x26a1),
1040 UCIS_SYM("pi", 0x03c0),
1041 UCIS_SYM("mouse", 0x1f401),
1042 UCIS_SYM("micro", 0x00b5),
1043 UCIS_SYM("tm", 0x2122)
1044);
1045
1046bool process_record_user (uint16_t keycode, keyrecord_t *record) {
1047#if KEYLOGGER_ENABLE
1048 if (log_enable) {
1049 uint8_t layer = biton32(layer_state);
1050
1051 if ((layer == ADORE) || (layer == BASE))
1052 uprintf ("KL: col=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col,
1053 record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
1054 }
1055#endif
1056
1057 if (keycode == KC_ESC && record->event.pressed) {
1058 bool queue = true;
1059
1060 if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
1061 clear_oneshot_mods ();
1062 queue = false;
1063 }
1064 if (layer_state & (1UL<<HUN)) {
1065 layer_off (HUN);
1066 queue = false;
1067 }
1068 return queue;
1069 }
1070
1071 if (time_travel && !record->event.pressed) {
1072 uint8_t p;
1073
1074 // shift cache one to the left
1075 for (p = 0; p < 3; p++) {
1076 last4[p] = last4[p + 1];
1077 }
1078 last4[3] = keycode;
1079
1080 if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) {
1081 ang_tap (KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0);
1082 register_code (KC_RSFT);
1083 register_code (KC_EQL);
1084 unregister_code (KC_EQL);
1085 unregister_code (KC_RSFT);
1086
1087 ang_tap (KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0);
1088
1089 return false;
1090 }
1091 }
1092
1093 return true;
1094}
1095
1096void qk_ucis_symbol_fallback (void) {
1097 for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
1098 uint8_t code;
1099
1100 if ((qk_ucis_state.codes[i] >= M(A_1)) && (qk_ucis_state.codes[i] <= M(A_0)))
1101 code = qk_ucis_state.codes[i] - M(A_1) + KC_1;
1102 else
1103 code = qk_ucis_state.codes[i];
1104 register_code(code);
1105 unregister_code(code);
1106 wait_ms (10);
1107 }
1108}
diff --git a/layouts/community/ergodox/algernon/readme.md b/layouts/community/ergodox/algernon/readme.md
new file mode 100644
index 000000000..4c1fb15ff
--- /dev/null
+++ b/layouts/community/ergodox/algernon/readme.md
@@ -0,0 +1,149 @@
1<!-- -*- mode: markdown; fill-column: 8192 -*- -->
2
3algernon's layout
4=======================
5
6This 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].
7
8 [ez]: https://ergodox-ez.com/
9 [blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/
10
11Some of the things in the layout only work when one uses [Spacemacs][spacemacs] and [GNOME][gnome] under Linux. Your mileage may vary.
12
13 [spacemacs]: http://spacemacs.org/
14 [gnome]: https://www.gnome.org/
15
16## Table of Contents
17
18* [Layouts](#layouts)
19 - [Base layer](#base-layer)
20 - [ADORE layer](#adore-layer)
21 - [Steno layer](#steno-layer)
22 - [LED states](#led-states)
23* [Tools](#tools)
24 - [Heatmap](#heatmap)
25 - [Layer notification](#layer-notification)
26* [Special features](#special-features)
27 - [Unicode Symbol Input](#unicode-symbol-input)
28* [Building](#building)
29 - [Using on Windows](#using-on-windows)
30* [Changelog](https://github.com/algernon/ergodox-layout/blob/master/NEWS.md#readme)
31* [License](#license)
32
33# Layouts
34
35## Base layer
36
37[![Base layer](https://i.imgur.com/q1MDvq4.png)](http://www.keyboard-layout-editor.com/#/gists/28f7eb305fdbff943613e1dc7aa9e82b)
38
39At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave:
40
41* The number row is the same as in the [ADORE](#adore-layer) layer. The function keys are on the **Media** layer.
42* 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.
43* The `GUI` key is special, because when I double-tap it, it sends `GUI + w`, which pops up an application selector. It also switches to a one-shot layer, where the number row on the left half turns into app selector macros, for the most common things I usually want to switch to. Otherwise it behaves as on a normal layout.
44* 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.
45* The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle.
46* The **Fx** key is one-shot, and activates the **Media** layer, along with a one-shot `Alt`.
47* 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.
48* Tapping the `:` key once yields `:`, tapping it twice yields `;`.
49* Tapping the `[{(`/`)}]` keys once yields `[` (or `{` when shifted), tapping them twice yields `(`.
50* The **Lead** key allows me to type in a sequence of keys, and trigger some actions:
51 - `LEAD l` uses the unicode input method to enter a `λ`.
52 - `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯`
53 - `LEAD y` types `\o/`.
54 - `LEAD w m` maximises the currently focused window.
55 - `LEAD a` makes the [ADORE layer](#adore-layer) the default.
56 - `LEAD v` prints the firmware version, the keyboard and the keymap.
57 - `LEAD d` toggles logging keypress positions to the HID console.
58 - `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader.
59 - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
60
61The 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.
62
63## ADORE layer
64
65[![ADORE layer](https://i.imgur.com/r3LnQAA.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a)
66
67My experimental layout, that I keep tweaking. No full description here, because things are very much in flux.
68
69Note 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.
70
71## Steno layer
72
73[![Steno layer for Plover](https://i.imgur.com/PgifhBF.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667)
74
75This 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.
76
77## LED states
78
79The 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.
80
81For the layers, the following rules apply:
82
83* 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.
84* When the **Hungarian** layer is active, the *green* and *blue* LEDs are on.
85* When the **Media** layer is active, the *red* and *green* ones are on.
86* When the **ARROW** layer is active, the *red* and *blue* ones are on.
87* For the [Steno layer](#steno-layer), all LEDs will be turned on.
88
89Unless 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.
90
91# Special features
92
93## Unicode Symbol Input
94
95Once 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.
96
97For the list of supported symbols, please see the source.
98
99This is an experimental feature, and may or may not work reliably.
100
101# Tools
102
103## Heatmap
104
105When 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.
106
107Included 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.
108
109 [kle]: http://www.keyboard-layout-editor.com/
110
111The generated heatmap looks somewhat like this:
112
113 ![Heatmap](https://i.imgur.com/tly9XSy.png)
114
115## Layer notification
116
117There 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.
118
119# Building
120
121To 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 `keyboards/ergodox_ez/algernon-master`. One way to achieve that is this:
122
123 [algernon:ez-layout]: https://github.com/algernon/ergodox-layout
124 [qmk]: https://github.com/qmk/qmk_firmware
125
126```
127$ git clone https://github.com/qmk/qmk_firmware.git
128$ cd qmk_firmware
129$ git clone https://github.com/algernon/ergodox-layout.git \
130 keyboards/ergodox/keymaps/algernon-master
131$ make keyboard=ergodox keymap=algernon-master
132```
133
134From 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):
135
136```
137$ make keyboard=ergodox keymap=algernon
138```
139
140## Using on Windows
141
142The 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.
143
144# License
145
146The 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.
147
148![nav-n-media-layer.png](https://i.imgur.com/AReX8C9.png)
149![hun-layer.png](https://i.imgur.com/uPGBl9J.png) \ No newline at end of file
diff --git a/layouts/community/ergodox/algernon/rules.mk b/layouts/community/ergodox/algernon/rules.mk
new file mode 100644
index 000000000..4487dd812
--- /dev/null
+++ b/layouts/community/ergodox/algernon/rules.mk
@@ -0,0 +1,43 @@
1BOOTMAGIC_ENABLE=no
2COMMAND_ENABLE=no
3SLEEP_LED_ENABLE=no
4FORCE_NKRO = yes
5DEBUG_ENABLE = no
6CONSOLE_ENABLE = no
7TAP_DANCE_ENABLE = yes
8KEYLOGGER_ENABLE = yes
9UCIS_ENABLE = yes
10MOUSEKEY_ENABLE = no
11
12AUTOLOG_ENABLE = no
13
14ifeq (${FORCE_NKRO},yes)
15OPT_DEFS += -DFORCE_NKRO
16endif
17
18ifeq (${AUTOLOG_ENABLE},yes)
19KEYLOGGER_ENABLE = yes
20OPT_DEFS += -DAUTOLOG_ENABLE
21endif
22
23ifeq (${KEYLOGGER_ENABLE},yes)
24OPT_DEFS += -DKEYLOGGER_ENABLE
25CONSOLE_ENABLE = yes
26endif
27
28OPT_DEFS += -DUSER_PRINT
29
30LAYOUT_ergodox_VERSION = $(shell \
31 if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
32 cd "${LAYOUT_ergodox_PATH}" && git describe --abbrev=6 --dirty --always --tags --match 'v*' 2>/dev/null; \
33 else echo QMK; fi)
34
35LAYOUT_ergodox_BRANCH = $(shell \
36 if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
37 cd "${LAYOUT_ergodox_PATH}"; \
38 fi; \
39 git rev-parse --abbrev-ref HEAD 2>/dev/null)
40
41OPT_DEFS += -DLAYOUT_ergodox_VERSION=\"$(LAYOUT_ergodox_VERSION)\\\#$(LAYOUT_ergodox_BRANCH)\"
42
43
diff --git a/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json b/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json
new file mode 100644
index 000000000..e09efecc4
--- /dev/null
+++ b/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json
@@ -0,0 +1,486 @@
1[
2 {
3 "backcolor": "#ffffff",
4 "name": "ErgoDox - algernon's layout: Heatmap",
5 "author": "Gergely Nagy <kbd@gergo.csillger.hu>",
6 "notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
7 "switchMount": "cherry",
8 "switchBrand": "gateron",
9 "switchType": "KS-3-Tea",
10 "pcb": true,
11 "css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
12 },
13 [
14 {
15 "x": 3.5,
16 "fa": [
17 0,
18 0,
19 2
20 ]
21 },
22 "*\n5\nF5",
23 {
24 "x": 10.5,
25 "a": 4,
26 "fa": [
27 0,
28 0,
29 2
30 ]
31 },
32 "#\n4\nF4"
33 ],
34 [
35 {
36 "y": -0.875,
37 "x": 2.5
38 },
39 "@\n7\nF7",
40 {
41 "x": 1
42 },
43 "^\n3\nF3",
44 {
45 "x": 8.5
46 },
47 "!\n2\nF2",
48 {
49 "x": 1
50 },
51 "&\n6\nF6"
52 ],
53 [
54 {
55 "y": -0.875,
56 "x": 5.5
57 },
58 "$\n1\nF1",
59 {
60 "a": 7,
61 "f": 3
62 },
63 "F11",
64 {
65 "x": 4.5,
66 "f": 3
67 },
68 "Fx",
69 {
70 "a": 4,
71 "f": 3,
72 "fa": [
73 0,
74 0,
75 2
76 ]
77 },
78 "%\n0\nF10"
79 ],
80 [
81 {
82 "y": -0.875,
83 "f": 9,
84 "a": 6,
85 "w": 1.5
86 },
87 "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
88 {
89 "f": 3,
90 "a": 4,
91 "fa": [
92 0,
93 0,
94 2
95 ]
96 },
97 " \n9\nF9",
98 {
99 "x": 14.5
100 },
101 " \n8\nF8",
102 {
103 "a": 7,
104 "w": 1.5
105 },
106 "STENO"
107 ],
108 [
109 {
110 "y": -0.375,
111 "x": 3.5,
112 "a": 6
113 },
114 "C",
115 {
116 "x": 10.5
117 },
118 "L"
119 ],
120 [
121 {
122 "y": -0.875,
123 "x": 2.5,
124 "a": 6
125 },
126 "W",
127 {
128 "x": 1,
129 "a": 6
130 },
131 "H",
132 {
133 "x": 8.5
134 },
135 "G",
136 {
137 "x": 1
138 },
139 "P"
140 ],
141 [
142 {
143 "y": -0.875,
144 "x": 5.5
145 },
146 "F",
147 {
148 "a": 4,
149 "fa": [0, 0, 0],
150 "h": 1.5
151 },
152 "{\n(\n[",
153 {
154 "x": 4.5,
155 "h": 1.5
156 },
157 "}\n)\n]",
158 {
159 "a": 6
160 },
161 "M"
162 ],
163 [
164 {
165 "y": -0.875,
166 "f": 3,
167 "a": 4,
168 "w": 1.5
169 },
170 "\n\n|\n\\",
171 {
172 "a": 6,
173 "f": 3
174 },
175 "X",
176 {
177 "x": 14.5,
178 "a": 4
179 },
180 "/\n?",
181 {
182 "a": 4,
183 "w": 1.5
184 },
185 "~\n`"
186 ],
187 [
188 {
189 "y": -0.375,
190 "x": 3.5,
191 "a": 6
192 },
193 "E",
194 {
195 "x": 10.5
196 },
197 "T"
198 ],
199 [
200 {
201 "y": -0.875,
202 "x": 2.5
203 },
204 "O",
205 {
206 "x": 1,
207 "n": true
208 },
209 "I",
210 {
211 "x": 8.5,
212 "n": true
213 },
214 "R",
215 {
216 "x": 1
217 },
218 "N"
219 ],
220 [
221 {
222 "y": -0.875,
223 "x": 5.5
224 },
225 "U",
226 {
227 "x": 6.5
228 },
229 "D"
230 ],
231 [
232 {
233 "y": -0.875,
234 "fa": [
235 6
236 ],
237 "w": 1.5
238 },
239 "<i class='fa fa-arrows'></i>\n\nTab",
240 {
241 "f": 3
242 },
243 "A",
244 {
245 "x": 14.5,
246 "f": 3
247 },
248 "S",
249 {
250 "a": 4,
251 "fa": [
252 0,
253 0,
254 0,
255 0,
256 0,
257 0,
258 0,
259 6
260 ],
261 "w": 1.5
262 },
263 "+\n="
264 ],
265 [
266 {
267 "y": -0.625,
268 "x": 6.5,
269 "a": 7,
270 "f": 9,
271 "h": 1.5
272 },
273 "<i class='fa fa-columns'></i>",
274 {
275 "x": 4.5,
276 "h": 1.5
277 },
278 "<i class='fa fa-table'></i>"
279 ],
280 [
281 {
282 "y": -0.75,
283 "x": 3.5,
284 "a": 4,
285 "f": 3
286 },
287 "\"\n'",
288 {
289 "x": 10.5,
290 "a": 6,
291 "f": 3
292 },
293 "V"
294 ],
295 [
296 {
297 "y": -0.875,
298 "x": 2.5,
299 "a": 6
300 },
301 "Q",
302 {
303 "x": 1,
304 "a": 4
305 },
306 "<\n,",
307 {
308 "x": 8.5,
309 "a": 6
310 },
311 "K",
312 {
313 "x": 1
314 },
315 "Y"
316 ],
317 [
318 {
319 "y": -0.875,
320 "x": 5.5,
321 "a": 4
322 },
323 ">\n.",
324 {
325 "x": 6.5,
326 "a": 6
327 },
328 "B"
329 ],
330 [
331 {
332 "y": -0.875,
333 "f": 9,
334 "w": 1.5,
335 "g": true
336 },
337 "",
338 {
339 "a": 6,
340 "f": 3,
341 "g": false
342 },
343 "Z",
344 {
345 "x": 14.5
346 },
347 "J",
348 {
349 "f": 9,
350 "g": true,
351 "w": 1.5,
352 "a": 4
353 },
354 ""
355 ],
356 [
357 {
358 "y": -0.375,
359 "x": 3.5,
360 "g": true,
361 "a": 7,
362 "f": 3
363 },
364 "",
365 {
366 "x": 10.5
367 },
368 ""
369 ],
370 [
371 {
372 "y": -0.875,
373 "x": 2.5
374 },
375 "",
376 {
377 "x": 1,
378 "g": false,
379 "a": 5
380 },
381 ";\n:",
382 {
383 "x": 8.5
384 },
385 "_\n-",
386 {
387 "x": 1,
388 "g": true,
389 "a": 7
390 },
391 ""
392 ],
393 [
394 {
395 "y": -0.75,
396 "x": 0.5
397 },
398 "",
399 {},
400 "",
401 {
402 "x": 14.5
403 },
404 "",
405 {},
406 ""
407 ],
408 [
409 {
410 "r": 30,
411 "rx": 6.5,
412 "ry": 4.25,
413 "y": -1,
414 "x": 1,
415 "g": false
416 },
417 "Alt",
418 {
419 "a": 4,
420 "fa": [
421 0,
422 0,
423 0,
424 9
425 ]
426 },
427 "\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
428 ],
429 [
430 {
431 "a": 7,
432 "f": 9,
433 "h": 2
434 },
435 "<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
436 {
437 "h": 2
438 },
439 "<i class='fa fa-angle-double-up'></i>",
440 {
441 "f": 3
442 },
443 "Ctrl"
444 ],
445 [
446 {
447 "x": 2
448 },
449 "ESC"
450 ],
451 [
452 {
453 "r": -30,
454 "rx": 13,
455 "y": -1,
456 "x": -3,
457 "f": 2
458 },
459 "MEDIA",
460 {},
461 "DEL"
462 ],
463 [
464 {
465 "x": -3
466 },
467 "HUN",
468 {
469 "f": 9,
470 "h": 2
471 },
472 "<i class='kb kb-Return-2'></i>",
473 {
474 "f": 3,
475 "h": 2
476 },
477 "SPC"
478 ],
479 [
480 {
481 "x": -3,
482 "f": 2
483 },
484 "LEAD"
485 ]
486]
diff --git a/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json b/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json
new file mode 100644
index 000000000..1e53281c5
--- /dev/null
+++ b/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json
@@ -0,0 +1,477 @@
1[
2 {
3 "backcolor": "#ffffff",
4 "name": "ErgoDox - algernon's layout: Heatmap",
5 "author": "Gergely Nagy <kbd@gergo.csillger.hu>",
6 "notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
7 "switchMount": "cherry",
8 "switchBrand": "gateron",
9 "switchType": "KS-3-Tea",
10 "pcb": true,
11 "css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
12 },
13 [
14 {
15 "x": 3.5,
16 "fa": [
17 0,
18 0,
19 2
20 ]
21 },
22 "*\n5\nF5",
23 {
24 "x": 10.5,
25 "a": 4,
26 "fa": [
27 0,
28 0,
29 2
30 ]
31 },
32 "#\n4\nF4"
33 ],
34 [
35 {
36 "y": -0.875,
37 "x": 2.5
38 },
39 "@\n7\nF7",
40 {
41 "x": 1
42 },
43 "^\n3\nF3",
44 {
45 "x": 8.5
46 },
47 "!\n2\nF2",
48 {
49 "x": 1
50 },
51 "&\n6\nF6"
52 ],
53 [
54 {
55 "y": -0.875,
56 "x": 5.5
57 },
58 "$\n1\nF1",
59 {
60 "a": 7,
61 "f": 3
62 },
63 "F11",
64 {
65 "x": 4.5,
66 "f": 3
67 },
68 "Fx",
69 {
70 "a": 4,
71 "f": 3,
72 "fa": [
73 0,
74 0,
75 2
76 ]
77 },
78 "%\n0\nF10"
79 ],
80 [
81 {
82 "y": -0.875,
83 "f": 6,
84 "a": 6,
85 "w": 1.5
86 },
87 "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
88 {
89 "f": 3,
90 "a": 4,
91 "fa": [
92 0,
93 0,
94 2
95 ]
96
97 },
98 " \n9\nF9",
99 {
100 "x": 14.5
101 },
102 " \n8\nF8",
103 {
104 "a": 7,
105 "w": 1.5
106 },
107 "STENO"
108 ],
109 [
110 {
111 "y": -0.375,
112 "x": 3.5,
113 "a": 4
114 },
115 ">\n.",
116 {
117 "x": 10.5,
118 "a": 6
119 },
120 "C"
121 ],
122 [
123 {
124 "y": -0.875,
125 "x": 2.5,
126 "a": 4
127 },
128 "<\n,",
129 {
130 "x": 1,
131 "a": 6
132 },
133 "P",
134 {
135 "x": 8.5
136 },
137 "G",
138 {
139 "x": 1
140 },
141 "R"
142 ],
143 [
144 {
145 "y": -0.875,
146 "x": 5.5
147 },
148 "Y",
149 {
150 "a": 4,
151 "h": 1.5
152 },
153 "{\n(\n[",
154 {
155 "x": 4.5,
156 "h": 1.5
157 },
158 "}\n)\n]",
159 {
160 "a": 6
161 },
162 "F"
163 ],
164 [
165 {
166 "y": -0.875,
167 "f": 3,
168 "a": 4,
169 "w": 1.5
170 },
171 "\n\n~\n`",
172 {
173 "a": 4,
174 "f": 3
175 },
176 "\"\n'",
177 {
178 "x": 14.5,
179 "a": 6
180 },
181 "L",
182 {
183 "a": 4,
184 "w": 1.5
185 },
186 "|\n\\"
187 ],
188 [
189 {
190 "y": -0.375,
191 "x": 3.5,
192 "a": 6
193 },
194 "E",
195 {
196 "x": 10.5
197 },
198 "T"
199 ],
200 [
201 {
202 "y": -0.875,
203 "x": 2.5
204 },
205 "O",
206 {
207 "x": 1,
208 "n": true
209 },
210 "U",
211 {
212 "x": 8.5,
213 "n": true
214 },
215 "H",
216 {
217 "x": 1
218 },
219 "N"
220 ],
221 [
222 {
223 "y": -0.875,
224 "x": 5.5
225 },
226 "I",
227 {
228 "x": 6.5
229 },
230 "D"
231 ],
232 [
233 {
234 "y": -0.875,
235 "fa": [
236 6
237 ],
238 "w": 1.5
239 },
240 "<i class='fa fa-arrows'></i>\n\nTab",
241 {
242 "f": 3
243 },
244 "A",
245 {
246 "x": 14.5,
247 "f": 3
248 },
249 "S",
250 {
251 "a": 4,
252 "fa": [
253 0,
254 0,
255 0,
256 0,
257 0,
258 0,
259 0,
260 6
261 ],
262 "w": 1.5
263 },
264 "+\n="
265 ],
266 [
267 {
268 "y": -0.625,
269 "x": 6.5,
270 "a": 7,
271 "f": 9,
272 "h": 1.5
273 },
274 "<i class='fa fa-columns'></i>",
275 {
276 "x": 4.5,
277 "h": 1.5
278 },
279 "<i class='fa fa-table'></i>"
280 ],
281 [
282 {
283 "y": -0.75,
284 "x": 3.5,
285 "f": 3,
286 "a": 6
287 },
288 "J",
289 {
290 "x": 10.5
291 },
292 "W"
293 ],
294 [
295 {
296 "y": -0.875,
297 "x": 2.5
298 },
299 "Q",
300 {
301 "x": 1
302 },
303 "K",
304 {
305 "x": 8.5
306 },
307 "M",
308 {
309 "x": 1
310 },
311 "V"
312 ],
313 [
314 {
315 "y": -0.875,
316 "x": 5.5
317 },
318 "X",
319 {
320 "x": 6.5
321 },
322 "B"
323 ],
324 [
325 {
326 "y": -0.875,
327 "f": 9,
328 "w": 1.5
329 },
330 "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
331 {
332 "a": 4,
333 "f": 3
334 },
335 "?\n/",
336 {
337 "x": 14.5,
338 "a": 6
339 },
340 "Z",
341 {
342 "f": 9,
343 "w": 1.5
344 },
345 "<i class='kb kb-Multimedia-Stop'></i>"
346 ],
347 [
348 {
349 "y": -0.375,
350 "x": 3.5,
351 "g": true,
352 "a": 7,
353 "f": 3
354 },
355 "",
356 {
357 "x": 10.5
358 },
359 ""
360 ],
361 [
362 {
363 "y": -0.875,
364 "x": 2.5
365 },
366 "",
367 {
368 "x": 1,
369 "g": false,
370 "a": 5
371 },
372 ";\n:",
373 {
374 "x": 8.5
375 },
376 "_\n-",
377 {
378 "x": 1,
379 "g": true,
380 "a": 7
381 },
382 ""
383 ],
384 [
385 {
386 "y": -0.75,
387 "x": 0.5
388 },
389 "",
390 {},
391 "",
392 {
393 "x": 14.5
394 },
395 "",
396 {},
397 ""
398 ],
399 [
400 {
401 "r": 30,
402 "rx": 6.5,
403 "ry": 4.25,
404 "y": -1,
405 "x": 1,
406 "g": false
407 },
408 "Alt",
409 {
410 "a": 4,
411 "fa": [
412 0,
413 0,
414 0,
415 9
416 ]
417 },
418 "\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
419 ],
420 [
421 {
422 "a": 7,
423 "f": 9,
424 "h": 2
425 },
426 "<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
427 {
428 "h": 2
429 },
430 "<i class='fa fa-angle-double-up'></i>",
431 {
432 "f": 3
433 },
434 "Ctrl"
435 ],
436 [
437 {
438 "x": 2
439 },
440 "ESC"
441 ],
442 [
443 {
444 "r": -30,
445 "rx": 13,
446 "y": -1,
447 "x": -3,
448 "f": 2
449 },
450 "MEDIA",
451 {},
452 "DEL"
453 ],
454 [
455 {
456 "x": -3
457 },
458 "LEAD",
459 {
460 "f": 9,
461 "h": 2
462 },
463 "<i class='kb kb-Return-2'></i>",
464 {
465 "f": 3,
466 "h": 2
467 },
468 "SPC"
469 ],
470 [
471 {
472 "x": -3,
473 "f": 2
474 },
475 "HUN"
476 ]
477]
diff --git a/layouts/community/ergodox/algernon/tools/hid-commands b/layouts/community/ergodox/algernon/tools/hid-commands
new file mode 100644
index 000000000..54ca7556a
--- /dev/null
+++ b/layouts/community/ergodox/algernon/tools/hid-commands
@@ -0,0 +1,80 @@
1#!/bin/bash
2set -e
3
4LAST_APPSEL_START=0
5
6cmd_wm () {
7 WIN="$(xdotool getactivewindow)"
8 wmctrl -i -r ${WIN} -b remove,maximized_vert,maximized_horz
9 xdotool windowsize ${WIN} 100% 100%
10 wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz
11}
12
13_cmd_appsel () {
14 wmctrl -x -a $1 || true
15 xdotool key Escape
16}
17
18cmd_appsel_music () {
19 wmctrl -x -a rhythmbox || wmctrl -x -a spotify || \
20 wmctrl -x -a banshee || wmctrl -x -a kodi || true
21 xdotool key Escape
22}
23
24cmd_appsel_slack () {
25 _cmd_appsel slack
26}
27
28cmd_appsel_emacs () {
29 _cmd_appsel emacs
30}
31
32cmd_appsel_term () {
33 _cmd_appsel gnome-terminal
34}
35
36cmd_appsel_chrome () {
37 _cmd_appsel chrom
38}
39
40cmd_appsel_start () {
41 if [ ! -z "${DISABLE_APPSEL_START}" ]; then
42 return
43 fi
44
45 APPSEL_START=$(date +%s)
46 if [ $APPSEL_START -lt $(expr $LAST_APPSEL_START + 10) ]; then
47 return
48 fi
49 LAST_APPSEL_START=$APPSEL_START
50 notify-send -t 1000 "Please select an application!" -c device -u low \
51 -i /usr/share/icons/Adwaita/24x24/devices/video-display.png
52}
53
54cmd_reflash () {
55 teensy_loader_cli -v -w ~/src/ext/qmk_firmware/algernon.hex --mcu atmega32u4 || true
56}
57
58cmd_help () {
59 cat <<EOF
60Use the source, Luke!
61EOF
62}
63
64while read l; do
65 case "$l" in
66 "CMD:"*)
67 ;;
68 *)
69 continue
70 ;;
71 esac
72
73 cmd="$(echo $l | cut -d: -f2-)"
74
75 echo "Got command: ${cmd}"
76
77 if type cmd_${cmd} >/dev/null 2>&1; then
78 cmd_${cmd}
79 fi
80done
diff --git a/layouts/community/ergodox/algernon/tools/log-to-heatmap.py b/layouts/community/ergodox/algernon/tools/log-to-heatmap.py
new file mode 100644
index 000000000..e927e0e39
--- /dev/null
+++ b/layouts/community/ergodox/algernon/tools/log-to-heatmap.py
@@ -0,0 +1,344 @@
1#! /usr/bin/env python3
2import json
3import os
4import sys
5import re
6import argparse
7import time
8
9from math import floor
10from os.path import dirname
11from subprocess import Popen, PIPE, STDOUT
12from blessings import Terminal
13
14class Heatmap(object):
15 coords = [
16 [
17 # Row 0
18 [ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
19 [ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
20 ],
21 [
22 # Row 1
23 [ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
24 [ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
25 ],
26 [
27 # Row 2
28 [12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
29 [ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
30 ],
31 [
32 # Row 3
33 [17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
34 [13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
35 ],
36 [
37 # Row 4
38 [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
39 [19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [], [], [], []
40 ],
41 [
42 # Row 5
43 [ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
44 [24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
45 ],
46 ]
47
48 def set_attr_at(self, block, n, attr, fn, val):
49 blk = self.heatmap[block][n]
50 if attr in blk:
51 blk[attr] = fn(blk[attr], val)
52 else:
53 blk[attr] = fn(None, val)
54
55 def coord(self, col, row):
56 return self.coords[row][col]
57
58 @staticmethod
59 def set_attr(orig, new):
60 return new
61
62 def set_bg(self, coords, color):
63 (block, n) = coords
64 self.set_attr_at(block, n, "c", self.set_attr, color)
65 #self.set_attr_at(block, n, "g", self.set_attr, False)
66
67 def set_tap_info(self, coords, count, cap):
68 (block, n) = coords
69 def _set_tap_info(o, _count, _cap):
70 ns = 4 - o.count ("\n")
71 return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
72
73 if not cap:
74 cap = 1
75 self.heatmap[block][n + 1] = _set_tap_info (self.heatmap[block][n + 1], count, cap)
76
77 @staticmethod
78 def heatmap_color (v):
79 colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
80 fb = 0
81 if v <= 0:
82 idx1, idx2 = 0, 0
83 elif v >= 1:
84 idx1, idx2 = len(colors) - 1, len(colors) - 1
85 else:
86 val = v * (len(colors) - 1)
87 idx1 = int(floor(val))
88 idx2 = idx1 + 1
89 fb = val - float(idx1)
90
91 r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
92 g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
93 b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
94
95 r, g, b = [x * 255 for x in (r, g, b)]
96 return "#%02x%02x%02x" % (int(r), int(g), int(b))
97
98 def __init__(self, layout):
99 self.log = {}
100 self.total = 0
101 self.max_cnt = 0
102 self.layout = layout
103
104 def update_log(self, coords):
105 (c, r) = coords
106 if not (c, r) in self.log:
107 self.log[(c, r)] = 0
108 self.log[(c, r)] = self.log[(c, r)] + 1
109 self.total = self.total + 1
110 if self.max_cnt < self.log[(c, r)]:
111 self.max_cnt = self.log[(c, r)]
112
113 def get_heatmap(self):
114 with open("%s/heatmap-layout.%s.json" % (dirname(sys.argv[0]), self.layout), "r") as f:
115 self.heatmap = json.load (f)
116
117 ## Reset colors
118 for row in self.coords:
119 for coord in row:
120 if coord != []:
121 self.set_bg (coord, "#d9dae0")
122
123 for (c, r) in self.log:
124 coords = self.coord(c, r)
125 b, n = coords
126 cap = self.max_cnt
127 if cap == 0:
128 cap = 1
129 v = float(self.log[(c, r)]) / cap
130 self.set_bg (coords, self.heatmap_color (v))
131 self.set_tap_info (coords, self.log[(c, r)], self.total)
132 return self.heatmap
133
134 def get_stats(self):
135 usage = [
136 # left hand
137 [0, 0, 0, 0, 0],
138 # right hand
139 [0, 0, 0, 0, 0]
140 ]
141 finger_map = [0, 0, 1, 2, 3, 3, 3, 1, 1, 1, 2, 3, 4, 4]
142 for (c, r) in self.log:
143 if r == 5: # thumb cluster
144 if c <= 6: # left side
145 usage[0][4] = usage[0][4] + self.log[(c, r)]
146 else:
147 usage[1][0] = usage[1][0] + self.log[(c, r)]
148 elif r == 4 and (c == 4 or c == 9): # bottom row thumb keys
149 if c <= 6: # left side
150 usage[0][4] = usage[0][4] + self.log[(c, r)]
151 else:
152 usage[1][0] = usage[1][0] + self.log[(c, r)]
153 else:
154 fc = c
155 hand = 0
156 if fc >= 7:
157 hand = 1
158 fm = finger_map[fc]
159 usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
160 hand_usage = [0, 0]
161 for f in usage[0]:
162 hand_usage[0] = hand_usage[0] + f
163 for f in usage[1]:
164 hand_usage[1] = hand_usage[1] + f
165
166 total = self.total
167 if total == 0:
168 total = 1
169 stats = {
170 "total-keys": total,
171 "hands": {
172 "left": {
173 "usage": round(float(hand_usage[0]) / total * 100, 2),
174 "fingers": {
175 "pinky": 0,
176 "ring": 0,
177 "middle": 0,
178 "index": 0,
179 "thumb": 0,
180 }
181 },
182 "right": {
183 "usage": round(float(hand_usage[1]) / total * 100, 2),
184 "fingers": {
185 "thumb": 0,
186 "index": 0,
187 "middle": 0,
188 "ring": 0,
189 "pinky": 0,
190 }
191 },
192 }
193 }
194
195 hmap = ['left', 'right']
196 fmap = ['pinky', 'ring', 'middle', 'index', 'thumb',
197 'thumb', 'index', 'middle', 'ring', 'pinky']
198 for hand_idx in range(len(usage)):
199 hand = usage[hand_idx]
200 for finger_idx in range(len(hand)):
201 stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = round(float(hand[finger_idx]) / total * 100, 2)
202 return stats
203
204def dump_all(out_dir, heatmaps):
205 stats = {}
206 t = Terminal()
207 t.clear()
208 sys.stdout.write("\x1b[2J\x1b[H")
209
210 print ('{t.underline}{outdir}{t.normal}\n'.format(t=t, outdir=out_dir))
211
212 keys = list(heatmaps.keys())
213 keys.sort()
214
215 for layer in keys:
216 if len(heatmaps[layer].log) == 0:
217 continue
218
219 with open ("%s/%s.json" % (out_dir, layer), "w") as f:
220 json.dump(heatmaps[layer].get_heatmap(), f)
221 stats[layer] = heatmaps[layer].get_stats()
222
223 left = stats[layer]['hands']['left']
224 right = stats[layer]['hands']['right']
225
226 print ('{t.bold}{layer}{t.normal} ({total:,} taps):'.format(t=t, layer=layer,
227 total=int(stats[layer]['total-keys'] / 2)))
228 print (('{t.underline} | ' + \
229 'left ({l[usage]:6.2f}%) | ' + \
230 'right ({r[usage]:6.2f}%) |{t.normal}').format(t=t, l=left, r=right))
231 print ((' {t.bright_magenta}pinky{t.white} | {left[pinky]:6.2f}% | {right[pinky]:6.2f}% |\n' + \
232 ' {t.bright_cyan}ring{t.white} | {left[ring]:6.2f}% | {right[ring]:6.2f}% |\n' + \
233 ' {t.bright_blue}middle{t.white} | {left[middle]:6.2f}% | {right[middle]:6.2f}% |\n' + \
234 ' {t.bright_green}index{t.white} | {left[index]:6.2f}% | {right[index]:6.2f}% |\n' + \
235 ' {t.bright_red}thumb{t.white} | {left[thumb]:6.2f}% | {right[thumb]:6.2f}% |\n' + \
236 '').format(left=left['fingers'], right=right['fingers'], t=t))
237
238def process_line(line, heatmaps, opts, stamped_log = None):
239 m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
240 if not m:
241 return False
242 if stamped_log is not None:
243 if line.startswith("KL:"):
244 print ("%10.10f %s" % (time.time(), line),
245 file = stamped_log, end = '')
246 else:
247 print (line,
248 file = stamped_log, end = '')
249 stamped_log.flush()
250
251 (c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
252 if (c, r) not in opts.allowed_keys:
253 return False
254
255 heatmaps[l].update_log ((c, r))
256
257 return True
258
259def setup_allowed_keys(opts):
260 if len(opts.only_key):
261 incmap={}
262 for v in opts.only_key:
263 m = re.search ('(\d+),(\d+)', v)
264 if not m:
265 continue
266 (c, r) = (int(m.group(1)), int(m.group(2)))
267 incmap[(c, r)] = True
268 else:
269 incmap={}
270 for r in range(0, 6):
271 for c in range(0, 14):
272 incmap[(c, r)] = True
273
274 for v in opts.ignore_key:
275 m = re.search ('(\d+),(\d+)', v)
276 if not m:
277 continue
278 (c, r) = (int(m.group(1)), int(m.group(2)))
279 del(incmap[(c, r)])
280
281 return incmap
282
283def main(opts):
284 heatmaps = {"Dvorak": Heatmap("Dvorak"),
285 "ADORE": Heatmap("ADORE")
286 }
287 cnt = 0
288 out_dir = opts.outdir
289
290 if not os.path.exists(out_dir):
291 os.makedirs(out_dir)
292
293 opts.allowed_keys = setup_allowed_keys(opts)
294
295 if not opts.one_shot:
296
297 try:
298 with open("%s/stamped-log" % out_dir, "r") as f:
299 while True:
300 line = f.readline()
301 if not line:
302 break
303 if not process_line(line, heatmaps, opts):
304 continue
305 except:
306 pass
307
308 stamped_log = open ("%s/stamped-log" % (out_dir), "a+")
309 else:
310 stamped_log = None
311
312 while True:
313 line = sys.stdin.readline()
314 if not line:
315 break
316 if not process_line(line, heatmaps, opts, stamped_log):
317 continue
318
319 cnt = cnt + 1
320
321 if opts.dump_interval != -1 and cnt >= opts.dump_interval and not opts.one_shot:
322 cnt = 0
323 dump_all(out_dir, heatmaps)
324
325 dump_all (out_dir, heatmaps)
326
327if __name__ == "__main__":
328 parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
329 parser.add_argument ('outdir', action = 'store',
330 help = 'Output directory')
331 parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int,
332 default = 100, help = 'Dump stats and heatmap at every Nth event, -1 for dumping at EOF only')
333 parser.add_argument ('--ignore-key', dest = 'ignore_key', action = 'append', type = str,
334 default = [], help = 'Ignore the key at position (x, y)')
335 parser.add_argument ('--only-key', dest = 'only_key', action = 'append', type = str,
336 default = [], help = 'Only include key at position (x, y)')
337 parser.add_argument ('--one-shot', dest = 'one_shot', action = 'store_true',
338 help = 'Do not load previous data, and do not update it, either.')
339 args = parser.parse_args()
340 if len(args.ignore_key) and len(args.only_key):
341 print ("--ignore-key and --only-key are mutually exclusive, please only use one of them!",
342 file = sys.stderr)
343 sys.exit(1)
344 main(args)
diff --git a/layouts/community/ergodox/algernon/tools/text-to-log.py b/layouts/community/ergodox/algernon/tools/text-to-log.py
new file mode 100644
index 000000000..f080c32cd
--- /dev/null
+++ b/layouts/community/ergodox/algernon/tools/text-to-log.py
@@ -0,0 +1,107 @@
1#!/usr/bin/env python3
2
3import os
4import sys
5
6charmap = {
7 '9': [[1, 0]],
8 '7': [[2, 0]], '@': [[2, 5], [2, 0]],
9 '5': [[3, 0]], '*': [[2, 5], [3, 0]],
10 '3': [[4, 0]], '^': [[2, 5], [4, 0]],
11 '1': [[5, 0]], '$': [[2, 5], [5, 0]],
12 '0': [[8, 0]], '%': [[2, 5], [8, 0]],
13 '2': [[9, 0]], '!': [[2, 5], [9, 0]],
14 '4': [[10, 0]], '#': [[2, 5], [10, 0]],
15 '6': [[11, 0]], '&': [[2, 5], [11, 0]],
16 '8': [[12, 0]],
17
18 '\\': [[0, 1]], '|': [[2, 5], [0, 1]],
19 'x': [[1, 1]], 'X': [[2, 5], [1, 1]],
20 'w': [[2, 1]], 'W': [[2, 5], [2, 1]],
21 'c': [[3, 1]], 'C': [[2, 5], [3, 1]],
22 'h': [[4, 1]], 'H': [[2, 5], [4, 1]],
23 'f': [[5, 1]], 'F': [[2, 5], [5, 1]],
24 '[': [[6, 1]], '{': [[2, 5], [6, 1]], '(': [[6, 1], [6, 1]],
25 ']': [[7, 1]], '}': [[2, 5], [7, 1]], ')': [[7, 1], [7, 1]],
26 'm': [[8, 1]], 'M': [[2, 5], [8, 1]],
27 'g': [[9, 1]], 'G': [[2, 5], [9, 1]],
28 'l': [[10, 1]], 'L': [[2, 5], [10, 1]],
29 'p': [[11, 1]], 'P': [[2, 5], [11, 1]],
30 '/': [[12, 1]], '?': [[2, 5], [12, 1]],
31 '`': [[13, 1]], '~': [[2, 5], [13, 1]],
32
33 '\t': [[0, 2]],
34 'a': [[1, 2]], 'A': [[2, 5], [1, 2]],
35 'o': [[2, 2]], 'O': [[2, 5], [2, 2]],
36 'e': [[3, 2]], 'E': [[2, 5], [3, 2]],
37 'i': [[4, 2]], 'I': [[2, 5], [4, 2]],
38 'u': [[5, 2]], 'U': [[2, 5], [5, 2]],
39 'd': [[8, 2]], 'D': [[2, 5], [8, 2]],
40 'r': [[9, 2]], 'R': [[2, 5], [9, 2]],
41 't': [[10, 2]], 'T': [[2, 5], [10, 2]],
42 'n': [[11, 2]], 'N': [[2, 5], [11, 2]],
43 's': [[12, 2]], 'S': [[2, 5], [12, 2]],
44 '=': [[13, 2]], '+': [[2, 5], [13, 2]],
45
46 'z': [[1, 3]], 'Z': [[2, 5], [1, 3]],
47 'q': [[2, 3]], 'Q': [[2, 5], [2, 3]],
48 '\'': [[3, 3]], '"': [[2, 5], [3, 3]],
49 ',': [[4, 3]], '<': [[2, 5], [4, 3]],
50 '.': [[5, 3]], '>': [[2, 5], [5, 3]],
51 'b': [[8, 3]], 'B': [[2, 5], [8, 3]],
52 'k': [[9, 3]], 'K': [[2, 5], [9, 3]],
53 'v': [[10, 3]], 'V': [[2, 5], [10, 3]],
54 'y': [[11, 3]], 'Y': [[2, 5], [11, 3]],
55 'j': [[12, 3]], 'J': [[2, 5], [12, 3]],
56
57 ':': [[4, 4]], ';': [[4, 4], [4, 4]],
58 '-': [[9, 4]], '_': [[2, 5], [9, 4]],
59
60 ' ': [[10, 5]],
61 '\n': [[11, 5]],
62
63 ## Layered things
64 # Hungarian
65 'á': [[9, 5], [1, 2]], 'Á': [[2, 5], [9, 5], [1, 2]],
66 'ó': [[9, 5], [2, 2]], 'Ó': [[2, 5], [9, 5], [2, 2]],
67 'ő': [[9, 5], [2, 1]], 'Ő': [[2, 5], [9, 5], [2, 1]],
68 'ö': [[9, 5], [2, 3]], 'Ö': [[2, 5], [9, 5], [2, 3]],
69 'é': [[9, 5], [3, 2]], 'É': [[2, 5], [9, 5], [3, 2]],
70 'ú': [[9, 5], [4, 2]], 'Ú': [[2, 5], [9, 5], [4, 2]],
71 'ű': [[9, 5], [4, 1]], 'Ű': [[2, 5], [9, 5], [4, 1]],
72 'ü': [[9, 5], [4, 3]], 'Ü': [[2, 5], [9, 5], [4, 3]],
73 'í': [[9, 5], [5, 2]], 'Í': [[2, 5], [9, 5], [5, 2]],
74}
75
76def lookup_char(layer, ch):
77 if ch in charmap:
78 return charmap[ch]
79 return None
80
81def process_char(layer, ch, out=sys.stdout):
82 keys = lookup_char(layer, ch)
83 if not keys:
84 print ("Unknown char: %s" % ch, file=sys.stderr)
85 else:
86 for (c, r) in keys:
87 print ("KL: col=%d, row=%d, pressed=1, layer=%s" % (r, c, layer), file=out)
88 print ("KL: col=%d, row=%d, pressed=0, layer=%s" % (r, c, layer), file=out)
89
90def process_file(fn, layer, out=sys.stdout):
91 with open(fn, "r") as f:
92 ch = f.read(1)
93 while ch:
94 process_char(layer, ch, out)
95 ch = f.read(1)
96
97if sys.argv[1] == '-':
98 out='/dev/stdin'
99else:
100 out=sys.argv[1]
101
102if len(sys.argv) >= 2:
103 layer = 'ADORE'
104else:
105 layer = sys.argv[2]
106
107process_file(out, layer = layer)