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

|
||||
93
corne/v3qmk/config.h
Normal file
93
corne/v3qmk/config.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
This is the c configuration file for the keymap
|
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2015 Jack Humbert
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Select hand configuration */
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
//#define TAPPING_FORCE_HOLD
|
||||
#define TAPPING_TERM 200
|
||||
|
||||
#define LANG_CHANGE_DEFAULT LANG_CHANGE_CAPS
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_ALT_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_CTRL_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_WIN_SPACE
|
||||
|
||||
#define RGBLIGHT_LAYERS
|
||||
|
||||
|
||||
|
||||
// Holding mouse movement keys moves the cursor at constant speeds
|
||||
#define MK_3_SPEED
|
||||
// The chosen speed is only active while you hold the respective key. When the key is raised, mouse keys returns to the unmodified speed.
|
||||
// Momentary: KC_ACL0 < KC_ACL1 < unmodified < KC_ACL2
|
||||
// #define MK_MOMENTARY_ACCEL
|
||||
|
||||
// Cursor offset per movement (unmodified). Default: 16
|
||||
// #define MK_C_OFFSET_UNMOD 16
|
||||
|
||||
// Time between cursor movements (unmodified). Default: 16
|
||||
// #define MK_C_INTERVAL_UNMOD 16
|
||||
|
||||
// Cursor offset per movement (KC_ACL0). Default: 1
|
||||
// #define MK_C_OFFSET_0 1
|
||||
|
||||
// Time between cursor movements (KC_ACL0). Default: 32
|
||||
// #define MK_C_INTERVAL_0 32
|
||||
|
||||
// Cursor offset per movement (KC_ACL1). Default: 4
|
||||
// #define MK_C_OFFSET_1 4
|
||||
|
||||
// Time between cursor movements (KC_ACL1). Default: 16
|
||||
// #define MK_C_INTERVAL_1 16
|
||||
|
||||
// Cursor offset per movement (KC_ACL2). Default: 32
|
||||
// #define MK_C_OFFSET_2 32
|
||||
|
||||
// Time between cursor movements (KC_ACL2). Default: 16
|
||||
// #define MK_C_INTERVAL_2 16
|
||||
|
||||
// Scroll steps per scroll action (unmodified). Default: 1
|
||||
// #define MK_W_OFFSET_UNMOD 1
|
||||
|
||||
// Time between scroll steps (unmodified). Default: 40
|
||||
// #define MK_W_INTERVAL_UNMOD 40
|
||||
|
||||
// Scroll steps per scroll action (KC_ACL0). Default: 1
|
||||
// #define MK_W_OFFSET_0 1
|
||||
|
||||
// Time between scroll steps (KC_ACL0). Default: 360
|
||||
// #define MK_W_INTERVAL_0 360
|
||||
|
||||
// Scroll steps per scroll action (KC_ACL1). Default: 1
|
||||
// #define MK_W_OFFSET_1 1
|
||||
|
||||
// Time between scroll steps (KC_ACL1). Default: 120
|
||||
// #define MK_W_INTERVAL_1 120
|
||||
|
||||
// Scroll steps per scroll action (KC_ACL2). Default: 1
|
||||
// #define MK_W_OFFSET_2 1
|
||||
|
||||
// Time between scroll steps (KC_ACL2). Default: 20
|
||||
// #define MK_W_INTERVAL_2 20
|
||||
284
corne/v3qmk/keymap.c
Normal file
284
corne/v3qmk/keymap.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
Copyright 2019 @foostan
|
||||
Copyright 2020 Drashna Jaelre <@drashna>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#define CUSTOM_SAFE_RANGE SAFE_RANGE
|
||||
#include "lang_shift/include.h"
|
||||
|
||||
#define L_ENG 0
|
||||
#define L_GAME 1
|
||||
#define L_RU 2
|
||||
#define L_MEDIA 3
|
||||
#define L_NAV 4
|
||||
#define L_MOUSE 5
|
||||
#define L_SYM 6
|
||||
#define L_NUM 7
|
||||
#define L_FUN 8
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[L_ENG] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_ESC, G(KC_ESC), XXXXXXX, KC_X, KC_Q, DF(L_GAME), KC_J, KC_D, KC_L, KC_K, KC_C, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_F, LWIN_T(KC_S),ALT_T(KC_E),CTL_T(KC_O),SFT_T(KC_A), XXXXXXX, KC_G, SFT_T(KC_T),CTL_T(KC_N),ALT_T(KC_V),LWIN_T(KC_H), ONCE_SHIFT,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_W, KC_U, KC_Y, KC_I, XXXXXXX, KC_B, KC_M, KC_R, KC_P, KC_Z, LA_CHNG,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LT(L_MEDIA, KC_ENT), LT(L_MOUSE, KC_BSPC), MO(L_NAV), MO(L_SYM), LT(L_FUN, KC_SPC), MO(L_NUM)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
),
|
||||
|
||||
[L_RU] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_ESC, KC_O, KC_QUOT, KC_Z, KC_S, KC_RBRC, KC_Q, KC_L, KC_K, KC_R, KC_W, KC_SCLN,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_A, LWIN_T(KC_C),ALT_T(KC_T),CTL_T(KC_J),SFT_T(KC_F), KC_M, KC_U, SFT_T(KC_N),CTL_T(KC_Y),ALT_T(KC_D),LWIN_T(KC_LBRC), KC_X,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LA_CHNG, KC_I, KC_DOT, KC_E, KC_B, KC_GRV, KC_COMM, KC_V, KC_H, KC_G, KC_P, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LT(L_MEDIA, KC_ENT), LT(L_MOUSE, KC_BSPC), MO(L_NAV), MO(L_SYM), LT(L_FUN, KC_SPC), MO(L_NUM)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
),
|
||||
|
||||
[L_MEDIA] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, KC_RWIN, KC_RALT, KC_RCTL, KC_RSFT, XXXXXXX, NK_ON, KC_VOLD, KC_VOLU, LA_SYNC, RGB_TOG, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, NK_TOGG, KC_MPLY, KC_MPRV, KC_MNXT, KC_MUTE, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_RWIN, KC_RALT, KC_RCTL, KC_RSFT, XXXXXXX, NK_OFF, LA_CAPS, LA_ALSH, LA_CTSH, LA_WISP, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_NAV] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, C(KC_Y), C(KC_V), C(KC_C), C(KC_X), C(KC_Z), C(KC_S),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TAB,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_DEL,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_MOUSE] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, KC_BTN5, KC_BTN1, KC_BTN3, KC_BTN2, XXXXXXX, C(KC_Y), C(KC_V), C(KC_C), C(KC_X), C(KC_Z), C(KC_S),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_TAB,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_BTN4, KC_ACL2, KC_ACL1, KC_ACL0, XXXXXXX, KC_INS, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, KC_DEL,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN3, KC_BTN2
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_SYM] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, EN_AT, EN_HASH, ONCE_SHIFT, AG_DOT, EN_CIRC, EN_AMPR, AG_ASTR, AG_MINS, AG_EQL, AG_PLUS, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
AG_COMM, AG_EXCL, AG_QUES, COMMA_SPACE, SMART_DOT, AG_PERC, EN_PIPE, AG_LPRN, EN_LCBR, EN_LBRC, EN_LT, EN_GRV,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
CW_TOGG, EN_SLSH, RU_NUME, AG_DQUO, EN_QUOT, EN_DLR, AG_BSLS, AG_RPRN, EN_RCBR, EN_RBRC, EN_GT, EN_TILD,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
AG_UNDS, AG_COLN, AG_SCLN, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_NUM] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, AG_1, AG_2, AG_3, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, AG_0, AG_4, AG_5, AG_6, XXXXXXX, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LWIN, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_PSCR, AG_7, AG_8, AG_9, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_ENT, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_FUN] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, KC_F10, KC_F1, KC_F2, KC_F3, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_F11, KC_F4, KC_F5, KC_F6, XXXXXXX, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LWIN, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_F12, KC_F7, KC_F8, KC_F9, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_GAME] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_TAB, KC_T, KC_Q, KC_W, KC_E, KC_R, KC_Y, KC_U, KC_I, KC_O, KC_P, DF(L_ENG),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LSFT, KC_G, KC_A, KC_S, KC_D, KC_F, KC_H, KC_J, KC_UP, KC_K, KC_L, KC_GRV,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LCTL, KC_B, KC_Z, KC_X, KC_C, KC_V, KC_N, KC_LEFT, KC_DOWN, KC_RGHT, KC_M, KC_SLSH,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LALT, KC_SPC, LT(L_NUM, KC_ESC), KC_H, KC_SPC, LT(L_FUN, KC_ENT)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
bool shift_on_next_key = false;
|
||||
|
||||
// Обработка нажатий?
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { // В конце должно быть true, чтоб символ напечатался.
|
||||
// lang_shift
|
||||
if (!lang_shift_process_record(keycode, record))
|
||||
return false;
|
||||
|
||||
|
||||
// Одиночный шифт от GPT4. Потому что одиночный шифт lang_shift не нравится. Но этот шифт не умеет работать с кастом кейкодами lang_shift
|
||||
if (keycode == ONCE_SHIFT && record->event.pressed) {
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shift_on_next_key && record->event.pressed) {
|
||||
register_code(KC_LSFT);
|
||||
register_code(keycode);
|
||||
unregister_code(keycode);
|
||||
unregister_code(KC_LSFT);
|
||||
shift_on_next_key = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Умная точка
|
||||
if (keycode == SMART_DOT && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Запятая + пробел
|
||||
if (keycode == COMMA_SPACE && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Если условия выше не сработали, то отправить символ как есть
|
||||
};
|
||||
|
||||
void user_timer(void) {
|
||||
lang_shift_user_timer();
|
||||
};
|
||||
|
||||
|
||||
// Lighting Layers
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_ENG:
|
||||
rgblight_sethsv(HSV_PINK);
|
||||
break;
|
||||
case L_GAME:
|
||||
rgblight_sethsv(HSV_ORANGE);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgblight_sethsv(HSV_WHITE);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_RU:
|
||||
rgblight_sethsv(HSV_PURPLE);
|
||||
break;
|
||||
case L_MEDIA:
|
||||
rgblight_sethsv(HSV_MAGENTA);
|
||||
break;
|
||||
case L_NAV:
|
||||
rgblight_sethsv(HSV_CYAN);
|
||||
break;
|
||||
case L_MOUSE:
|
||||
rgblight_sethsv(HSV_YELLOW);
|
||||
break;
|
||||
case L_SYM:
|
||||
rgblight_sethsv(HSV_GREEN);
|
||||
break;
|
||||
case L_NUM:
|
||||
rgblight_sethsv(HSV_BLUE);
|
||||
break;
|
||||
case L_FUN:
|
||||
rgblight_sethsv(HSV_RED);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgblight_sethsv(HSV_WHITE);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
user_timer();
|
||||
|
||||
// Проверяем, активен ли слой
|
||||
if (!layer_state_cmp(layer_state, L_MEDIA) &&
|
||||
!layer_state_cmp(layer_state, L_NAV) &&
|
||||
!layer_state_cmp(layer_state, L_MOUSE) &&
|
||||
!layer_state_cmp(layer_state, L_SYM) &&
|
||||
!layer_state_cmp(layer_state, L_NUM) &&
|
||||
!layer_state_cmp(layer_state, L_FUN) &&
|
||||
!layer_state_cmp(layer_state, L_RU)) {
|
||||
// Если ни один из этих слоев не активен, обновляем подсветку на основе текущего базового слоя
|
||||
default_layer_state_set_user(default_layer_state);
|
||||
}
|
||||
}
|
||||
|
||||
bool caps_word_press_user(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
// Keycodes that continue Caps Word, with shift applied.
|
||||
case KC_A ... KC_Z:
|
||||
case KC_MINS:
|
||||
case KC_QUOT:
|
||||
case KC_RBRC:
|
||||
case KC_SCLN:
|
||||
case KC_COMM:
|
||||
case KC_GRV:
|
||||
case KC_LBRC:
|
||||
case KC_DOT:
|
||||
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
|
||||
return true;
|
||||
|
||||
// Keycodes that continue Caps Word, without shifting.
|
||||
case KC_1 ... KC_0:
|
||||
case KC_BSPC:
|
||||
case KC_DEL:
|
||||
case KC_UNDS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false; // Deactivate Caps Word.
|
||||
}
|
||||
}
|
||||
341
corne/v3qmk/lang_shift/include.h
Normal file
341
corne/v3qmk/lang_shift/include.h
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef CUSTOM_SAFE_RANGE
|
||||
#error "You must specify variable CUSTOM_SAFE_RANGE for lang_shift extension."
|
||||
#endif
|
||||
|
||||
enum lang_shift_keycodes {
|
||||
LANG_SHIFT_START = CUSTOM_SAFE_RANGE,
|
||||
|
||||
// Кейкоды, на основе которых реализуются кейкоды ниже, пользователю их лучше не использовать.
|
||||
#include "private_keycodes.h"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Английские символы */
|
||||
EN_GRV, /* ` */
|
||||
EN_TILD, /* ~ */
|
||||
EN_1, /* 1 */
|
||||
EN_EXCL, /* ! */
|
||||
EN_2, /* 2 */
|
||||
EN_AT, /* @ */
|
||||
EN_3, /* 3 */
|
||||
EN_HASH, /* # */
|
||||
EN_4, /* 4 */
|
||||
EN_DLR, /* $ */
|
||||
EN_5, /* 5 */
|
||||
EN_PERC, /* % */
|
||||
EN_6, /* 6 */
|
||||
EN_CIRC, /* ^ */
|
||||
EN_7, /* 7 */
|
||||
EN_AMPR, /* & */
|
||||
EN_8, /* 8 */
|
||||
EN_ASTR, /* * */
|
||||
EN_9, /* 9 */
|
||||
EN_LPRN, /* ( */
|
||||
EN_0, /* 0 */
|
||||
EN_RPRN, /* ) */
|
||||
EN_MINS, /* - */
|
||||
EN_UNDS, /* _ */
|
||||
EN_EQL, /* = */
|
||||
EN_PLUS, /* + */
|
||||
|
||||
EN_Q, /* q */
|
||||
EN_S_Q, /* Q */
|
||||
EN_W, /* w */
|
||||
EN_S_W, /* W */
|
||||
EN_E, /* e */
|
||||
EN_S_E, /* E */
|
||||
EN_R, /* r */
|
||||
EN_S_R, /* R */
|
||||
EN_T, /* t */
|
||||
EN_S_T, /* T */
|
||||
EN_Y, /* y */
|
||||
EN_S_Y, /* Y */
|
||||
EN_U, /* u */
|
||||
EN_S_U, /* U */
|
||||
EN_I, /* i */
|
||||
EN_S_I, /* I */
|
||||
EN_O, /* o */
|
||||
EN_S_O, /* O */
|
||||
EN_P, /* p */
|
||||
EN_S_P, /* P */
|
||||
EN_LBRC, /* [ */
|
||||
EN_LCBR, /* { */
|
||||
EN_RBRC, /* ] */
|
||||
EN_RCBR, /* } */
|
||||
|
||||
EN_A, /* a */
|
||||
EN_S_A, /* A */
|
||||
EN_S, /* s */
|
||||
EN_S_S, /* S */
|
||||
EN_D, /* d */
|
||||
EN_S_D, /* D */
|
||||
EN_F, /* f */
|
||||
EN_S_F, /* F */
|
||||
EN_G, /* g */
|
||||
EN_S_G, /* G */
|
||||
EN_H, /* h */
|
||||
EN_S_H, /* H */
|
||||
EN_J, /* j */
|
||||
EN_S_J, /* J */
|
||||
EN_K, /* k */
|
||||
EN_S_K, /* K */
|
||||
EN_L, /* l */
|
||||
EN_S_L, /* L */
|
||||
EN_SCLN, /* ; */
|
||||
EN_COLN, /* : */
|
||||
EN_QUOT, /* ' */
|
||||
EN_DQUO, /* " */
|
||||
EN_BSLS, /* \ */
|
||||
EN_PIPE, /* | */
|
||||
|
||||
EN_Z, /* z */
|
||||
EN_S_Z, /* Z */
|
||||
EN_X, /* x */
|
||||
EN_S_X, /* X */
|
||||
EN_C, /* c */
|
||||
EN_S_C, /* C */
|
||||
EN_V, /* v */
|
||||
EN_S_V, /* V */
|
||||
EN_B, /* b */
|
||||
EN_S_B, /* B */
|
||||
EN_N, /* n */
|
||||
EN_S_N, /* N */
|
||||
EN_M, /* m */
|
||||
EN_S_M, /* M */
|
||||
EN_COMM, /* , */
|
||||
EN_LT, /* < */
|
||||
EN_DOT, /* . */
|
||||
EN_GT, /* > */
|
||||
EN_SLSH, /* / */
|
||||
EN_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Русские символы */
|
||||
RU_JO, /* ё */
|
||||
RU_S_JO, /* Ё */
|
||||
RU_1, /* 1 */
|
||||
RU_EXCL, /* ! */
|
||||
RU_2, /* 2 */
|
||||
RU_DQUO, /* " */
|
||||
RU_3, /* 3 */
|
||||
RU_NUME, /* № */
|
||||
RU_4, /* 4 */
|
||||
RU_SCLN, /* ; */
|
||||
RU_5, /* 5 */
|
||||
RU_PERC, /* % */
|
||||
RU_6, /* 6 */
|
||||
RU_COLN, /* : */
|
||||
RU_7, /* 7 */
|
||||
RU_QUES, /* ? */
|
||||
RU_8, /* 8 */
|
||||
RU_ASTR, /* * */
|
||||
RU_9, /* 9 */
|
||||
RU_LPRN, /* ( */
|
||||
RU_0, /* 0 */
|
||||
RU_RPRN, /* ) */
|
||||
RU_MINS, /* - */
|
||||
RU_UNDS, /* _ */
|
||||
RU_EQL, /* = */
|
||||
RU_PLUS, /* + */
|
||||
|
||||
RU_J, /* й */
|
||||
RU_S_J, /* Й */
|
||||
RU_TS, /* ц */
|
||||
RU_S_TS, /* Ц */
|
||||
RU_U, /* у */
|
||||
RU_S_U, /* У */
|
||||
RU_K, /* к */
|
||||
RU_S_K, /* К */
|
||||
RU_JE, /* е */
|
||||
RU_S_JE, /* Е */
|
||||
RU_N, /* н */
|
||||
RU_S_N, /* Н */
|
||||
RU_G, /* г */
|
||||
RU_S_G, /* Г */
|
||||
RU_SH, /* ш */
|
||||
RU_S_SH, /* Ш */
|
||||
RU_SC, /* щ */
|
||||
RU_S_SC, /* Щ */
|
||||
RU_Z, /* з */
|
||||
RU_S_Z, /* З */
|
||||
RU_H, /* х */
|
||||
RU_S_H, /* Х */
|
||||
RU_HD, /* ъ */
|
||||
RU_S_HD, /* Ъ */
|
||||
|
||||
RU_F, /* ф */
|
||||
RU_S_F, /* Ф */
|
||||
RU_Y, /* ы */
|
||||
RU_S_Y, /* Ы */
|
||||
RU_V, /* в */
|
||||
RU_S_V, /* В */
|
||||
RU_A, /* а */
|
||||
RU_S_A, /* А */
|
||||
RU_P, /* п */
|
||||
RU_S_P, /* п */
|
||||
RU_R, /* р */
|
||||
RU_S_R, /* Р */
|
||||
RU_O, /* о */
|
||||
RU_S_O, /* О */
|
||||
RU_L, /* л */
|
||||
RU_S_L, /* Л */
|
||||
RU_D, /* д */
|
||||
RU_S_D, /* Д */
|
||||
RU_ZH, /* ж */
|
||||
RU_S_ZH, /* Ж */
|
||||
RU_E, /* э */
|
||||
RU_S_E, /* Э */
|
||||
RU_BSLS, /* \ */
|
||||
RU_SLSH, /* / */
|
||||
|
||||
RU_JA, /* я */
|
||||
RU_S_JA, /* Я */
|
||||
RU_CH, /* ч */
|
||||
RU_S_CH, /* Ч */
|
||||
RU_S, /* с */
|
||||
RU_S_S, /* С */
|
||||
RU_M, /* м */
|
||||
RU_S_M, /* М */
|
||||
RU_I, /* и */
|
||||
RU_S_I, /* И */
|
||||
RU_T, /* т */
|
||||
RU_S_T, /* Т */
|
||||
RU_SF, /* ь */
|
||||
RU_S_SF, /* Ь */
|
||||
RU_B, /* б */
|
||||
RU_S_B, /* Б */
|
||||
RU_JU, /* ю */
|
||||
RU_S_JU, /* Ю */
|
||||
RU_DOT, /* . */
|
||||
RU_COMM, /* , */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Символы, нажимаемые независимо от текущего языка. Language-agnostic-keycodes. */
|
||||
AG_1, /* 1 */
|
||||
AG_2, /* 2 */
|
||||
AG_3, /* 3 */
|
||||
AG_4, /* 4 */
|
||||
AG_5, /* 5 */
|
||||
AG_6, /* 6 */
|
||||
AG_7, /* 7 */
|
||||
AG_8, /* 8 */
|
||||
AG_9, /* 9 */
|
||||
AG_0, /* 0 */
|
||||
AG_EXCL, /* ! */
|
||||
AG_PERC, /* % */
|
||||
AG_ASTR, /* * */
|
||||
AG_LPRN, /* ( */
|
||||
AG_RPRN, /* ) */
|
||||
AG_MINS, /* - */
|
||||
AG_UNDS, /* _ */
|
||||
AG_EQL, /* = */
|
||||
AG_PLUS, /* + */
|
||||
AG_SCLN, /* ; */
|
||||
AG_COLN, /* : */
|
||||
AG_DQUO, /* " */
|
||||
AG_BSLS, /* \ */
|
||||
AG_COMM, /* , */
|
||||
AG_DOT, /* . */
|
||||
AG_SLSH, /* / */
|
||||
AG_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кастомные language-agnostic-кейкоды */
|
||||
AG_3DOT, /* ... */
|
||||
AG_SDOT, /* Space + Dot + Shift to next key */
|
||||
AG_CMSP, /* Comma + Space */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Шифты для набора текста. */
|
||||
SFT_N, /* Работает как обычный шифт, при её зажатии, шифт зажат. Параллельно переключает на (шифтовый) следующий слой относительно текущего языка (если язык 0, то включает слой 1, если язык 1, то включает слой 3). */
|
||||
SFT_N_O, /* Данная клавиша применит шифт и переключение на шифтовый слой только к следующему символу. Неважно, была ли она нажата одновременно со следующей клавишей, или до неё, или вместе с двумя клавишами. Применится только к одной клавише. То есть это как залипающий шифт, если нажимать отдельно от всех клавиш, и как одиночный шифт, если эту клавишу зажимать. Такая клавиша может пригодиться если вы печатаете с большой скоростью и вам сложно выдерживать время удержания шифта, и у вас получается что-то вроде "ПРивет". */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Модификаторы, переключащие текущий слой на 0. Такое нужно чтобы при включённом русском языке были такие же хоткеи с модификаторами, как и на английском языке. */
|
||||
CTRL_0, /* Ctrl on 0 layer */
|
||||
ALT_0, /* Alt on 0 layer */
|
||||
WIN_0, /* Win on 0 layer */
|
||||
SHAL_0, /* Shift+Alt on 0 layer */
|
||||
CTAL_0, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_0, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_0, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* А данные модификаторы помимо включения 0 слоя ещё и переключают язык на английский. Такое разделение нужно, потому что у некоторых смена языка идёт на комбинации с Ctrl, или Shift, и у них может сниматься выделение текста, например. */
|
||||
CTRL_EN, /* Ctrl on 0 layer */
|
||||
ALT_EN, /* Alt on 0 layer */
|
||||
WIN_EN, /* Win on 0 layer */
|
||||
SHAL_EN, /* Shift+Alt on 0 layer */
|
||||
CTAL_EN, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_EN, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_EN, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кнопки, отвечающие за переключение языка. */
|
||||
LA_CHNG, /* Переключает язык и переключает на 2 или 0 слой в зависимости от текущего языка. */
|
||||
LA_SYNC, /* Кнопка для синхронизации языков. Её нужно нажимать в случае если язык в системе и язык в клавиатуре различаются. Данная клавиша изменит язык в системе. */
|
||||
LA_CAPS, /* Задаёт переключение языка на Caps. */
|
||||
LA_ALSH, /* Задаёт переключение языка на Alt + Shift. */
|
||||
LA_SHAL, /* Задаёт переключение языка на Shift + Alt. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_CTSH, /* Задаёт переключение языка на Ctrl + Shift. */
|
||||
LA_SHCT, /* Задаёт переключение языка на Shift + Ctrl. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_WISP, /* Задаёт переключение языка на Win + Shift. */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кейкоды от Buliway. */
|
||||
ONCE_SHIFT, /* Зажимает шифт до тех пор, пока не будет нажата любая другая клавиша. Не работает с кастом кейкодами, только стандартные */
|
||||
SMART_DOT, /* Отправить агностик точку из lang_shift, нажать пробел, активировать одиночный шифт ONCE_SHIFT */
|
||||
COMMA_SPACE, /* Отправить агностик запятую из lang_shift, нажать пробел */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* SAFE_RANGE данной библиотеки. */
|
||||
LANG_SHIFT_NEW_SAFE_RANGE,
|
||||
#undef CUSTOM_SAFE_RANGE
|
||||
#define CUSTOM_SAFE_RANGE LANG_SHIFT_NEW_SAFE_RANGE
|
||||
};
|
||||
|
||||
typedef uint16_t Key;
|
||||
#define NONE_KEY (uint16_t)(65535)
|
||||
|
||||
typedef uint8_t Lang;
|
||||
#define NONE_LANG (uint8_t)(255)
|
||||
|
||||
typedef uint8_t Shift;
|
||||
#define NONE_SHIFT (uint8_t)(255)
|
||||
|
||||
// Способ смены языка
|
||||
enum LangChange {
|
||||
LANG_CHANGE_CAPS,
|
||||
LANG_CHANGE_ALT_SHIFT,
|
||||
LANG_CHANGE_SHIFT_ALT,
|
||||
LANG_CHANGE_CTRL_SHIFT,
|
||||
LANG_CHANGE_SHIFT_CTRL,
|
||||
LANG_CHANGE_WIN_SPACE
|
||||
};
|
||||
|
||||
// Переменная, в которой можно менять текущий способ смены языка
|
||||
enum LangChange lang_current_change =
|
||||
#ifdef LANG_CHANGE_DEFAULT
|
||||
LANG_CHANGE_DEFAULT;
|
||||
#else
|
||||
#error "You must specify default language change method by defining variable LANG_CHANGE_DEFAULT."
|
||||
#endif
|
||||
|
||||
void shift_activate(Shift shift);
|
||||
void shift_activate_from_user(Shift shift);
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer);
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void);
|
||||
void lang_synchronize(void);
|
||||
void lang_activate(Lang lang);
|
||||
void lang_activate_from_user(Lang lang);
|
||||
|
||||
void lang_shift_press_key(Key key, bool down);
|
||||
void lang_shift_tap_key(Key key);
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record);
|
||||
void lang_shift_user_timer(void);
|
||||
|
||||
// Инклюжу код напрямую, потому что нельзя сделать линковку, ведь код внутри использует кейкоды отсюда, и обязательно нужно это делать через safe_range
|
||||
#include "src.c"
|
||||
97
corne/v3qmk/lang_shift/private_keycodes.h
Normal file
97
corne/v3qmk/lang_shift/private_keycodes.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
KS_GRV, /* ` */
|
||||
KS_TILD, /* ~ */
|
||||
KS_1, /* 1 */
|
||||
KS_EXCL, /* ! */
|
||||
KS_2, /* 2 */
|
||||
KS_AT, /* @ */
|
||||
KS_3, /* 3 */
|
||||
KS_HASH, /* # */
|
||||
KS_4, /* 4 */
|
||||
KS_DLR, /* $ */
|
||||
KS_5, /* 5 */
|
||||
KS_PERC, /* % */
|
||||
KS_6, /* 6 */
|
||||
KS_CIRC, /* ^ */
|
||||
KS_7, /* 7 */
|
||||
KS_AMPR, /* & */
|
||||
KS_8, /* 8 */
|
||||
KS_ASTR, /* * */
|
||||
KS_9, /* 9 */
|
||||
KS_LPRN, /* ( */
|
||||
KS_0, /* 0 */
|
||||
KS_RPRN, /* ) */
|
||||
KS_MINS, /* - */
|
||||
KS_UNDS, /* _ */
|
||||
KS_EQL, /* = */
|
||||
KS_PLUS, /* + */
|
||||
|
||||
KS_Q, /* q */
|
||||
KS_S_Q, /* Q */
|
||||
KS_W, /* w */
|
||||
KS_S_W, /* W */
|
||||
KS_E, /* e */
|
||||
KS_S_E, /* E */
|
||||
KS_R, /* r */
|
||||
KS_S_R, /* R */
|
||||
KS_T, /* t */
|
||||
KS_S_T, /* T */
|
||||
KS_Y, /* y */
|
||||
KS_S_Y, /* Y */
|
||||
KS_U, /* u */
|
||||
KS_S_U, /* U */
|
||||
KS_I, /* i */
|
||||
KS_S_I, /* I */
|
||||
KS_O, /* o */
|
||||
KS_S_O, /* O */
|
||||
KS_P, /* p */
|
||||
KS_S_P, /* P */
|
||||
KS_LBRC, /* [ */
|
||||
KS_LCBR, /* { */
|
||||
KS_RBRC, /* ] */
|
||||
KS_RCBR, /* } */
|
||||
|
||||
KS_A, /* a */
|
||||
KS_S_A, /* A */
|
||||
KS_S, /* s */
|
||||
KS_S_S, /* S */
|
||||
KS_D, /* d */
|
||||
KS_S_D, /* D */
|
||||
KS_F, /* f */
|
||||
KS_S_F, /* F */
|
||||
KS_G, /* g */
|
||||
KS_S_G, /* G */
|
||||
KS_H, /* h */
|
||||
KS_S_H, /* H */
|
||||
KS_J, /* j */
|
||||
KS_S_J, /* J */
|
||||
KS_K, /* k */
|
||||
KS_S_K, /* K */
|
||||
KS_L, /* l */
|
||||
KS_S_L, /* L */
|
||||
KS_SCLN, /* ; */
|
||||
KS_COLN, /* : */
|
||||
KS_QUOT, /* ' */
|
||||
KS_DQUO, /* " */
|
||||
KS_BSLS, /* \ */
|
||||
KS_PIPE, /* | */
|
||||
|
||||
KS_Z, /* z */
|
||||
KS_S_Z, /* Z */
|
||||
KS_X, /* x */
|
||||
KS_S_X, /* X */
|
||||
KS_C, /* c */
|
||||
KS_S_C, /* C */
|
||||
KS_V, /* v */
|
||||
KS_S_V, /* V */
|
||||
KS_B, /* b */
|
||||
KS_S_B, /* B */
|
||||
KS_N, /* n */
|
||||
KS_S_N, /* N */
|
||||
KS_M, /* m */
|
||||
KS_S_M, /* M */
|
||||
KS_COMM, /* , */
|
||||
KS_LT, /* < */
|
||||
KS_DOT, /* . */
|
||||
KS_GT, /* > */
|
||||
KS_SLSH, /* / */
|
||||
KS_QUES, /* ? */
|
||||
665
corne/v3qmk/lang_shift/src.c
Normal file
665
corne/v3qmk/lang_shift/src.c
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
// ---------------------------------------------------------------------------
|
||||
// Работа с шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Shift shift_should_be = 0;
|
||||
Shift shift_current = 0;
|
||||
uint32_t shift_timer = 0;
|
||||
uint8_t shift_pressed_count = 0;
|
||||
|
||||
Key shift_get_key(Key key) {
|
||||
switch (key) {
|
||||
case KS_GRV: return KC_GRV;
|
||||
case KS_TILD: return KC_GRV;
|
||||
case KS_1: return KC_1;
|
||||
case KS_EXCL: return KC_1;
|
||||
case KS_2: return KC_2;
|
||||
case KS_AT: return KC_2;
|
||||
case KS_3: return KC_3;
|
||||
case KS_HASH: return KC_3;
|
||||
case KS_4: return KC_4;
|
||||
case KS_DLR: return KC_4;
|
||||
case KS_5: return KC_5;
|
||||
case KS_PERC: return KC_5;
|
||||
case KS_6: return KC_6;
|
||||
case KS_CIRC: return KC_6;
|
||||
case KS_7: return KC_7;
|
||||
case KS_AMPR: return KC_7;
|
||||
case KS_8: return KC_8;
|
||||
case KS_ASTR: return KC_8;
|
||||
case KS_9: return KC_9;
|
||||
case KS_LPRN: return KC_9;
|
||||
case KS_0: return KC_0;
|
||||
case KS_RPRN: return KC_0;
|
||||
case KS_MINS: return KC_MINS;
|
||||
case KS_UNDS: return KC_MINS;
|
||||
case KS_EQL: return KC_EQL;
|
||||
case KS_PLUS: return KC_EQL;
|
||||
case KS_Q: return KC_Q;
|
||||
case KS_S_Q: return KC_Q;
|
||||
case KS_W: return KC_W;
|
||||
case KS_S_W: return KC_W;
|
||||
case KS_E: return KC_E;
|
||||
case KS_S_E: return KC_E;
|
||||
case KS_R: return KC_R;
|
||||
case KS_S_R: return KC_R;
|
||||
case KS_T: return KC_T;
|
||||
case KS_S_T: return KC_T;
|
||||
case KS_Y: return KC_Y;
|
||||
case KS_S_Y: return KC_Y;
|
||||
case KS_U: return KC_U;
|
||||
case KS_S_U: return KC_U;
|
||||
case KS_I: return KC_I;
|
||||
case KS_S_I: return KC_I;
|
||||
case KS_O: return KC_O;
|
||||
case KS_S_O: return KC_O;
|
||||
case KS_P: return KC_P;
|
||||
case KS_S_P: return KC_P;
|
||||
case KS_LBRC: return KC_LBRC;
|
||||
case KS_LCBR: return KC_LBRC;
|
||||
case KS_RBRC: return KC_RBRC;
|
||||
case KS_RCBR: return KC_RBRC;
|
||||
case KS_A: return KC_A;
|
||||
case KS_S_A: return KC_A;
|
||||
case KS_S: return KC_S;
|
||||
case KS_S_S: return KC_S;
|
||||
case KS_D: return KC_D;
|
||||
case KS_S_D: return KC_D;
|
||||
case KS_F: return KC_F;
|
||||
case KS_S_F: return KC_F;
|
||||
case KS_G: return KC_G;
|
||||
case KS_S_G: return KC_G;
|
||||
case KS_H: return KC_H;
|
||||
case KS_S_H: return KC_H;
|
||||
case KS_J: return KC_J;
|
||||
case KS_S_J: return KC_J;
|
||||
case KS_K: return KC_K;
|
||||
case KS_S_K: return KC_K;
|
||||
case KS_L: return KC_L;
|
||||
case KS_S_L: return KC_L;
|
||||
case KS_SCLN: return KC_SCLN;
|
||||
case KS_COLN: return KC_SCLN;
|
||||
case KS_QUOT: return KC_QUOT;
|
||||
case KS_DQUO: return KC_QUOT;
|
||||
case KS_BSLS: return KC_BSLS;
|
||||
case KS_PIPE: return KC_BSLS;
|
||||
case KS_Z: return KC_Z;
|
||||
case KS_S_Z: return KC_Z;
|
||||
case KS_X: return KC_X;
|
||||
case KS_S_X: return KC_X;
|
||||
case KS_C: return KC_C;
|
||||
case KS_S_C: return KC_C;
|
||||
case KS_V: return KC_V;
|
||||
case KS_S_V: return KC_V;
|
||||
case KS_B: return KC_B;
|
||||
case KS_S_B: return KC_B;
|
||||
case KS_N: return KC_N;
|
||||
case KS_S_N: return KC_N;
|
||||
case KS_M: return KC_M;
|
||||
case KS_S_M: return KC_M;
|
||||
case KS_COMM: return KC_COMM;
|
||||
case KS_LT: return KC_COMM;
|
||||
case KS_DOT: return KC_DOT;
|
||||
case KS_GT: return KC_DOT;
|
||||
case KS_SLSH: return KC_SLSH;
|
||||
case KS_QUES: return KC_SLSH;
|
||||
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Shift shift_get_shift(Key key) {
|
||||
if (KS_GRV <= key && key <= KS_QUES) {
|
||||
return (key - KS_GRV) % 2;
|
||||
} else {
|
||||
return NONE_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_activate(Shift shift) {
|
||||
if (shift_current != shift) {
|
||||
shift_timer = timer_read();
|
||||
if (shift) {
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
}
|
||||
shift_current = shift;
|
||||
}
|
||||
|
||||
void shift_activate_from_user(Shift shift) {
|
||||
shift_should_be = shift;
|
||||
shift_activate(shift);
|
||||
}
|
||||
|
||||
Key shift_process(Key key, bool down) {
|
||||
Shift new_shift = shift_get_shift(key);
|
||||
if (down) {
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
shift_activate(new_shift);
|
||||
} else {
|
||||
shift_activate(shift_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
if (down) {
|
||||
shift_pressed_count++;
|
||||
} else {
|
||||
shift_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return shift_get_key(key);
|
||||
}
|
||||
|
||||
void shift_user_timer(void) {
|
||||
// Нужно выключать шифт после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (shift_pressed_count == 0 && shift_current != shift_should_be && timer_read() - shift_timer >= 100) {
|
||||
shift_activate(shift_should_be);
|
||||
shift_timer = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с одиночным шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t shift_once_disable_stage = 2;
|
||||
uint8_t shift_once_layer_off = 0;
|
||||
uint8_t shift_once_layer_current = 0;
|
||||
uint32_t shift_once_enabled_time = 0;
|
||||
bool shift_once_can_disable = true;
|
||||
|
||||
bool shift_once_is_enabled(void) {
|
||||
return shift_once_disable_stage == 2;
|
||||
}
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer) {
|
||||
if (shift_current == 0) {
|
||||
shift_activate_from_user(true);
|
||||
layer_on(layer);
|
||||
shift_once_disable_stage = 2;
|
||||
shift_once_layer_off = layer;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process_key(uint8_t layer, bool down) {
|
||||
if (down) {
|
||||
shift_once_use_to_next_key(layer);
|
||||
shift_once_can_disable = false;
|
||||
} else {
|
||||
shift_once_can_disable = true;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_disable(void) {
|
||||
if (shift_once_disable_stage == 2) {
|
||||
layer_off(shift_once_layer_off);
|
||||
shift_activate_from_user(false);
|
||||
shift_once_disable_stage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
if (shift_once_disable_stage == 1) {
|
||||
shift_once_disable_stage = 0;
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
if (down && key != SFT_N_O && shift_once_disable_stage == 2) {
|
||||
shift_once_disable_stage = 1;
|
||||
layer_off(shift_once_layer_off);
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_user_timer(void) {
|
||||
if (shift_once_can_disable && shift_once_is_enabled() && timer_read() - shift_once_enabled_time >= 1000) {
|
||||
shift_once_disable();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с языком
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Lang lang_should_be = 0;
|
||||
Lang lang_current = 0;
|
||||
uint32_t lang_timer = 0;
|
||||
uint8_t lang_pressed_count = 0;
|
||||
|
||||
Key lang_get_key(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return (key - EN_GRV) + KS_GRV;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return (key - RU_JO) + KS_GRV;
|
||||
} else {
|
||||
return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Lang lang_get_lang(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return 0;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return 1;
|
||||
} else {
|
||||
return NONE_LANG;
|
||||
}
|
||||
}
|
||||
|
||||
Key lang_calc_agnostic(Key key) {
|
||||
if (lang_current == 0) {
|
||||
switch (key) {
|
||||
case AG_1: return EN_1;
|
||||
case AG_2: return EN_2;
|
||||
case AG_3: return EN_3;
|
||||
case AG_4: return EN_4;
|
||||
case AG_5: return EN_5;
|
||||
case AG_6: return EN_6;
|
||||
case AG_7: return EN_7;
|
||||
case AG_8: return EN_8;
|
||||
case AG_9: return EN_9;
|
||||
case AG_0: return EN_0;
|
||||
case AG_EXCL: return EN_EXCL;
|
||||
case AG_PERC: return EN_PERC;
|
||||
case AG_ASTR: return EN_ASTR;
|
||||
case AG_LPRN: return EN_LPRN;
|
||||
case AG_RPRN: return EN_RPRN;
|
||||
case AG_MINS: return EN_MINS;
|
||||
case AG_UNDS: return EN_UNDS;
|
||||
case AG_EQL: return EN_EQL;
|
||||
case AG_PLUS: return EN_PLUS;
|
||||
case AG_SCLN: return EN_SCLN;
|
||||
case AG_COLN: return EN_COLN;
|
||||
case AG_DQUO: return EN_DQUO;
|
||||
case AG_BSLS: return EN_BSLS;
|
||||
case AG_COMM: return EN_COMM;
|
||||
case AG_DOT: return EN_DOT;
|
||||
case AG_SLSH: return EN_SLSH;
|
||||
case AG_QUES: return EN_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
} else {
|
||||
switch (key) {
|
||||
case AG_1: return RU_1;
|
||||
case AG_2: return RU_2;
|
||||
case AG_3: return RU_3;
|
||||
case AG_4: return RU_4;
|
||||
case AG_5: return RU_5;
|
||||
case AG_6: return RU_6;
|
||||
case AG_7: return RU_7;
|
||||
case AG_8: return RU_8;
|
||||
case AG_9: return RU_9;
|
||||
case AG_0: return RU_0;
|
||||
case AG_EXCL: return RU_EXCL;
|
||||
case AG_PERC: return RU_PERC;
|
||||
case AG_ASTR: return RU_ASTR;
|
||||
case AG_LPRN: return RU_LPRN;
|
||||
case AG_RPRN: return RU_RPRN;
|
||||
case AG_MINS: return RU_MINS;
|
||||
case AG_UNDS: return RU_UNDS;
|
||||
case AG_EQL: return RU_EQL;
|
||||
case AG_PLUS: return RU_PLUS;
|
||||
case AG_SCLN: return RU_SCLN;
|
||||
case AG_COLN: return RU_COLN;
|
||||
case AG_DQUO: return RU_DQUO;
|
||||
case AG_BSLS: return RU_BSLS;
|
||||
case AG_COMM: return RU_COMM;
|
||||
case AG_DOT: return RU_DOT;
|
||||
case AG_SLSH: return RU_SLSH;
|
||||
case AG_QUES: return RU_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void) {
|
||||
return lang_should_be * 2 + 1;
|
||||
}
|
||||
|
||||
void lang_synchronize(void) {
|
||||
lang_timer = timer_read();
|
||||
switch (lang_current_change) {
|
||||
case LANG_CHANGE_CAPS: {
|
||||
// Костыль, потому что при нажатии Shift+Caps включается режим Caps, а не переключение языка :facepalm:
|
||||
if (shift_current == 1) {
|
||||
unregister_code(KC_LSFT);
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_ALT_SHIFT: {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LALT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_ALT: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LALT);
|
||||
unregister_code(KC_LALT);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_CTRL_SHIFT: {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_CTRL: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LCTL);
|
||||
unregister_code(KC_LCTL);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_WIN_SPACE: {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_SPACE);
|
||||
unregister_code(KC_SPACE);
|
||||
unregister_code(KC_LGUI);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void lang_activate(Lang lang) {
|
||||
// Нужно дополнять этот код, если нужно три языка и более
|
||||
if (lang_current != lang) {
|
||||
lang_synchronize();
|
||||
}
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
void lang_activate_from_user(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_activate(lang);
|
||||
}
|
||||
|
||||
void lang_activate_from_user_without_sync(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
Key lang_process(Key key, bool down) {
|
||||
Key after_agnostic = lang_calc_agnostic(key);
|
||||
if (after_agnostic != NONE_KEY) {
|
||||
key = after_agnostic;
|
||||
}
|
||||
|
||||
Lang new_lang = lang_get_lang(key);
|
||||
if (down) {
|
||||
if (new_lang != NONE_LANG) {
|
||||
lang_activate(new_lang);
|
||||
} else {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_lang != NONE_LANG) {
|
||||
if (down) {
|
||||
lang_pressed_count++;
|
||||
} else {
|
||||
lang_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return lang_get_key(key);
|
||||
}
|
||||
|
||||
void lang_user_timer(void) {
|
||||
// Нужно выключать язык после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (lang_pressed_count == 0 && lang_current != lang_should_be && timer_read() - lang_timer >= 100) {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Обработка клавиш
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t lang_shift_current_shift_layer = 0;
|
||||
|
||||
void lang_shift_press_key(Key key, bool down) {
|
||||
keyrecord_t record = {
|
||||
.event = {
|
||||
.key = {
|
||||
.col = 0,
|
||||
.row = 0,
|
||||
},
|
||||
.pressed = down,
|
||||
.time = timer_read(),
|
||||
},
|
||||
};
|
||||
|
||||
lang_shift_process_record(key, &record);
|
||||
}
|
||||
|
||||
void lang_shift_tap_key(Key key) {
|
||||
lang_shift_press_key(key, true);
|
||||
lang_shift_press_key(key, false);
|
||||
shift_activate(shift_should_be);
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
|
||||
bool lang_shift_process_custom_keycodes(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Обрабатываем клавиши, связанные с кастомным шифтом и кастомным переключением языка
|
||||
switch (key) {
|
||||
case SFT_N_O:
|
||||
shift_once_process_key(lang_get_shift_layer_number(), down);
|
||||
return false;
|
||||
case SFT_N:
|
||||
if (down) {
|
||||
shift_activate_from_user(true);
|
||||
lang_shift_current_shift_layer = lang_get_shift_layer_number();
|
||||
layer_on(lang_shift_current_shift_layer);
|
||||
} else {
|
||||
shift_should_be = false;
|
||||
if (shift_pressed_count == 0) {
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
layer_off(lang_shift_current_shift_layer);
|
||||
}
|
||||
return false;
|
||||
case LA_CHNG:
|
||||
if (down) {
|
||||
if (lang_should_be == 0) {
|
||||
lang_activate_from_user(1);
|
||||
layer_on(2);
|
||||
} else {
|
||||
lang_activate_from_user(0);
|
||||
layer_off(2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case LA_SYNC:
|
||||
if (down) {
|
||||
lang_synchronize();
|
||||
}
|
||||
return false;
|
||||
case LA_CAPS:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CAPS;
|
||||
}
|
||||
return false;
|
||||
case LA_ALSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_ALT_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHAL:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_ALT;
|
||||
}
|
||||
return false;
|
||||
case LA_CTSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CTRL_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHCT:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_CTRL;
|
||||
}
|
||||
return false;
|
||||
case LA_WISP:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_WIN_SPACE;
|
||||
}
|
||||
return false;
|
||||
case AG_3DOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_CMSP:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_SDOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_once_use_to_next_key(lang_get_shift_layer_number());
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_english_modifiers(Key key, keyrecord_t* record) {
|
||||
static Lang lang_stack[3] = {};
|
||||
static uint8_t modifiers_count = 0;
|
||||
#define PROCESS(NAME, REGISTER, UNREGISTER, ACTIVATE_LANG) \
|
||||
case NAME: { \
|
||||
if (record->event.pressed) { \
|
||||
lang_stack[modifiers_count] = lang_should_be; \
|
||||
modifiers_count += 1; \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_off(2); \
|
||||
} \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(0); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(0); \
|
||||
} \
|
||||
REGISTER; \
|
||||
} else { \
|
||||
UNREGISTER; \
|
||||
modifiers_count -= 1; \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(lang_stack[modifiers_count]); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(lang_stack[modifiers_count]); \
|
||||
} \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_on(2); \
|
||||
} \
|
||||
} \
|
||||
return false; \
|
||||
} break;
|
||||
|
||||
#define Rg(x) register_code(KC_L ## x)
|
||||
#define Un(x) unregister_code(KC_L ## x)
|
||||
|
||||
switch (key) {
|
||||
PROCESS(CTRL_0, Rg(CTL), Un(CTL), false);
|
||||
PROCESS(ALT_0, Rg(ALT), Un(ALT), false);
|
||||
PROCESS(WIN_0, Rg(GUI), Un(GUI), false);
|
||||
PROCESS(CTAL_0, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, false);
|
||||
PROCESS(SHAL_0, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, false);
|
||||
PROCESS(CTSH_0, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, false);
|
||||
PROCESS(MCAS_0, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, false);
|
||||
|
||||
PROCESS(CTRL_EN, Rg(CTL), Un(CTL), true);
|
||||
PROCESS(ALT_EN, Rg(ALT), Un(ALT), true);
|
||||
PROCESS(WIN_EN, Rg(GUI), Un(GUI), true);
|
||||
PROCESS(CTAL_EN, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, true);
|
||||
PROCESS(SHAL_EN, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, true);
|
||||
PROCESS(CTSH_EN, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, true);
|
||||
PROCESS(MCAS_EN, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record) {
|
||||
// Обрабатываем Once Shift
|
||||
shift_once_process(key, record);
|
||||
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша какой-то язык, заданный в ней
|
||||
Key key1 = lang_process(key, down);
|
||||
Key key_to_shift = key;
|
||||
if (key1 != NONE_KEY) {
|
||||
key_to_shift = key1;
|
||||
}
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша шифт, засунутый в неё
|
||||
// Это нужно отдельно от обработки языка, чтобы шифт мог выключаться для обычных клавиш
|
||||
Key key2 = shift_process(key_to_shift, down);
|
||||
if (key2 != NONE_KEY) {
|
||||
if (down) {
|
||||
register_code(key2);
|
||||
} else {
|
||||
unregister_code(key2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_custom_keycodes(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_english_modifiers(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void lang_shift_user_timer(void) {
|
||||
shift_user_timer();
|
||||
shift_once_user_timer();
|
||||
lang_user_timer();
|
||||
}
|
||||
108
corne/v3qmk/rules.mk
Normal file
108
corne/v3qmk/rules.mk
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
LTO_ENABLE = yes
|
||||
# Enables Link Time Optimization (LTO) when compiling the keyboard. This makes the process take longer, but it can significantly reduce the compiled size (and since the firmware is small, the added time is not noticeable).
|
||||
|
||||
MOUSEKEY_ENABLE = yes
|
||||
# This gives you control over cursor movements and clicks via keycodes/custom functions.
|
||||
|
||||
EXTRAKEY_ENABLE = yes
|
||||
# This allows you to use the system and audio control key codes.
|
||||
|
||||
NKRO_ENABLE = yes
|
||||
# This allows the keyboard to tell the host OS that up to 248 keys are held down at once (default without NKRO is 6). NKRO is off by default, even if NKRO_ENABLE is set. NKRO can be forced by adding #define FORCE_NKRO to your config.h or by binding MAGIC_TOGGLE_NKRO to a key and then hitting the key.
|
||||
# If this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
|
||||
RGBLIGHT_ENABLE = yes
|
||||
# Enable keyboard underlight functionality
|
||||
|
||||
TAP_DANCE_ENABLE = no
|
||||
# Чтоб на нажатие клавиши было что-то одно, а на зажатие - другое. Называется TapDance
|
||||
|
||||
# TAPPING_TERM_PER_KEY = yes
|
||||
# Я так понимаю это чтоб задавать задержку до срабатывания не одну на всю клавиатуру, а для каждой клавиши отдельно. https://docs.qmk.fm/#/tap_hold?id=tapping_term
|
||||
|
||||
KEY_OVERRIDE_ENABLE = yes
|
||||
# Enable the key override feature. https://docs.qmk.fm/#/feature_key_overrides
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
||||
# This enables the in-switch LED backlighting. You can specify the backlight pin by putting this in your config.h: #define BACKLIGHT_PIN B7
|
||||
|
||||
MUSIC_ENABLE = no
|
||||
# Не понял что это. В стоке включено. Пишут "This tranlates matrix positions into notes". Хз что это значит
|
||||
|
||||
OLED_ENABLE = no
|
||||
# Чтоб OLED экраном на клавиатуре управлять
|
||||
|
||||
COMBO_ENABLE = no
|
||||
# Key combo feature. https://docs.qmk.fm/#/feature_combo
|
||||
|
||||
CAPS_WORD_ENABLE = yes
|
||||
# Toggles Caps Word https://docs.qmk.fm/#/feature_caps_word
|
||||
|
||||
# LEADER_ENABLE = yes
|
||||
# If you're a Vim user, you probably know what a Leader key is. In contrast to Combos, the Leader key allows you to hit a sequence of up to five keys instead, which triggers some custom functionality once complete. https://docs.qmk.fm/#/feature_leader_key
|
||||
|
||||
# UNICODE_ENABLE = yes
|
||||
# This allows you to send Unicode characters using UC(<code point>) in your keymap. Code points up to 0x7FFF are supported. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji.
|
||||
|
||||
# UNICODEMAP_ENABLE = yes
|
||||
# This allows you to send Unicode characters using UM(<map index>) in your keymap. You will need to maintain a mapping table in your keymap file. All possible code points (up to 0x10FFFF) are supported.
|
||||
|
||||
# UCIS_ENABLE = yes
|
||||
# This allows you to send Unicode characters by inputting a mnemonic corresponding to the character you want to send. You will need to maintain a mapping table in your keymap file. All possible code points (up to 0x10FFFF) are supported. For further details, as well as limitations, see the Unicode page. https://docs.qmk.fm/#/feature_unicode
|
||||
|
||||
# KEY_LOCK_ENABLE = yes
|
||||
# This enables key lock. https://docs.qmk.fm/#/feature_key_lock
|
||||
|
||||
# CUSTOM_MATRIX = ?
|
||||
# Lets you replace the default matrix scanning routine with your own code. For further details, see the Custom Matrix page. https://docs.qmk.fm/#/custom_matrix
|
||||
|
||||
# DEBOUNCE_TYPE = ?
|
||||
# Lets you replace the default key debouncing routine with an alternative one. If custom you will need to provide your own implementation.
|
||||
|
||||
# VARIABLE_TRACE = ?
|
||||
# Use this to debug changes to variable values, see the tracing variables section of the Unit Testing page for more information.
|
||||
|
||||
# AUDIO_ENABLE = ?
|
||||
# This allows you output audio on the C6 pin (needs abstracting). See the audio page for more information. https://docs.qmk.fm/#/feature_audio
|
||||
|
||||
# MIDI_ENABLE = ?
|
||||
# This enables MIDI sending and receiving with your keyboard. To enter MIDI send mode, you can use the keycode MI_ON, and MI_OFF to turn it off. This is a largely untested feature, but more information can be found in the quantum/quantum.c file.
|
||||
|
||||
# SLEEP_LED_ENABLE = ?
|
||||
# Enables your LED to breath while your computer is sleeping. Timer1 is being used here. This feature is largely unused and untested, and needs updating/abstracting.
|
||||
|
||||
# COMMAND_ENABLE = ?
|
||||
# This enables magic commands, typically fired with the default magic key combo LSHIFT+RSHIFT+KEY. Magic commands include turning on debugging messages (MAGIC+D) or temporarily toggling NKRO (MAGIC+N).
|
||||
|
||||
# CONSOLE_ENABLE = ?
|
||||
# This allows you to print messages that can be read using hid_listen https://www.pjrc.com/teensy/hid_listen.html
|
||||
|
||||
# BOOTMAGIC_ENABLE = ?
|
||||
# This allows you to hold a key (usually Escape by default) to reset the EEPROM settings that persist over power loss and ready your keyboard to accept new firmware.
|
||||
|
||||
# MAGIC_ENABLE = ?
|
||||
# Magic Keycodes are prefixed with MAGIC_, and allow you to access the functionality of the deprecated Bootmagic feature after your keyboard has initialized. To use the keycodes, assign them to your keymap as you would any other keycode. https://docs.qmk.fm/#/keycodes_magic
|
||||
|
||||
# DYNAMIC_TAPPING_TERM_ENABLE = ?
|
||||
# Allows to configure the global tapping term on the fly.
|
||||
|
||||
# DEFERRED_EXEC_ENABLE = ?
|
||||
# Enables deferred executor support – timed delays before callbacks are invoked. See https://docs.qmk.fm/#/custom_quantum_functions?id=deferred-execution for more information.
|
||||
|
||||
# NO_USB_STARTUP_CHECK = ?
|
||||
# Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
|
||||
|
||||
# SPLIT_KEYBOARD = ?
|
||||
# This enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common
|
||||
|
||||
# SPLIT_TRANSPORT = ?
|
||||
# As there is no standard split communication driver for ARM-based split keyboards yet, SPLIT_TRANSPORT = custom must be used for these. It will prevent the standard split keyboard communication code (which is AVR-specific) from being included, allowing a custom implementation to be used.
|
||||
|
||||
# RING_BUFFERED_6KRO_REPORT_ENABLE = ?
|
||||
# USB 6-Key Rollover - Instead of stopping any new input once 6 keys are pressed, the oldest key is released and the new key is pressed.
|
||||
|
||||
# BLUETOOTH_ENABLE = ?
|
||||
# Current options are bluefruit_le, rn42
|
||||
|
||||
# WAIT_FOR_USB = ?
|
||||
# Forces the keyboard to wait for a USB connection to be established before it starts up
|
||||
41
corne/v3vial-old/config.h
Normal file
41
corne/v3vial-old/config.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
This is the c configuration file for the keymap
|
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2015 Jack Humbert
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VIAL_KEYBOARD_UID {0xCE, 0x08, 0x17, 0xF3, 0x0D, 0xE4, 0x4A, 0xC8}
|
||||
|
||||
/* Select hand configuration */
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
//#define TAPPING_FORCE_HOLD
|
||||
#define TAPPING_TERM 175
|
||||
|
||||
#define LANG_CHANGE_DEFAULT LANG_CHANGE_CAPS
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_ALT_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_CTRL_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_WIN_SPACE
|
||||
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 9
|
||||
|
||||
#define RGBLIGHT_LAYERS
|
||||
304
corne/v3vial-old/keymap.c
Normal file
304
corne/v3vial-old/keymap.c
Normal file
|
|
@ -0,0 +1,304 @@
|
|||
/*
|
||||
Copyright 2019 @foostan
|
||||
Copyright 2020 Drashna Jaelre <@drashna>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include <stdio.h>
|
||||
|
||||
#define CUSTOM_SAFE_RANGE SAFE_RANGE
|
||||
#include "lang_shift/include.h"
|
||||
|
||||
#define L_ENG 0
|
||||
#define L_GAME 1
|
||||
#define L_RU 2
|
||||
#define L_MEDIA 3
|
||||
#define L_NAV 4
|
||||
#define L_MOUSE 5
|
||||
#define L_SYM 6
|
||||
#define L_NUM 7
|
||||
#define L_FUN 8
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[L_ENG] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_ESC, KC_F, KC_L, KC_H, KC_V, KC_Z, KC_Q, KC_W, KC_U, KC_O, KC_Y, DF(L_GAME),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, WIN_T(KC_S),ALT_T(KC_R),CTL_T(KC_N),SFT_T(KC_T), KC_K, KC_C, SFT_T(KC_D),CTL_T(KC_E),ALT_T(KC_A),WIN_T(KC_I), XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_X, XXXXXXX, KC_B, KC_M, KC_J, KC_P, KC_G, XXXXXXX, XXXXXXX, XXXXXXX, LA_CHNG,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LT(L_MEDIA, KC_ENT), LT(L_MOUSE, KC_BSPC), MO(L_NAV), MO(L_SYM), LT(L_FUN, KC_SPC), MO(L_NUM)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
),
|
||||
|
||||
[L_RU] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_ESC, KC_A, KC_QUOT, KC_Z, KC_S, KC_RBRC, KC_Q, KC_COMM, KC_K, KC_R, KC_W, KC_SCLN,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_O, TD(0), TD(2), TD(4), SFT_T(KC_F), KC_M, KC_L, SFT_T(KC_N), TD(5), TD(3), TD(1), KC_X,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LA_CHNG, KC_I, KC_DOT, KC_E, KC_B, KC_GRV, KC_U, KC_V, KC_H, KC_G, KC_LBRC, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
LT(L_MEDIA, KC_ENT), LT(L_MOUSE, KC_BSPC), MO(L_NAV), MO(L_SYM), LT(L_FUN, KC_SPC), MO(L_NUM)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
),
|
||||
|
||||
[L_MEDIA] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_VOLU, LA_SYNC, RGB_TOG, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, XXXXXXX, KC_MPLY, KC_MPRV, KC_MNXT, KC_MUTE, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LA_CAPS, LA_ALSH, LA_CTSH, LA_WISP, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_NAV] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, C(KC_Y), C(KC_V), C(KC_C), C(KC_X), C(KC_Z), C(KC_S),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TAB,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_DEL,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_MOUSE] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_ACL0, C(KC_Y), C(KC_V), C(KC_C), C(KC_X), C(KC_Z), C(KC_S),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_LWIN, KC_LALT, KC_LCTL, KC_LSFT, KC_ACL1, KC_BTN5, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_ACL2, KC_BTN4, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN3, KC_BTN2
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_SYM] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, EN_AT, EN_HASH, EN_DLR, AG_PERC, EN_CIRC, EN_AMPR, AG_ASTR, AG_MINS, AG_EQL, AG_PLUS, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
AG_COMM, AG_EXCL, AG_QUES, COMMA_SPACE, SMART_DOT, AG_DOT, AG_BSLS, AG_LPRN, EN_LCBR, EN_LBRC, EN_LT, EN_GRV,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, EN_SLSH, RU_NUME, AG_DQUO, EN_QUOT, ONCE_SHIFT, EN_PIPE, AG_RPRN, EN_RCBR, EN_RBRC, EN_GT, EN_TILD,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
AG_UNDS, AG_COLN, AG_SCLN, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_NUM] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, XXXXXXX, AG_1, AG_2, AG_3, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, AG_0, AG_4, AG_5, AG_6, KC_PSCR, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LWIN, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, AG_7, AG_8, AG_9, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_FUN] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LWIN, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
//`+-----------+-----------+-----------||-----------+-----------+-----------+'
|
||||
),
|
||||
|
||||
[L_GAME] = LAYOUT(
|
||||
//,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------.
|
||||
KC_TAB, KC_T, KC_Q, KC_W, KC_E, KC_R, KC_Y, KC_U, KC_I, KC_O, KC_P, DF(L_ENG),
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LSFT, KC_G, KC_A, KC_S, KC_D, KC_F, KC_H, KC_J, KC_UP, KC_K, KC_L, KC_GRV,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------| |-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LCTL, KC_B, KC_Z, KC_X, KC_C, KC_V, KC_N, KC_LEFT, KC_DOWN, KC_RGHT, KC_M, KC_SLSH,
|
||||
//|-----------+-----------+-----------+-----------+-----------+-----------+-----------||-----------+-----------+-----------+-----------+-----------+-----------+-----------|
|
||||
KC_LALT, KC_SPC, LT(L_NUM, KC_ESC), KC_H, KC_SPC, LT(L_FUN, KC_ENT)
|
||||
//`+--------------------+--------------------+--------------------||--------------------+--------------------+--------------------+'
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
bool shift_on_next_key = false;
|
||||
|
||||
// Обработка нажатий?
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { // В конце должно быть true, чтоб символ напечатался.
|
||||
// lang_shift
|
||||
if (!lang_shift_process_record(keycode, record))
|
||||
return false;
|
||||
|
||||
|
||||
// Одиночный шифт от GPT4. Потому что одиночный шифт lang_shift не нравится. Но этот шифт не умеет работать с кастом кейкодами lang_shift
|
||||
if (keycode == ONCE_SHIFT && record->event.pressed) {
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shift_on_next_key && record->event.pressed) {
|
||||
register_code(KC_LSFT);
|
||||
register_code(keycode);
|
||||
unregister_code(keycode);
|
||||
unregister_code(KC_LSFT);
|
||||
shift_on_next_key = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Умная точка
|
||||
if (keycode == SMART_DOT && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Запятая + пробел
|
||||
if (keycode == COMMA_SPACE && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Если условия выше не сработали, то отправить символ как есть
|
||||
};
|
||||
|
||||
void user_timer(void) {
|
||||
lang_shift_user_timer();
|
||||
};
|
||||
|
||||
// Tap Dance
|
||||
void keyboard_post_init_user(void) {
|
||||
// Mod keys on RU layer
|
||||
vial_tap_dance_entry_t td0 = {KC_C, // С on tap, Win on hold
|
||||
WIN_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(0, &td0);
|
||||
|
||||
vial_tap_dance_entry_t td1 = {KC_P, // З on tap, Win on hold
|
||||
WIN_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(1, &td1);
|
||||
|
||||
vial_tap_dance_entry_t td2 = {KC_T, // Е on tap, Alt on hold
|
||||
ALT_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(2, &td2);
|
||||
|
||||
vial_tap_dance_entry_t td3 = {KC_D, // В on tap, Alt on hold
|
||||
ALT_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(3, &td3);
|
||||
|
||||
vial_tap_dance_entry_t td4 = {KC_J, // О on tap, Ctrl on hold
|
||||
CTRL_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(4, &td4);
|
||||
|
||||
vial_tap_dance_entry_t td5 = {KC_Y, // Н on tap, Ctrl on hold
|
||||
CTRL_EN,
|
||||
KC_NO,
|
||||
KC_NO,
|
||||
TAPPING_TERM};
|
||||
dynamic_keymap_set_tap_dance(5, &td5);
|
||||
}
|
||||
|
||||
|
||||
// Lighting Layers
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_ENG:
|
||||
rgblight_sethsv(HSV_PINK);
|
||||
break;
|
||||
case L_GAME:
|
||||
rgblight_sethsv(HSV_ORANGE);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgblight_sethsv(HSV_WHITE);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_RU:
|
||||
rgblight_sethsv(HSV_PURPLE);
|
||||
break;
|
||||
case L_MEDIA:
|
||||
rgblight_sethsv(HSV_MAGENTA);
|
||||
break;
|
||||
case L_NAV:
|
||||
rgblight_sethsv(HSV_CYAN);
|
||||
break;
|
||||
case L_MOUSE:
|
||||
rgblight_sethsv(HSV_YELLOW);
|
||||
break;
|
||||
case L_SYM:
|
||||
rgblight_sethsv(HSV_GREEN);
|
||||
break;
|
||||
case L_NUM:
|
||||
rgblight_sethsv(HSV_BLUE);
|
||||
break;
|
||||
case L_FUN:
|
||||
rgblight_sethsv(HSV_RED);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgblight_sethsv(HSV_WHITE);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
user_timer();
|
||||
|
||||
// Проверяем, активен ли слой
|
||||
if (!layer_state_cmp(layer_state, L_MEDIA) &&
|
||||
!layer_state_cmp(layer_state, L_NAV) &&
|
||||
!layer_state_cmp(layer_state, L_MOUSE) &&
|
||||
!layer_state_cmp(layer_state, L_SYM) &&
|
||||
!layer_state_cmp(layer_state, L_NUM) &&
|
||||
!layer_state_cmp(layer_state, L_FUN) &&
|
||||
!layer_state_cmp(layer_state, L_RU)) {
|
||||
// Если ни один из этих слоев не активен, обновляем подсветку на основе текущего базового слоя
|
||||
default_layer_state_set_user(default_layer_state);
|
||||
}
|
||||
}
|
||||
341
corne/v3vial-old/lang_shift/include.h
Normal file
341
corne/v3vial-old/lang_shift/include.h
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef CUSTOM_SAFE_RANGE
|
||||
#error "You must specify variable CUSTOM_SAFE_RANGE for lang_shift extension."
|
||||
#endif
|
||||
|
||||
enum lang_shift_keycodes {
|
||||
LANG_SHIFT_START = CUSTOM_SAFE_RANGE,
|
||||
|
||||
// Кейкоды, на основе которых реализуются кейкоды ниже, пользователю их лучше не использовать.
|
||||
#include "private_keycodes.h"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Английские символы */
|
||||
EN_GRV, /* ` */
|
||||
EN_TILD, /* ~ */
|
||||
EN_1, /* 1 */
|
||||
EN_EXCL, /* ! */
|
||||
EN_2, /* 2 */
|
||||
EN_AT, /* @ */
|
||||
EN_3, /* 3 */
|
||||
EN_HASH, /* # */
|
||||
EN_4, /* 4 */
|
||||
EN_DLR, /* $ */
|
||||
EN_5, /* 5 */
|
||||
EN_PERC, /* % */
|
||||
EN_6, /* 6 */
|
||||
EN_CIRC, /* ^ */
|
||||
EN_7, /* 7 */
|
||||
EN_AMPR, /* & */
|
||||
EN_8, /* 8 */
|
||||
EN_ASTR, /* * */
|
||||
EN_9, /* 9 */
|
||||
EN_LPRN, /* ( */
|
||||
EN_0, /* 0 */
|
||||
EN_RPRN, /* ) */
|
||||
EN_MINS, /* - */
|
||||
EN_UNDS, /* _ */
|
||||
EN_EQL, /* = */
|
||||
EN_PLUS, /* + */
|
||||
|
||||
EN_Q, /* q */
|
||||
EN_S_Q, /* Q */
|
||||
EN_W, /* w */
|
||||
EN_S_W, /* W */
|
||||
EN_E, /* e */
|
||||
EN_S_E, /* E */
|
||||
EN_R, /* r */
|
||||
EN_S_R, /* R */
|
||||
EN_T, /* t */
|
||||
EN_S_T, /* T */
|
||||
EN_Y, /* y */
|
||||
EN_S_Y, /* Y */
|
||||
EN_U, /* u */
|
||||
EN_S_U, /* U */
|
||||
EN_I, /* i */
|
||||
EN_S_I, /* I */
|
||||
EN_O, /* o */
|
||||
EN_S_O, /* O */
|
||||
EN_P, /* p */
|
||||
EN_S_P, /* P */
|
||||
EN_LBRC, /* [ */
|
||||
EN_LCBR, /* { */
|
||||
EN_RBRC, /* ] */
|
||||
EN_RCBR, /* } */
|
||||
|
||||
EN_A, /* a */
|
||||
EN_S_A, /* A */
|
||||
EN_S, /* s */
|
||||
EN_S_S, /* S */
|
||||
EN_D, /* d */
|
||||
EN_S_D, /* D */
|
||||
EN_F, /* f */
|
||||
EN_S_F, /* F */
|
||||
EN_G, /* g */
|
||||
EN_S_G, /* G */
|
||||
EN_H, /* h */
|
||||
EN_S_H, /* H */
|
||||
EN_J, /* j */
|
||||
EN_S_J, /* J */
|
||||
EN_K, /* k */
|
||||
EN_S_K, /* K */
|
||||
EN_L, /* l */
|
||||
EN_S_L, /* L */
|
||||
EN_SCLN, /* ; */
|
||||
EN_COLN, /* : */
|
||||
EN_QUOT, /* ' */
|
||||
EN_DQUO, /* " */
|
||||
EN_BSLS, /* \ */
|
||||
EN_PIPE, /* | */
|
||||
|
||||
EN_Z, /* z */
|
||||
EN_S_Z, /* Z */
|
||||
EN_X, /* x */
|
||||
EN_S_X, /* X */
|
||||
EN_C, /* c */
|
||||
EN_S_C, /* C */
|
||||
EN_V, /* v */
|
||||
EN_S_V, /* V */
|
||||
EN_B, /* b */
|
||||
EN_S_B, /* B */
|
||||
EN_N, /* n */
|
||||
EN_S_N, /* N */
|
||||
EN_M, /* m */
|
||||
EN_S_M, /* M */
|
||||
EN_COMM, /* , */
|
||||
EN_LT, /* < */
|
||||
EN_DOT, /* . */
|
||||
EN_GT, /* > */
|
||||
EN_SLSH, /* / */
|
||||
EN_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Русские символы */
|
||||
RU_JO, /* ё */
|
||||
RU_S_JO, /* Ё */
|
||||
RU_1, /* 1 */
|
||||
RU_EXCL, /* ! */
|
||||
RU_2, /* 2 */
|
||||
RU_DQUO, /* " */
|
||||
RU_3, /* 3 */
|
||||
RU_NUME, /* № */
|
||||
RU_4, /* 4 */
|
||||
RU_SCLN, /* ; */
|
||||
RU_5, /* 5 */
|
||||
RU_PERC, /* % */
|
||||
RU_6, /* 6 */
|
||||
RU_COLN, /* : */
|
||||
RU_7, /* 7 */
|
||||
RU_QUES, /* ? */
|
||||
RU_8, /* 8 */
|
||||
RU_ASTR, /* * */
|
||||
RU_9, /* 9 */
|
||||
RU_LPRN, /* ( */
|
||||
RU_0, /* 0 */
|
||||
RU_RPRN, /* ) */
|
||||
RU_MINS, /* - */
|
||||
RU_UNDS, /* _ */
|
||||
RU_EQL, /* = */
|
||||
RU_PLUS, /* + */
|
||||
|
||||
RU_J, /* й */
|
||||
RU_S_J, /* Й */
|
||||
RU_TS, /* ц */
|
||||
RU_S_TS, /* Ц */
|
||||
RU_U, /* у */
|
||||
RU_S_U, /* У */
|
||||
RU_K, /* к */
|
||||
RU_S_K, /* К */
|
||||
RU_JE, /* е */
|
||||
RU_S_JE, /* Е */
|
||||
RU_N, /* н */
|
||||
RU_S_N, /* Н */
|
||||
RU_G, /* г */
|
||||
RU_S_G, /* Г */
|
||||
RU_SH, /* ш */
|
||||
RU_S_SH, /* Ш */
|
||||
RU_SC, /* щ */
|
||||
RU_S_SC, /* Щ */
|
||||
RU_Z, /* з */
|
||||
RU_S_Z, /* З */
|
||||
RU_H, /* х */
|
||||
RU_S_H, /* Х */
|
||||
RU_HD, /* ъ */
|
||||
RU_S_HD, /* Ъ */
|
||||
|
||||
RU_F, /* ф */
|
||||
RU_S_F, /* Ф */
|
||||
RU_Y, /* ы */
|
||||
RU_S_Y, /* Ы */
|
||||
RU_V, /* в */
|
||||
RU_S_V, /* В */
|
||||
RU_A, /* а */
|
||||
RU_S_A, /* А */
|
||||
RU_P, /* п */
|
||||
RU_S_P, /* п */
|
||||
RU_R, /* р */
|
||||
RU_S_R, /* Р */
|
||||
RU_O, /* о */
|
||||
RU_S_O, /* О */
|
||||
RU_L, /* л */
|
||||
RU_S_L, /* Л */
|
||||
RU_D, /* д */
|
||||
RU_S_D, /* Д */
|
||||
RU_ZH, /* ж */
|
||||
RU_S_ZH, /* Ж */
|
||||
RU_E, /* э */
|
||||
RU_S_E, /* Э */
|
||||
RU_BSLS, /* \ */
|
||||
RU_SLSH, /* / */
|
||||
|
||||
RU_JA, /* я */
|
||||
RU_S_JA, /* Я */
|
||||
RU_CH, /* ч */
|
||||
RU_S_CH, /* Ч */
|
||||
RU_S, /* с */
|
||||
RU_S_S, /* С */
|
||||
RU_M, /* м */
|
||||
RU_S_M, /* М */
|
||||
RU_I, /* и */
|
||||
RU_S_I, /* И */
|
||||
RU_T, /* т */
|
||||
RU_S_T, /* Т */
|
||||
RU_SF, /* ь */
|
||||
RU_S_SF, /* Ь */
|
||||
RU_B, /* б */
|
||||
RU_S_B, /* Б */
|
||||
RU_JU, /* ю */
|
||||
RU_S_JU, /* Ю */
|
||||
RU_DOT, /* . */
|
||||
RU_COMM, /* , */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Символы, нажимаемые независимо от текущего языка. Language-agnostic-keycodes. */
|
||||
AG_1, /* 1 */
|
||||
AG_2, /* 2 */
|
||||
AG_3, /* 3 */
|
||||
AG_4, /* 4 */
|
||||
AG_5, /* 5 */
|
||||
AG_6, /* 6 */
|
||||
AG_7, /* 7 */
|
||||
AG_8, /* 8 */
|
||||
AG_9, /* 9 */
|
||||
AG_0, /* 0 */
|
||||
AG_EXCL, /* ! */
|
||||
AG_PERC, /* % */
|
||||
AG_ASTR, /* * */
|
||||
AG_LPRN, /* ( */
|
||||
AG_RPRN, /* ) */
|
||||
AG_MINS, /* - */
|
||||
AG_UNDS, /* _ */
|
||||
AG_EQL, /* = */
|
||||
AG_PLUS, /* + */
|
||||
AG_SCLN, /* ; */
|
||||
AG_COLN, /* : */
|
||||
AG_DQUO, /* " */
|
||||
AG_BSLS, /* \ */
|
||||
AG_COMM, /* , */
|
||||
AG_DOT, /* . */
|
||||
AG_SLSH, /* / */
|
||||
AG_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кастомные language-agnostic-кейкоды */
|
||||
AG_3DOT, /* ... */
|
||||
AG_SDOT, /* Space + Dot + Shift to next key */
|
||||
AG_CMSP, /* Comma + Space */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Шифты для набора текста. */
|
||||
SFT_N, /* Работает как обычный шифт, при её зажатии, шифт зажат. Параллельно переключает на (шифтовый) следующий слой относительно текущего языка (если язык 0, то включает слой 1, если язык 1, то включает слой 3). */
|
||||
SFT_N_O, /* Данная клавиша применит шифт и переключение на шифтовый слой только к следующему символу. Неважно, была ли она нажата одновременно со следующей клавишей, или до неё, или вместе с двумя клавишами. Применится только к одной клавише. То есть это как залипающий шифт, если нажимать отдельно от всех клавиш, и как одиночный шифт, если эту клавишу зажимать. Такая клавиша может пригодиться если вы печатаете с большой скоростью и вам сложно выдерживать время удержания шифта, и у вас получается что-то вроде "ПРивет". */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Модификаторы, переключащие текущий слой на 0. Такое нужно чтобы при включённом русском языке были такие же хоткеи с модификаторами, как и на английском языке. */
|
||||
CTRL_0, /* Ctrl on 0 layer */
|
||||
ALT_0, /* Alt on 0 layer */
|
||||
WIN_0, /* Win on 0 layer */
|
||||
SHAL_0, /* Shift+Alt on 0 layer */
|
||||
CTAL_0, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_0, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_0, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* А данные модификаторы помимо включения 0 слоя ещё и переключают язык на английский. Такое разделение нужно, потому что у некоторых смена языка идёт на комбинации с Ctrl, или Shift, и у них может сниматься выделение текста, например. */
|
||||
CTRL_EN, /* Ctrl on 0 layer */
|
||||
ALT_EN, /* Alt on 0 layer */
|
||||
WIN_EN, /* Win on 0 layer */
|
||||
SHAL_EN, /* Shift+Alt on 0 layer */
|
||||
CTAL_EN, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_EN, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_EN, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кнопки, отвечающие за переключение языка. */
|
||||
LA_CHNG, /* Переключает язык и переключает на 2 или 0 слой в зависимости от текущего языка. */
|
||||
LA_SYNC, /* Кнопка для синхронизации языков. Её нужно нажимать в случае если язык в системе и язык в клавиатуре различаются. Данная клавиша изменит язык в системе. */
|
||||
LA_CAPS, /* Задаёт переключение языка на Caps. */
|
||||
LA_ALSH, /* Задаёт переключение языка на Alt + Shift. */
|
||||
LA_SHAL, /* Задаёт переключение языка на Shift + Alt. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_CTSH, /* Задаёт переключение языка на Ctrl + Shift. */
|
||||
LA_SHCT, /* Задаёт переключение языка на Shift + Ctrl. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_WISP, /* Задаёт переключение языка на Win + Shift. */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кейкоды от Buliway. */
|
||||
ONCE_SHIFT, /* Зажимает шифт до тех пор, пока не будет нажата любая другая клавиша. Не работает с кастом кейкодами, только стандартные */
|
||||
SMART_DOT, /* Отправить агностик точку из lang_shift, нажать пробел, активировать одиночный шифт ONCE_SHIFT */
|
||||
COMMA_SPACE, /* Отправить агностик запятую из lang_shift, нажать пробел */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* SAFE_RANGE данной библиотеки. */
|
||||
LANG_SHIFT_NEW_SAFE_RANGE,
|
||||
#undef CUSTOM_SAFE_RANGE
|
||||
#define CUSTOM_SAFE_RANGE LANG_SHIFT_NEW_SAFE_RANGE
|
||||
};
|
||||
|
||||
typedef uint16_t Key;
|
||||
#define NONE_KEY (uint16_t)(65535)
|
||||
|
||||
typedef uint8_t Lang;
|
||||
#define NONE_LANG (uint8_t)(255)
|
||||
|
||||
typedef uint8_t Shift;
|
||||
#define NONE_SHIFT (uint8_t)(255)
|
||||
|
||||
// Способ смены языка
|
||||
enum LangChange {
|
||||
LANG_CHANGE_CAPS,
|
||||
LANG_CHANGE_ALT_SHIFT,
|
||||
LANG_CHANGE_SHIFT_ALT,
|
||||
LANG_CHANGE_CTRL_SHIFT,
|
||||
LANG_CHANGE_SHIFT_CTRL,
|
||||
LANG_CHANGE_WIN_SPACE
|
||||
};
|
||||
|
||||
// Переменная, в которой можно менять текущий способ смены языка
|
||||
enum LangChange lang_current_change =
|
||||
#ifdef LANG_CHANGE_DEFAULT
|
||||
LANG_CHANGE_DEFAULT;
|
||||
#else
|
||||
#error "You must specify default language change method by defining variable LANG_CHANGE_DEFAULT."
|
||||
#endif
|
||||
|
||||
void shift_activate(Shift shift);
|
||||
void shift_activate_from_user(Shift shift);
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer);
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void);
|
||||
void lang_synchronize(void);
|
||||
void lang_activate(Lang lang);
|
||||
void lang_activate_from_user(Lang lang);
|
||||
|
||||
void lang_shift_press_key(Key key, bool down);
|
||||
void lang_shift_tap_key(Key key);
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record);
|
||||
void lang_shift_user_timer(void);
|
||||
|
||||
// Инклюжу код напрямую, потому что нельзя сделать линковку, ведь код внутри использует кейкоды отсюда, и обязательно нужно это делать через safe_range
|
||||
#include "src.c"
|
||||
97
corne/v3vial-old/lang_shift/private_keycodes.h
Normal file
97
corne/v3vial-old/lang_shift/private_keycodes.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
KS_GRV, /* ` */
|
||||
KS_TILD, /* ~ */
|
||||
KS_1, /* 1 */
|
||||
KS_EXCL, /* ! */
|
||||
KS_2, /* 2 */
|
||||
KS_AT, /* @ */
|
||||
KS_3, /* 3 */
|
||||
KS_HASH, /* # */
|
||||
KS_4, /* 4 */
|
||||
KS_DLR, /* $ */
|
||||
KS_5, /* 5 */
|
||||
KS_PERC, /* % */
|
||||
KS_6, /* 6 */
|
||||
KS_CIRC, /* ^ */
|
||||
KS_7, /* 7 */
|
||||
KS_AMPR, /* & */
|
||||
KS_8, /* 8 */
|
||||
KS_ASTR, /* * */
|
||||
KS_9, /* 9 */
|
||||
KS_LPRN, /* ( */
|
||||
KS_0, /* 0 */
|
||||
KS_RPRN, /* ) */
|
||||
KS_MINS, /* - */
|
||||
KS_UNDS, /* _ */
|
||||
KS_EQL, /* = */
|
||||
KS_PLUS, /* + */
|
||||
|
||||
KS_Q, /* q */
|
||||
KS_S_Q, /* Q */
|
||||
KS_W, /* w */
|
||||
KS_S_W, /* W */
|
||||
KS_E, /* e */
|
||||
KS_S_E, /* E */
|
||||
KS_R, /* r */
|
||||
KS_S_R, /* R */
|
||||
KS_T, /* t */
|
||||
KS_S_T, /* T */
|
||||
KS_Y, /* y */
|
||||
KS_S_Y, /* Y */
|
||||
KS_U, /* u */
|
||||
KS_S_U, /* U */
|
||||
KS_I, /* i */
|
||||
KS_S_I, /* I */
|
||||
KS_O, /* o */
|
||||
KS_S_O, /* O */
|
||||
KS_P, /* p */
|
||||
KS_S_P, /* P */
|
||||
KS_LBRC, /* [ */
|
||||
KS_LCBR, /* { */
|
||||
KS_RBRC, /* ] */
|
||||
KS_RCBR, /* } */
|
||||
|
||||
KS_A, /* a */
|
||||
KS_S_A, /* A */
|
||||
KS_S, /* s */
|
||||
KS_S_S, /* S */
|
||||
KS_D, /* d */
|
||||
KS_S_D, /* D */
|
||||
KS_F, /* f */
|
||||
KS_S_F, /* F */
|
||||
KS_G, /* g */
|
||||
KS_S_G, /* G */
|
||||
KS_H, /* h */
|
||||
KS_S_H, /* H */
|
||||
KS_J, /* j */
|
||||
KS_S_J, /* J */
|
||||
KS_K, /* k */
|
||||
KS_S_K, /* K */
|
||||
KS_L, /* l */
|
||||
KS_S_L, /* L */
|
||||
KS_SCLN, /* ; */
|
||||
KS_COLN, /* : */
|
||||
KS_QUOT, /* ' */
|
||||
KS_DQUO, /* " */
|
||||
KS_BSLS, /* \ */
|
||||
KS_PIPE, /* | */
|
||||
|
||||
KS_Z, /* z */
|
||||
KS_S_Z, /* Z */
|
||||
KS_X, /* x */
|
||||
KS_S_X, /* X */
|
||||
KS_C, /* c */
|
||||
KS_S_C, /* C */
|
||||
KS_V, /* v */
|
||||
KS_S_V, /* V */
|
||||
KS_B, /* b */
|
||||
KS_S_B, /* B */
|
||||
KS_N, /* n */
|
||||
KS_S_N, /* N */
|
||||
KS_M, /* m */
|
||||
KS_S_M, /* M */
|
||||
KS_COMM, /* , */
|
||||
KS_LT, /* < */
|
||||
KS_DOT, /* . */
|
||||
KS_GT, /* > */
|
||||
KS_SLSH, /* / */
|
||||
KS_QUES, /* ? */
|
||||
665
corne/v3vial-old/lang_shift/src.c
Normal file
665
corne/v3vial-old/lang_shift/src.c
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
// ---------------------------------------------------------------------------
|
||||
// Работа с шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Shift shift_should_be = 0;
|
||||
Shift shift_current = 0;
|
||||
uint32_t shift_timer = 0;
|
||||
uint8_t shift_pressed_count = 0;
|
||||
|
||||
Key shift_get_key(Key key) {
|
||||
switch (key) {
|
||||
case KS_GRV: return KC_GRV;
|
||||
case KS_TILD: return KC_GRV;
|
||||
case KS_1: return KC_1;
|
||||
case KS_EXCL: return KC_1;
|
||||
case KS_2: return KC_2;
|
||||
case KS_AT: return KC_2;
|
||||
case KS_3: return KC_3;
|
||||
case KS_HASH: return KC_3;
|
||||
case KS_4: return KC_4;
|
||||
case KS_DLR: return KC_4;
|
||||
case KS_5: return KC_5;
|
||||
case KS_PERC: return KC_5;
|
||||
case KS_6: return KC_6;
|
||||
case KS_CIRC: return KC_6;
|
||||
case KS_7: return KC_7;
|
||||
case KS_AMPR: return KC_7;
|
||||
case KS_8: return KC_8;
|
||||
case KS_ASTR: return KC_8;
|
||||
case KS_9: return KC_9;
|
||||
case KS_LPRN: return KC_9;
|
||||
case KS_0: return KC_0;
|
||||
case KS_RPRN: return KC_0;
|
||||
case KS_MINS: return KC_MINS;
|
||||
case KS_UNDS: return KC_MINS;
|
||||
case KS_EQL: return KC_EQL;
|
||||
case KS_PLUS: return KC_EQL;
|
||||
case KS_Q: return KC_Q;
|
||||
case KS_S_Q: return KC_Q;
|
||||
case KS_W: return KC_W;
|
||||
case KS_S_W: return KC_W;
|
||||
case KS_E: return KC_E;
|
||||
case KS_S_E: return KC_E;
|
||||
case KS_R: return KC_R;
|
||||
case KS_S_R: return KC_R;
|
||||
case KS_T: return KC_T;
|
||||
case KS_S_T: return KC_T;
|
||||
case KS_Y: return KC_Y;
|
||||
case KS_S_Y: return KC_Y;
|
||||
case KS_U: return KC_U;
|
||||
case KS_S_U: return KC_U;
|
||||
case KS_I: return KC_I;
|
||||
case KS_S_I: return KC_I;
|
||||
case KS_O: return KC_O;
|
||||
case KS_S_O: return KC_O;
|
||||
case KS_P: return KC_P;
|
||||
case KS_S_P: return KC_P;
|
||||
case KS_LBRC: return KC_LBRC;
|
||||
case KS_LCBR: return KC_LBRC;
|
||||
case KS_RBRC: return KC_RBRC;
|
||||
case KS_RCBR: return KC_RBRC;
|
||||
case KS_A: return KC_A;
|
||||
case KS_S_A: return KC_A;
|
||||
case KS_S: return KC_S;
|
||||
case KS_S_S: return KC_S;
|
||||
case KS_D: return KC_D;
|
||||
case KS_S_D: return KC_D;
|
||||
case KS_F: return KC_F;
|
||||
case KS_S_F: return KC_F;
|
||||
case KS_G: return KC_G;
|
||||
case KS_S_G: return KC_G;
|
||||
case KS_H: return KC_H;
|
||||
case KS_S_H: return KC_H;
|
||||
case KS_J: return KC_J;
|
||||
case KS_S_J: return KC_J;
|
||||
case KS_K: return KC_K;
|
||||
case KS_S_K: return KC_K;
|
||||
case KS_L: return KC_L;
|
||||
case KS_S_L: return KC_L;
|
||||
case KS_SCLN: return KC_SCLN;
|
||||
case KS_COLN: return KC_SCLN;
|
||||
case KS_QUOT: return KC_QUOT;
|
||||
case KS_DQUO: return KC_QUOT;
|
||||
case KS_BSLS: return KC_BSLS;
|
||||
case KS_PIPE: return KC_BSLS;
|
||||
case KS_Z: return KC_Z;
|
||||
case KS_S_Z: return KC_Z;
|
||||
case KS_X: return KC_X;
|
||||
case KS_S_X: return KC_X;
|
||||
case KS_C: return KC_C;
|
||||
case KS_S_C: return KC_C;
|
||||
case KS_V: return KC_V;
|
||||
case KS_S_V: return KC_V;
|
||||
case KS_B: return KC_B;
|
||||
case KS_S_B: return KC_B;
|
||||
case KS_N: return KC_N;
|
||||
case KS_S_N: return KC_N;
|
||||
case KS_M: return KC_M;
|
||||
case KS_S_M: return KC_M;
|
||||
case KS_COMM: return KC_COMM;
|
||||
case KS_LT: return KC_COMM;
|
||||
case KS_DOT: return KC_DOT;
|
||||
case KS_GT: return KC_DOT;
|
||||
case KS_SLSH: return KC_SLSH;
|
||||
case KS_QUES: return KC_SLSH;
|
||||
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Shift shift_get_shift(Key key) {
|
||||
if (KS_GRV <= key && key <= KS_QUES) {
|
||||
return (key - KS_GRV) % 2;
|
||||
} else {
|
||||
return NONE_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_activate(Shift shift) {
|
||||
if (shift_current != shift) {
|
||||
shift_timer = timer_read();
|
||||
if (shift) {
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
}
|
||||
shift_current = shift;
|
||||
}
|
||||
|
||||
void shift_activate_from_user(Shift shift) {
|
||||
shift_should_be = shift;
|
||||
shift_activate(shift);
|
||||
}
|
||||
|
||||
Key shift_process(Key key, bool down) {
|
||||
Shift new_shift = shift_get_shift(key);
|
||||
if (down) {
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
shift_activate(new_shift);
|
||||
} else {
|
||||
shift_activate(shift_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
if (down) {
|
||||
shift_pressed_count++;
|
||||
} else {
|
||||
shift_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return shift_get_key(key);
|
||||
}
|
||||
|
||||
void shift_user_timer(void) {
|
||||
// Нужно выключать шифт после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (shift_pressed_count == 0 && shift_current != shift_should_be && timer_read() - shift_timer >= 100) {
|
||||
shift_activate(shift_should_be);
|
||||
shift_timer = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с одиночным шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t shift_once_disable_stage = 2;
|
||||
uint8_t shift_once_layer_off = 0;
|
||||
uint8_t shift_once_layer_current = 0;
|
||||
uint32_t shift_once_enabled_time = 0;
|
||||
bool shift_once_can_disable = true;
|
||||
|
||||
bool shift_once_is_enabled(void) {
|
||||
return shift_once_disable_stage == 2;
|
||||
}
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer) {
|
||||
if (shift_current == 0) {
|
||||
shift_activate_from_user(true);
|
||||
layer_on(layer);
|
||||
shift_once_disable_stage = 2;
|
||||
shift_once_layer_off = layer;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process_key(uint8_t layer, bool down) {
|
||||
if (down) {
|
||||
shift_once_use_to_next_key(layer);
|
||||
shift_once_can_disable = false;
|
||||
} else {
|
||||
shift_once_can_disable = true;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_disable(void) {
|
||||
if (shift_once_disable_stage == 2) {
|
||||
layer_off(shift_once_layer_off);
|
||||
shift_activate_from_user(false);
|
||||
shift_once_disable_stage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
if (shift_once_disable_stage == 1) {
|
||||
shift_once_disable_stage = 0;
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
if (down && key != SFT_N_O && shift_once_disable_stage == 2) {
|
||||
shift_once_disable_stage = 1;
|
||||
layer_off(shift_once_layer_off);
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_user_timer(void) {
|
||||
if (shift_once_can_disable && shift_once_is_enabled() && timer_read() - shift_once_enabled_time >= 1000) {
|
||||
shift_once_disable();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с языком
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Lang lang_should_be = 0;
|
||||
Lang lang_current = 0;
|
||||
uint32_t lang_timer = 0;
|
||||
uint8_t lang_pressed_count = 0;
|
||||
|
||||
Key lang_get_key(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return (key - EN_GRV) + KS_GRV;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return (key - RU_JO) + KS_GRV;
|
||||
} else {
|
||||
return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Lang lang_get_lang(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return 0;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return 1;
|
||||
} else {
|
||||
return NONE_LANG;
|
||||
}
|
||||
}
|
||||
|
||||
Key lang_calc_agnostic(Key key) {
|
||||
if (lang_current == 0) {
|
||||
switch (key) {
|
||||
case AG_1: return EN_1;
|
||||
case AG_2: return EN_2;
|
||||
case AG_3: return EN_3;
|
||||
case AG_4: return EN_4;
|
||||
case AG_5: return EN_5;
|
||||
case AG_6: return EN_6;
|
||||
case AG_7: return EN_7;
|
||||
case AG_8: return EN_8;
|
||||
case AG_9: return EN_9;
|
||||
case AG_0: return EN_0;
|
||||
case AG_EXCL: return EN_EXCL;
|
||||
case AG_PERC: return EN_PERC;
|
||||
case AG_ASTR: return EN_ASTR;
|
||||
case AG_LPRN: return EN_LPRN;
|
||||
case AG_RPRN: return EN_RPRN;
|
||||
case AG_MINS: return EN_MINS;
|
||||
case AG_UNDS: return EN_UNDS;
|
||||
case AG_EQL: return EN_EQL;
|
||||
case AG_PLUS: return EN_PLUS;
|
||||
case AG_SCLN: return EN_SCLN;
|
||||
case AG_COLN: return EN_COLN;
|
||||
case AG_DQUO: return EN_DQUO;
|
||||
case AG_BSLS: return EN_BSLS;
|
||||
case AG_COMM: return EN_COMM;
|
||||
case AG_DOT: return EN_DOT;
|
||||
case AG_SLSH: return EN_SLSH;
|
||||
case AG_QUES: return EN_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
} else {
|
||||
switch (key) {
|
||||
case AG_1: return RU_1;
|
||||
case AG_2: return RU_2;
|
||||
case AG_3: return RU_3;
|
||||
case AG_4: return RU_4;
|
||||
case AG_5: return RU_5;
|
||||
case AG_6: return RU_6;
|
||||
case AG_7: return RU_7;
|
||||
case AG_8: return RU_8;
|
||||
case AG_9: return RU_9;
|
||||
case AG_0: return RU_0;
|
||||
case AG_EXCL: return RU_EXCL;
|
||||
case AG_PERC: return RU_PERC;
|
||||
case AG_ASTR: return RU_ASTR;
|
||||
case AG_LPRN: return RU_LPRN;
|
||||
case AG_RPRN: return RU_RPRN;
|
||||
case AG_MINS: return RU_MINS;
|
||||
case AG_UNDS: return RU_UNDS;
|
||||
case AG_EQL: return RU_EQL;
|
||||
case AG_PLUS: return RU_PLUS;
|
||||
case AG_SCLN: return RU_SCLN;
|
||||
case AG_COLN: return RU_COLN;
|
||||
case AG_DQUO: return RU_DQUO;
|
||||
case AG_BSLS: return RU_BSLS;
|
||||
case AG_COMM: return RU_COMM;
|
||||
case AG_DOT: return RU_DOT;
|
||||
case AG_SLSH: return RU_SLSH;
|
||||
case AG_QUES: return RU_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void) {
|
||||
return lang_should_be * 2 + 1;
|
||||
}
|
||||
|
||||
void lang_synchronize(void) {
|
||||
lang_timer = timer_read();
|
||||
switch (lang_current_change) {
|
||||
case LANG_CHANGE_CAPS: {
|
||||
// Костыль, потому что при нажатии Shift+Caps включается режим Caps, а не переключение языка :facepalm:
|
||||
if (shift_current == 1) {
|
||||
unregister_code(KC_LSFT);
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_ALT_SHIFT: {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LALT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_ALT: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LALT);
|
||||
unregister_code(KC_LALT);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_CTRL_SHIFT: {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_CTRL: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LCTL);
|
||||
unregister_code(KC_LCTL);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_WIN_SPACE: {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_SPACE);
|
||||
unregister_code(KC_SPACE);
|
||||
unregister_code(KC_LGUI);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void lang_activate(Lang lang) {
|
||||
// Нужно дополнять этот код, если нужно три языка и более
|
||||
if (lang_current != lang) {
|
||||
lang_synchronize();
|
||||
}
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
void lang_activate_from_user(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_activate(lang);
|
||||
}
|
||||
|
||||
void lang_activate_from_user_without_sync(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
Key lang_process(Key key, bool down) {
|
||||
Key after_agnostic = lang_calc_agnostic(key);
|
||||
if (after_agnostic != NONE_KEY) {
|
||||
key = after_agnostic;
|
||||
}
|
||||
|
||||
Lang new_lang = lang_get_lang(key);
|
||||
if (down) {
|
||||
if (new_lang != NONE_LANG) {
|
||||
lang_activate(new_lang);
|
||||
} else {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_lang != NONE_LANG) {
|
||||
if (down) {
|
||||
lang_pressed_count++;
|
||||
} else {
|
||||
lang_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return lang_get_key(key);
|
||||
}
|
||||
|
||||
void lang_user_timer(void) {
|
||||
// Нужно выключать язык после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (lang_pressed_count == 0 && lang_current != lang_should_be && timer_read() - lang_timer >= 100) {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Обработка клавиш
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t lang_shift_current_shift_layer = 0;
|
||||
|
||||
void lang_shift_press_key(Key key, bool down) {
|
||||
keyrecord_t record = {
|
||||
.event = {
|
||||
.key = {
|
||||
.col = 0,
|
||||
.row = 0,
|
||||
},
|
||||
.pressed = down,
|
||||
.time = timer_read(),
|
||||
},
|
||||
};
|
||||
|
||||
lang_shift_process_record(key, &record);
|
||||
}
|
||||
|
||||
void lang_shift_tap_key(Key key) {
|
||||
lang_shift_press_key(key, true);
|
||||
lang_shift_press_key(key, false);
|
||||
shift_activate(shift_should_be);
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
|
||||
bool lang_shift_process_custom_keycodes(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Обрабатываем клавиши, связанные с кастомным шифтом и кастомным переключением языка
|
||||
switch (key) {
|
||||
case SFT_N_O:
|
||||
shift_once_process_key(lang_get_shift_layer_number(), down);
|
||||
return false;
|
||||
case SFT_N:
|
||||
if (down) {
|
||||
shift_activate_from_user(true);
|
||||
lang_shift_current_shift_layer = lang_get_shift_layer_number();
|
||||
layer_on(lang_shift_current_shift_layer);
|
||||
} else {
|
||||
shift_should_be = false;
|
||||
if (shift_pressed_count == 0) {
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
layer_off(lang_shift_current_shift_layer);
|
||||
}
|
||||
return false;
|
||||
case LA_CHNG:
|
||||
if (down) {
|
||||
if (lang_should_be == 0) {
|
||||
lang_activate_from_user(1);
|
||||
layer_on(2);
|
||||
} else {
|
||||
lang_activate_from_user(0);
|
||||
layer_off(2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case LA_SYNC:
|
||||
if (down) {
|
||||
lang_synchronize();
|
||||
}
|
||||
return false;
|
||||
case LA_CAPS:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CAPS;
|
||||
}
|
||||
return false;
|
||||
case LA_ALSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_ALT_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHAL:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_ALT;
|
||||
}
|
||||
return false;
|
||||
case LA_CTSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CTRL_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHCT:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_CTRL;
|
||||
}
|
||||
return false;
|
||||
case LA_WISP:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_WIN_SPACE;
|
||||
}
|
||||
return false;
|
||||
case AG_3DOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_CMSP:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_SDOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_once_use_to_next_key(lang_get_shift_layer_number());
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_english_modifiers(Key key, keyrecord_t* record) {
|
||||
static Lang lang_stack[3] = {};
|
||||
static uint8_t modifiers_count = 0;
|
||||
#define PROCESS(NAME, REGISTER, UNREGISTER, ACTIVATE_LANG) \
|
||||
case NAME: { \
|
||||
if (record->event.pressed) { \
|
||||
lang_stack[modifiers_count] = lang_should_be; \
|
||||
modifiers_count += 1; \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_off(2); \
|
||||
} \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(0); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(0); \
|
||||
} \
|
||||
REGISTER; \
|
||||
} else { \
|
||||
UNREGISTER; \
|
||||
modifiers_count -= 1; \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(lang_stack[modifiers_count]); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(lang_stack[modifiers_count]); \
|
||||
} \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_on(2); \
|
||||
} \
|
||||
} \
|
||||
return false; \
|
||||
} break;
|
||||
|
||||
#define Rg(x) register_code(KC_L ## x)
|
||||
#define Un(x) unregister_code(KC_L ## x)
|
||||
|
||||
switch (key) {
|
||||
PROCESS(CTRL_0, Rg(CTL), Un(CTL), false);
|
||||
PROCESS(ALT_0, Rg(ALT), Un(ALT), false);
|
||||
PROCESS(WIN_0, Rg(GUI), Un(GUI), false);
|
||||
PROCESS(CTAL_0, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, false);
|
||||
PROCESS(SHAL_0, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, false);
|
||||
PROCESS(CTSH_0, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, false);
|
||||
PROCESS(MCAS_0, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, false);
|
||||
|
||||
PROCESS(CTRL_EN, Rg(CTL), Un(CTL), true);
|
||||
PROCESS(ALT_EN, Rg(ALT), Un(ALT), true);
|
||||
PROCESS(WIN_EN, Rg(GUI), Un(GUI), true);
|
||||
PROCESS(CTAL_EN, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, true);
|
||||
PROCESS(SHAL_EN, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, true);
|
||||
PROCESS(CTSH_EN, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, true);
|
||||
PROCESS(MCAS_EN, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record) {
|
||||
// Обрабатываем Once Shift
|
||||
shift_once_process(key, record);
|
||||
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша какой-то язык, заданный в ней
|
||||
Key key1 = lang_process(key, down);
|
||||
Key key_to_shift = key;
|
||||
if (key1 != NONE_KEY) {
|
||||
key_to_shift = key1;
|
||||
}
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша шифт, засунутый в неё
|
||||
// Это нужно отдельно от обработки языка, чтобы шифт мог выключаться для обычных клавиш
|
||||
Key key2 = shift_process(key_to_shift, down);
|
||||
if (key2 != NONE_KEY) {
|
||||
if (down) {
|
||||
register_code(key2);
|
||||
} else {
|
||||
unregister_code(key2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_custom_keycodes(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_english_modifiers(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void lang_shift_user_timer(void) {
|
||||
shift_user_timer();
|
||||
shift_once_user_timer();
|
||||
lang_user_timer();
|
||||
}
|
||||
17
corne/v3vial-old/rules.mk
Normal file
17
corne/v3vial-old/rules.mk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
LTO_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
NKRO_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
||||
MUSIC_ENABLE = no
|
||||
OLED_ENABLE = no
|
||||
COMBO_ENABLE = no
|
||||
KEY_OVERRIDE_ENABLE = no
|
||||
QMK_SETTINGS = no
|
||||
|
||||
VIAL_INSECURE = yes
|
||||
VIA_ENABLE = yes
|
||||
VIAL_ENABLE = yes
|
||||
30
corne/v3vial-old/vial.json
Normal file
30
corne/v3vial-old/vial.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "Crkbd",
|
||||
"vendorId": "0x4653",
|
||||
"productId": "0x0001",
|
||||
"lighting": {
|
||||
"extends": "qmk_rgblight"
|
||||
},
|
||||
"matrix": { "rows": 8, "cols": 6 },
|
||||
"layouts": {
|
||||
"keymap": [
|
||||
[{"y":1,"x":3.5},"0,3",{"x":7.5},"4,3"],
|
||||
[{"y":-0.875,"x":2.5},"0,2",{"x":1},"0,4",{"x":5.5},"4,4",{"x":1},"4,2"],
|
||||
[{"y":-0.875,"x":5.5},"0,5",{"x":3.5},"4,5"],
|
||||
[{"y":-0.875,"x":0.5},"0,0","0,1",{"x":11.5},"4,1","4,0"],
|
||||
[{"y":-0.375,"x":3.5},"1,3",{"x":7.5},"5,3"],
|
||||
[{"y":-0.875,"x":2.5},"1,2",{"x":1},"1,4",{"x":5.5},"5,4",{"x":1},"5,2"],
|
||||
[{"y":-0.875,"x":5.5},"1,5",{"x":3.5},"5,5"],
|
||||
[{"y":-0.875,"x":0.5},"1,0","1,1",{"x":11.5},"5,1","5,0"],
|
||||
[{"y":-0.375,"x":3.5},"2,3",{"x":7.5},"6,3"],
|
||||
[{"y":-0.875,"x":2.5},"2,2",{"x":1},"2,4",{"x":5.5},"6,4",{"x":1},"6,2"],
|
||||
[{"y":-0.875,"x":5.5},"2,5",{"x":3.5},"6,5"],
|
||||
[{"y":-0.875,"x":0.5},"2,0","2,1",{"x":11.5},"6,1","6,0"],
|
||||
[{"y":-0.125,"x":4},"3,3",{"x":6.5},"7,3"],
|
||||
[{"r":15,"rx":4.5,"ry":9.1,"y":-4.85,"x":-0.5},"3,4"],
|
||||
[{"r":30,"rx":5.4,"ry":9.3,"y":-5.05,"x":-1.4,"h":1.5},"3,5"],
|
||||
[{"r":-30,"rx":11.1,"y":-5.05,"x":0.4,"h":1.5},"7,5"],
|
||||
[{"r":-15,"rx":12,"ry":9.1,"y":-4.85,"x":-0.5},"7,4"]
|
||||
]
|
||||
}
|
||||
}
|
||||
48
corne/v4.1vial/README.md
Normal file
48
corne/v4.1vial/README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Corne v4.1
|
||||
|
||||
My keyboard settings. Mostly inspired by [Miryoku](https://github.com/manna-harbour/miryoku) and [this](https://habr.com/ru/articles/717912/) Russian keyboard layout.
|
||||
|
||||
# TODO:
|
||||
|
||||
- Add custom keycodes to VIAL https://get.vial.today/manual/custom_keycode.html
|
||||
|
||||
# Layout
|
||||
|
||||
My phonetic layout (en/ru):
|
||||
```
|
||||
|-----------------------------------|-----------------------------------|
|
||||
| | -/щ | -/э | x/я | q/ы | -/ъ | j/й | d/д | l/л | k/к | c/ц | -/ж |
|
||||
|-----------------------------------|-----------------------------------|
|
||||
| f/ф | s/с | e/е | o/о | a/а | -/ь | g/г | t/т | n/н | v/в | h/х | -/ч |
|
||||
|-----------------------------------|-----------------------------------|
|
||||
| | w/ш | u/ю | y/у | i/и | -/ё | b/б | m/м | r/р | p/п | z/з | |
|
||||
|-----------------------------------------------------------------------|
|
||||
```
|
||||
RU:
|
||||
```
|
||||
|-----------------------|-----------------------|
|
||||
| | щ | э | я | ы | ъ | й | д | л | к | ц | ж |
|
||||
| ф | с | е | о | а | ь | г | т | н | в | х | ч |
|
||||
| | ш | ю | у | и | ё | б | м | р | п | з | |
|
||||
|-----------------------|-----------------------|
|
||||
```
|
||||
|
||||
ENG:
|
||||
```
|
||||
|-----------------------|-----------------------|
|
||||
| | | | x | q | | j | d | l | k | c | |
|
||||
| f | s | e | o | a | | g | t | n | v | h | |
|
||||
| | w | u | y | i | | b | m | r | p | z | |
|
||||
|-----------------------|-----------------------|
|
||||
```
|
||||
|
||||
# Flashing
|
||||
|
||||
https://get.vial.today/docs/porting-to-vial.html
|
||||
https://docs.qmk.fm/newbs_getting_started
|
||||
|
||||
- `git clone https://github.com/vial-kb/vial-qmk`
|
||||
- Move your files to the `~/vial-qmk/keyboards/crkbd/keymaps/vial/` directory. Or you can create your own directory in `keymaps` instead of `vial` and put your files there.
|
||||
- `make crkbd/rev4_1:vial`
|
||||
- `qmk flash -kb crkbd/rev4_1 -km vial`
|
||||
|
||||
69
corne/v4.1vial/config.h
Normal file
69
corne/v4.1vial/config.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Copyright 2019 @foostan
|
||||
Copyright 2020 Drashna Jaelre <@drashna>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VIAL_KEYBOARD_UID {0x3B, 0x6B, 0xA0, 0x29, 0x80, 0x56, 0xED, 0xD1}
|
||||
#define VIAL_UNLOCK_COMBO_ROWS {0, 0}
|
||||
#define VIAL_UNLOCK_COMBO_COLS {0, 1}
|
||||
|
||||
#undef DYNAMIC_KEYMAP_LAYER_COUNT
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 16
|
||||
#define TAPPING_TERM 200
|
||||
|
||||
#define LANG_CHANGE_DEFAULT LANG_CHANGE_CAPS
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_ALT_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_CTRL_SHIFT
|
||||
// #define LANG_CHANGE_DEFAULT LANG_CHANGE_WIN_SPACE
|
||||
|
||||
// #define RGB_MATRIX_ENABLE
|
||||
// #define RGBLIGHT_LAYERS
|
||||
#define RGB_MATRIX_DRIVER ws2812
|
||||
// #define ENABLE_RGB_MATRIX_SOLID_COLOR
|
||||
#define SPLIT_LAYER_STATE_ENABLE
|
||||
|
||||
// Holding mouse movement keys moves the cursor at constant speeds
|
||||
#define MK_3_SPEED
|
||||
|
||||
//#define USE_MATRIX_I2C
|
||||
#ifdef KEYBOARD_crkbd_rev1_legacy
|
||||
# undef USE_I2C
|
||||
# define USE_SERIAL
|
||||
#endif
|
||||
|
||||
/* Select hand configuration */
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
#define USE_SERIAL_PD2
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# undef RGBLIGHT_LED_COUNT
|
||||
# define RGBLIGHT_ANIMATIONS
|
||||
# define RGBLIGHT_LED_COUNT 54
|
||||
# undef RGBLED_SPLIT
|
||||
# define RGBLED_SPLIT \
|
||||
{ 27, 27 }
|
||||
# define RGBLIGHT_LIMIT_VAL 120
|
||||
# define RGBLIGHT_HUE_STEP 10
|
||||
# define RGBLIGHT_SAT_STEP 17
|
||||
# define RGBLIGHT_VAL_STEP 17
|
||||
#endif
|
||||
|
||||
/*#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"*/
|
||||
738
corne/v4.1vial/keymap.c
Normal file
738
corne/v4.1vial/keymap.c
Normal file
|
|
@ -0,0 +1,738 @@
|
|||
/*
|
||||
Copyright 2019 @foostan
|
||||
Copyright 2020 Drashna Jaelre <@drashna>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "rgb_matrix.h"
|
||||
|
||||
#define CUSTOM_SAFE_RANGE SAFE_RANGE
|
||||
#include "lang_shift/include.h"
|
||||
|
||||
#define L_ENG 0
|
||||
#define L_GAME 1
|
||||
#define L_RU 2
|
||||
#define L_MEDIA 3
|
||||
#define L_NAV 4
|
||||
#define L_MOUSE 5
|
||||
#define L_SYM 6
|
||||
#define L_NUM 7
|
||||
#define L_FUN 8
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[L_ENG] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_ESC, /* matrix [0,0] */
|
||||
/* 01 */ G(KC_ESC), /* matrix [0,1] */
|
||||
/* 02 */ KC_NO, /* matrix [0,2] */
|
||||
/* 03 */ KC_X, /* matrix [0,3] */
|
||||
/* 04 */ KC_Q, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ DF(L_GAME), /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ KC_J, /* matrix [4,5] */
|
||||
/* 09 */ KC_D, /* matrix [4,4] */
|
||||
/* 10 */ KC_L, /* matrix [4,3] */
|
||||
/* 11 */ KC_K, /* matrix [4,2] */
|
||||
/* 12 */ KC_C, /* matrix [4,1] */
|
||||
/* 13 */ KC_NO, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_F, /* matrix [1,0] */
|
||||
/* 15 */ LWIN_T(KC_S), /* matrix [1,1] */
|
||||
/* 16 */ ALT_T(KC_E), /* matrix [1,2] */
|
||||
/* 17 */ CTL_T(KC_O), /* matrix [1,3] */
|
||||
/* 18 */ SFT_T(KC_A), /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_G, /* matrix [5,5] */
|
||||
/* 23 */ SFT_T(KC_T), /* matrix [5,4] */
|
||||
/* 24 */ CTL_T(KC_N), /* matrix [5,3] */
|
||||
/* 25 */ ALT_T(KC_V), /* matrix [5,2] */
|
||||
/* 26 */ LWIN_T(KC_H), /* matrix [5,1] */
|
||||
/* 27 */ ONCE_SHIFT, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_W, /* matrix [2,1] */
|
||||
/* 30 */ KC_U, /* matrix [2,2] */
|
||||
/* 31 */ KC_Y, /* matrix [2,3] */
|
||||
/* 32 */ KC_I, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_B, /* matrix [6,5] */
|
||||
/* 35 */ KC_M, /* matrix [6,4] */
|
||||
/* 36 */ KC_R, /* matrix [6,3] */
|
||||
/* 37 */ KC_P, /* matrix [6,2] */
|
||||
/* 38 */ KC_Z, /* matrix [6,1] */
|
||||
/* 39 */ LA_CHNG, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ LT(L_MEDIA, KC_ENT), /* matrix [3,3] */
|
||||
/* 41 */ LT(L_MOUSE, KC_BSPC), /* matrix [3,4] */
|
||||
/* 42 */ MO(L_NAV), /* matrix [3,5] */
|
||||
|
||||
/* 43 */ MO(L_SYM), /* matrix [7,5] */
|
||||
/* 44 */ LT(L_FUN, KC_SPC), /* matrix [7,4] */
|
||||
/* 45 */ MO(L_NUM) /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_RU] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_ESC, /* matrix [0,0] */
|
||||
/* 01 */ KC_O, /* matrix [0,1] */
|
||||
/* 02 */ KC_QUOT, /* matrix [0,2] */
|
||||
/* 03 */ KC_Z, /* matrix [0,3] */
|
||||
/* 04 */ KC_S, /* matrix [0,4] */
|
||||
/* 05 */ KC_RBRC, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ KC_Q, /* matrix [4,5] */
|
||||
/* 09 */ KC_L, /* matrix [4,4] */
|
||||
/* 10 */ KC_K, /* matrix [4,3] */
|
||||
/* 11 */ KC_R, /* matrix [4,2] */
|
||||
/* 12 */ KC_W, /* matrix [4,1] */
|
||||
/* 13 */ KC_SCLN, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_A, /* matrix [1,0] */
|
||||
/* 15 */ LWIN_T(KC_C), /* matrix [1,1] */
|
||||
/* 16 */ ALT_T(KC_T), /* matrix [1,2] */
|
||||
/* 17 */ CTL_T(KC_J), /* matrix [1,3] */
|
||||
/* 18 */ SFT_T(KC_F), /* matrix [1,4] */
|
||||
/* 19 */ KC_M, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_U, /* matrix [5,5] */
|
||||
/* 23 */ SFT_T(KC_N), /* matrix [5,4] */
|
||||
/* 24 */ CTL_T(KC_Y), /* matrix [5,3] */
|
||||
/* 25 */ ALT_T(KC_D), /* matrix [5,2] */
|
||||
/* 26 */ LWIN_T(KC_LBRC), /* matrix [5,1] */
|
||||
/* 27 */ KC_X, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ LA_CHNG, /* matrix [2,0] */
|
||||
/* 29 */ KC_I, /* matrix [2,1] */
|
||||
/* 30 */ KC_DOT, /* matrix [2,2] */
|
||||
/* 31 */ KC_E, /* matrix [2,3] */
|
||||
/* 32 */ KC_B, /* matrix [2,4] */
|
||||
/* 33 */ KC_GRV, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_COMM, /* matrix [6,5] */
|
||||
/* 35 */ KC_V, /* matrix [6,4] */
|
||||
/* 36 */ KC_H, /* matrix [6,3] */
|
||||
/* 37 */ KC_G, /* matrix [6,2] */
|
||||
/* 38 */ KC_P, /* matrix [6,1] */
|
||||
/* 39 */ KC_NO, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ LT(L_MEDIA, KC_ENT), /* matrix [3,3] */
|
||||
/* 41 */ LT(L_MOUSE, KC_BSPC), /* matrix [3,4] */
|
||||
/* 42 */ MO(L_NAV), /* matrix [3,5] */
|
||||
|
||||
/* 43 */ MO(L_SYM), /* matrix [7,5] */
|
||||
/* 44 */ LT(L_FUN, KC_SPC), /* matrix [7,4] */
|
||||
/* 45 */ MO(L_NUM) /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_MEDIA] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ KC_RWIN, /* matrix [0,1] */
|
||||
/* 02 */ KC_RALT, /* matrix [0,2] */
|
||||
/* 03 */ KC_RCTL, /* matrix [0,3] */
|
||||
/* 04 */ KC_RSFT, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ NK_ON, /* matrix [4,5] */
|
||||
/* 09 */ KC_VOLD, /* matrix [4,4] */
|
||||
/* 10 */ KC_VOLU, /* matrix [4,3] */
|
||||
/* 11 */ LA_SYNC, /* matrix [4,2] */
|
||||
/* 12 */ RGB_TOG, /* matrix [4,1] */
|
||||
/* 13 */ KC_NO, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_NO, /* matrix [1,0] */
|
||||
/* 15 */ KC_LWIN, /* matrix [1,1] */
|
||||
/* 16 */ KC_LALT, /* matrix [1,2] */
|
||||
/* 17 */ KC_LCTL, /* matrix [1,3] */
|
||||
/* 18 */ KC_LSFT, /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ NK_TOGG, /* matrix [5,5] */
|
||||
/* 23 */ KC_MPLY, /* matrix [5,4] */
|
||||
/* 24 */ KC_MPRV, /* matrix [5,3] */
|
||||
/* 25 */ KC_MNXT, /* matrix [5,2] */
|
||||
/* 26 */ KC_MUTE, /* matrix [5,1] */
|
||||
/* 27 */ KC_NO, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_RWIN, /* matrix [2,1] */
|
||||
/* 30 */ KC_RALT, /* matrix [2,2] */
|
||||
/* 31 */ KC_RCTL, /* matrix [2,3] */
|
||||
/* 32 */ KC_RSFT, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ NK_OFF, /* matrix [6,5] */
|
||||
/* 35 */ LA_CAPS, /* matrix [6,4] */
|
||||
/* 36 */ LA_ALSH, /* matrix [6,3] */
|
||||
/* 37 */ LA_CTSH, /* matrix [6,2] */
|
||||
/* 38 */ LA_WISP, /* matrix [6,1] */
|
||||
/* 39 */ KC_NO, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_NO, /* matrix [3,3] */
|
||||
/* 41 */ KC_NO, /* matrix [3,4] */
|
||||
/* 42 */ KC_NO, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_NO, /* matrix [7,5] */
|
||||
/* 44 */ KC_NO, /* matrix [7,4] */
|
||||
/* 45 */ KC_NO /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_NAV] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ KC_NO, /* matrix [0,1] */
|
||||
/* 02 */ KC_NO, /* matrix [0,2] */
|
||||
/* 03 */ KC_NO, /* matrix [0,3] */
|
||||
/* 04 */ KC_NO, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ C(KC_Y), /* matrix [4,5] */
|
||||
/* 09 */ C(KC_V), /* matrix [4,4] */
|
||||
/* 10 */ C(KC_C), /* matrix [4,3] */
|
||||
/* 11 */ C(KC_X), /* matrix [4,2] */
|
||||
/* 12 */ C(KC_Z), /* matrix [4,1] */
|
||||
/* 13 */ C(KC_S), /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_NO, /* matrix [1,0] */
|
||||
/* 15 */ KC_LWIN, /* matrix [1,1] */
|
||||
/* 16 */ KC_LALT, /* matrix [1,2] */
|
||||
/* 17 */ KC_LCTL, /* matrix [1,3] */
|
||||
/* 18 */ KC_LSFT, /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_CAPS, /* matrix [5,5] */
|
||||
/* 23 */ KC_LEFT, /* matrix [5,4] */
|
||||
/* 24 */ KC_DOWN, /* matrix [5,3] */
|
||||
/* 25 */ KC_UP, /* matrix [5,2] */
|
||||
/* 26 */ KC_RGHT, /* matrix [5,1] */
|
||||
/* 27 */ KC_TAB, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_NO, /* matrix [2,1] */
|
||||
/* 30 */ KC_NO, /* matrix [2,2] */
|
||||
/* 31 */ KC_NO, /* matrix [2,3] */
|
||||
/* 32 */ KC_NO, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_INS, /* matrix [6,5] */
|
||||
/* 35 */ KC_HOME, /* matrix [6,4] */
|
||||
/* 36 */ KC_PGDN, /* matrix [6,3] */
|
||||
/* 37 */ KC_PGUP, /* matrix [6,2] */
|
||||
/* 38 */ KC_END, /* matrix [6,1] */
|
||||
/* 39 */ KC_DEL, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_NO, /* matrix [3,3] */
|
||||
/* 41 */ KC_NO, /* matrix [3,4] */
|
||||
/* 42 */ KC_NO, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_NO, /* matrix [7,5] */
|
||||
/* 44 */ KC_NO, /* matrix [7,4] */
|
||||
/* 45 */ KC_NO /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_MOUSE] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ KC_BTN5, /* matrix [0,1] */
|
||||
/* 02 */ KC_BTN1, /* matrix [0,2] */
|
||||
/* 03 */ KC_BTN3, /* matrix [0,3] */
|
||||
/* 04 */ KC_BTN2, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ C(KC_Y), /* matrix [4,5] */
|
||||
/* 09 */ C(KC_V), /* matrix [4,4] */
|
||||
/* 10 */ C(KC_C), /* matrix [4,3] */
|
||||
/* 11 */ C(KC_X), /* matrix [4,2] */
|
||||
/* 12 */ C(KC_Z), /* matrix [4,1] */
|
||||
/* 13 */ C(KC_S), /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_NO, /* matrix [1,0] */
|
||||
/* 15 */ KC_LWIN, /* matrix [1,1] */
|
||||
/* 16 */ KC_LALT, /* matrix [1,2] */
|
||||
/* 17 */ KC_LCTL, /* matrix [1,3] */
|
||||
/* 18 */ KC_LSFT, /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_CAPS, /* matrix [5,5] */
|
||||
/* 23 */ KC_MS_L, /* matrix [5,4] */
|
||||
/* 24 */ KC_MS_D, /* matrix [5,3] */
|
||||
/* 25 */ KC_MS_U, /* matrix [5,2] */
|
||||
/* 26 */ KC_MS_R, /* matrix [5,1] */
|
||||
/* 27 */ KC_TAB, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_BTN4, /* matrix [2,1] */
|
||||
/* 30 */ KC_ACL2, /* matrix [2,2] */
|
||||
/* 31 */ KC_ACL1, /* matrix [2,3] */
|
||||
/* 32 */ KC_ACL0, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_INS, /* matrix [6,5] */
|
||||
/* 35 */ KC_WH_L, /* matrix [6,4] */
|
||||
/* 36 */ KC_WH_D, /* matrix [6,3] */
|
||||
/* 37 */ KC_WH_U, /* matrix [6,2] */
|
||||
/* 38 */ KC_WH_R, /* matrix [6,1] */
|
||||
/* 39 */ KC_DEL, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_NO, /* matrix [3,3] */
|
||||
/* 41 */ KC_NO, /* matrix [3,4] */
|
||||
/* 42 */ KC_NO, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_BTN1, /* matrix [7,5] */
|
||||
/* 44 */ KC_BTN3, /* matrix [7,4] */
|
||||
/* 45 */ KC_BTN2 /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_SYM] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ EN_AT, /* matrix [0,1] */
|
||||
/* 02 */ EN_HASH, /* matrix [0,2] */
|
||||
/* 03 */ ONCE_SHIFT, /* matrix [0,3] */
|
||||
/* 04 */ AG_DOT, /* matrix [0,4] */
|
||||
/* 05 */ EN_CIRC, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ EN_AMPR, /* matrix [4,5] */
|
||||
/* 09 */ AG_ASTR, /* matrix [4,4] */
|
||||
/* 10 */ AG_MINS, /* matrix [4,3] */
|
||||
/* 11 */ AG_EQL, /* matrix [4,2] */
|
||||
/* 12 */ AG_PLUS, /* matrix [4,1] */
|
||||
/* 13 */ KC_NO, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ AG_COMM, /* matrix [1,0] */
|
||||
/* 15 */ AG_EXCL, /* matrix [1,1] */
|
||||
/* 16 */ AG_QUES, /* matrix [1,2] */
|
||||
/* 17 */ COMMA_SPACE, /* matrix [1,3] */
|
||||
/* 18 */ SMART_DOT, /* matrix [1,4] */
|
||||
/* 19 */ AG_PERC, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ EN_PIPE, /* matrix [5,5] */
|
||||
/* 23 */ AG_LPRN, /* matrix [5,4] */
|
||||
/* 24 */ EN_LCBR, /* matrix [5,3] */
|
||||
/* 25 */ EN_LBRC, /* matrix [5,2] */
|
||||
/* 26 */ EN_LT, /* matrix [5,1] */
|
||||
/* 27 */ EN_GRV, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ CW_TOGG, /* matrix [2,0] */
|
||||
/* 29 */ EN_SLSH, /* matrix [2,1] */
|
||||
/* 30 */ RU_NUME, /* matrix [2,2] */
|
||||
/* 31 */ AG_DQUO, /* matrix [2,3] */
|
||||
/* 32 */ EN_QUOT, /* matrix [2,4] */
|
||||
/* 33 */ EN_DLR, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ AG_BSLS, /* matrix [6,5] */
|
||||
/* 35 */ AG_RPRN, /* matrix [6,4] */
|
||||
/* 36 */ EN_RCBR, /* matrix [6,3] */
|
||||
/* 37 */ EN_RBRC, /* matrix [6,2] */
|
||||
/* 38 */ EN_GT, /* matrix [6,1] */
|
||||
/* 39 */ EN_TILD, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ AG_UNDS, /* matrix [3,3] */
|
||||
/* 41 */ AG_COLN, /* matrix [3,4] */
|
||||
/* 42 */ AG_SCLN, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_NO, /* matrix [7,5] */
|
||||
/* 44 */ KC_NO, /* matrix [7,4] */
|
||||
/* 45 */ KC_NO /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_NUM] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ KC_NO, /* matrix [0,1] */
|
||||
/* 02 */ AG_1, /* matrix [0,2] */
|
||||
/* 03 */ AG_2, /* matrix [0,3] */
|
||||
/* 04 */ AG_3, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ KC_NO, /* matrix [4,5] */
|
||||
/* 09 */ KC_NO, /* matrix [4,4] */
|
||||
/* 10 */ KC_NO, /* matrix [4,3] */
|
||||
/* 11 */ KC_NO, /* matrix [4,2] */
|
||||
/* 12 */ KC_NO, /* matrix [4,1] */
|
||||
/* 13 */ KC_NO, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_NO, /* matrix [1,0] */
|
||||
/* 15 */ AG_0, /* matrix [1,1] */
|
||||
/* 16 */ AG_4, /* matrix [1,2] */
|
||||
/* 17 */ AG_5, /* matrix [1,3] */
|
||||
/* 18 */ AG_6, /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_NO, /* matrix [5,5] */
|
||||
/* 23 */ KC_LSFT, /* matrix [5,4] */
|
||||
/* 24 */ KC_LCTL, /* matrix [5,3] */
|
||||
/* 25 */ KC_LALT, /* matrix [5,2] */
|
||||
/* 26 */ KC_LWIN, /* matrix [5,1] */
|
||||
/* 27 */ KC_NO, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_PSCR, /* matrix [2,1] */
|
||||
/* 30 */ AG_7, /* matrix [2,2] */
|
||||
/* 31 */ AG_8, /* matrix [2,3] */
|
||||
/* 32 */ AG_9, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_NO, /* matrix [6,5] */
|
||||
/* 35 */ KC_NO, /* matrix [6,4] */
|
||||
/* 36 */ KC_NO, /* matrix [6,3] */
|
||||
/* 37 */ KC_NO, /* matrix [6,2] */
|
||||
/* 38 */ KC_NO, /* matrix [6,1] */
|
||||
/* 39 */ KC_NO, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_ENT, /* matrix [3,3] */
|
||||
/* 41 */ KC_BSPC, /* matrix [3,4] */
|
||||
/* 42 */ KC_NO, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_NO, /* matrix [7,5] */
|
||||
/* 44 */ KC_NO, /* matrix [7,4] */
|
||||
/* 45 */ KC_NO /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_FUN] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_NO, /* matrix [0,0] */
|
||||
/* 01 */ KC_F10, /* matrix [0,1] */
|
||||
/* 02 */ KC_F1, /* matrix [0,2] */
|
||||
/* 03 */ KC_F2, /* matrix [0,3] */
|
||||
/* 04 */ KC_F3, /* matrix [0,4] */
|
||||
/* 05 */ KC_NO, /* matrix [0,5] */
|
||||
/* 06 */ KC_NO, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ KC_NO, /* matrix [4,5] */
|
||||
/* 09 */ KC_NO, /* matrix [4,4] */
|
||||
/* 10 */ KC_NO, /* matrix [4,3] */
|
||||
/* 11 */ KC_NO, /* matrix [4,2] */
|
||||
/* 12 */ KC_NO, /* matrix [4,1] */
|
||||
/* 13 */ KC_NO, /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_NO, /* matrix [1,0] */
|
||||
/* 15 */ KC_F11, /* matrix [1,1] */
|
||||
/* 16 */ KC_F4, /* matrix [1,2] */
|
||||
/* 17 */ KC_F5, /* matrix [1,3] */
|
||||
/* 18 */ KC_F6, /* matrix [1,4] */
|
||||
/* 19 */ KC_NO, /* matrix [1,5] */
|
||||
/* 20 */ KC_NO, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_NO, /* matrix [5,5] */
|
||||
/* 23 */ KC_LSFT, /* matrix [5,4] */
|
||||
/* 24 */ KC_LCTL, /* matrix [5,3] */
|
||||
/* 25 */ KC_LALT, /* matrix [5,2] */
|
||||
/* 26 */ KC_LWIN, /* matrix [5,1] */
|
||||
/* 27 */ KC_NO, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_NO, /* matrix [2,0] */
|
||||
/* 29 */ KC_F12, /* matrix [2,1] */
|
||||
/* 30 */ KC_F7, /* matrix [2,2] */
|
||||
/* 31 */ KC_F8, /* matrix [2,3] */
|
||||
/* 32 */ KC_F9, /* matrix [2,4] */
|
||||
/* 33 */ KC_NO, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_NO, /* matrix [6,5] */
|
||||
/* 35 */ KC_NO, /* matrix [6,4] */
|
||||
/* 36 */ KC_NO, /* matrix [6,3] */
|
||||
/* 37 */ KC_NO, /* matrix [6,2] */
|
||||
/* 38 */ KC_NO, /* matrix [6,1] */
|
||||
/* 39 */ KC_NO, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_NO, /* matrix [3,3] */
|
||||
/* 41 */ KC_NO, /* matrix [3,4] */
|
||||
/* 42 */ KC_NO, /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_NO, /* matrix [7,5] */
|
||||
/* 44 */ KC_NO, /* matrix [7,4] */
|
||||
/* 45 */ KC_NO /* matrix [7,3] */
|
||||
),
|
||||
|
||||
[L_GAME] = LAYOUT_split_3x6_3_ex2(
|
||||
// top row (левая половина)
|
||||
/* 00 */ KC_TAB, /* matrix [0,0] */
|
||||
/* 01 */ KC_T, /* matrix [0,1] */
|
||||
/* 02 */ KC_Q, /* matrix [0,2] */
|
||||
/* 03 */ KC_W, /* matrix [0,3] */
|
||||
/* 04 */ KC_E, /* matrix [0,4] */
|
||||
/* 05 */ KC_R, /* matrix [0,5] */
|
||||
/* 06 */ KC_ENT, /* matrix [0,6] */
|
||||
|
||||
// top row (правая половина)
|
||||
/* 07 */ KC_NO, /* matrix [4,6] */
|
||||
/* 08 */ KC_Y, /* matrix [4,5] */
|
||||
/* 09 */ KC_U, /* matrix [4,4] */
|
||||
/* 10 */ KC_I, /* matrix [4,3] */
|
||||
/* 11 */ KC_O, /* matrix [4,2] */
|
||||
/* 12 */ KC_P, /* matrix [4,1] */
|
||||
/* 13 */ DF(L_ENG), /* matrix [4,0] */
|
||||
|
||||
// home row (левая половина)
|
||||
/* 14 */ KC_LSFT, /* matrix [1,0] */
|
||||
/* 15 */ KC_G, /* matrix [1,1] */
|
||||
/* 16 */ KC_A, /* matrix [1,2] */
|
||||
/* 17 */ KC_S, /* matrix [1,3] */
|
||||
/* 18 */ KC_D, /* matrix [1,4] */
|
||||
/* 19 */ KC_F, /* matrix [1,5] */
|
||||
/* 20 */ KC_ESC, /* matrix [1,6] */
|
||||
|
||||
// home row (правая половина)
|
||||
/* 21 */ KC_NO, /* matrix [5,6] */
|
||||
/* 22 */ KC_H, /* matrix [5,5] */
|
||||
/* 23 */ KC_J, /* matrix [5,4] */
|
||||
/* 24 */ KC_UP, /* matrix [5,3] */
|
||||
/* 25 */ KC_K, /* matrix [5,2] */
|
||||
/* 26 */ KC_L, /* matrix [5,1] */
|
||||
/* 27 */ KC_GRV, /* matrix [5,0] */
|
||||
|
||||
// mid row (левая половина)
|
||||
/* 28 */ KC_LCTL, /* matrix [2,0] */
|
||||
/* 29 */ KC_B, /* matrix [2,1] */
|
||||
/* 30 */ KC_Z, /* matrix [2,2] */
|
||||
/* 31 */ KC_X, /* matrix [2,3] */
|
||||
/* 32 */ KC_C, /* matrix [2,4] */
|
||||
/* 33 */ KC_V, /* matrix [2,5] */
|
||||
|
||||
// mid row (правая половина)
|
||||
/* 34 */ KC_N, /* matrix [6,5] */
|
||||
/* 35 */ KC_LEFT, /* matrix [6,4] */
|
||||
/* 36 */ KC_DOWN, /* matrix [6,3] */
|
||||
/* 37 */ KC_RGHT, /* matrix [6,2] */
|
||||
/* 38 */ KC_M, /* matrix [6,1] */
|
||||
/* 39 */ KC_SLSH, /* matrix [6,0] */
|
||||
|
||||
// thumb cluster (левая 3, правая 3)
|
||||
/* 40 */ KC_LALT, /* matrix [3,3] */
|
||||
/* 41 */ KC_SPC, /* matrix [3,4] */
|
||||
/* 42 */ MO(L_NUM), /* matrix [3,5] */
|
||||
|
||||
/* 43 */ KC_H, /* matrix [7,5] */
|
||||
/* 44 */ KC_SPC, /* matrix [7,4] */
|
||||
/* 45 */ MO(L_FUN) /* matrix [7,3] */
|
||||
)
|
||||
};
|
||||
|
||||
bool shift_on_next_key = false;
|
||||
|
||||
// Обработка нажатий?
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { // В конце должно быть true, чтоб символ напечатался.
|
||||
// lang_shift
|
||||
if (!lang_shift_process_record(keycode, record))
|
||||
return false;
|
||||
|
||||
|
||||
// Одиночный шифт от GPT4. Oдиночный шифт lang_shift не нравится. Мой шифт не умеет работать с кастом кейкодами lang_shift
|
||||
if (keycode == ONCE_SHIFT && record->event.pressed) {
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shift_on_next_key && record->event.pressed) {
|
||||
register_code(KC_LSFT);
|
||||
register_code(keycode);
|
||||
unregister_code(keycode);
|
||||
unregister_code(KC_LSFT);
|
||||
shift_on_next_key = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Умная точка
|
||||
if (keycode == SMART_DOT && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_on_next_key = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Запятая + пробел
|
||||
if (keycode == COMMA_SPACE && record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Если условия выше не сработали, то отправить символ как есть
|
||||
};
|
||||
|
||||
void user_timer(void) {
|
||||
lang_shift_user_timer();
|
||||
};
|
||||
|
||||
// Lighting Layers
|
||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
switch(get_highest_layer(layer_state|default_layer_state)) {
|
||||
case L_ENG:
|
||||
rgb_matrix_set_color(i, RGB_PINK);
|
||||
break;
|
||||
case L_RU:
|
||||
rgb_matrix_set_color(i, RGB_PURPLE);
|
||||
break;
|
||||
case L_MEDIA:
|
||||
rgb_matrix_set_color(i, RGB_MAGENTA);
|
||||
break;
|
||||
case L_NAV:
|
||||
rgb_matrix_set_color(i, RGB_CYAN);
|
||||
break;
|
||||
case L_MOUSE:
|
||||
rgb_matrix_set_color(i, RGB_YELLOW);
|
||||
break;
|
||||
case L_SYM:
|
||||
rgb_matrix_set_color(i, RGB_GREEN);
|
||||
break;
|
||||
case L_NUM:
|
||||
rgb_matrix_set_color(i, RGB_BLUE);
|
||||
break;
|
||||
case L_FUN:
|
||||
rgb_matrix_set_color(i, RGB_RED);
|
||||
break;
|
||||
case L_GAME:
|
||||
rgb_matrix_set_color(i, RGB_ORANGE);
|
||||
break;
|
||||
|
||||
default: // for any other layers, or the default layer
|
||||
rgb_matrix_set_color(i, RGB_WHITE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
user_timer();
|
||||
|
||||
// // Проверяем, активен ли слой
|
||||
// if (!layer_state_cmp(layer_state, L_MEDIA) &&
|
||||
// !layer_state_cmp(layer_state, L_NAV) &&
|
||||
// !layer_state_cmp(layer_state, L_MOUSE) &&
|
||||
// !layer_state_cmp(layer_state, L_SYM) &&
|
||||
// !layer_state_cmp(layer_state, L_NUM) &&
|
||||
// !layer_state_cmp(layer_state, L_FUN) &&
|
||||
// !layer_state_cmp(layer_state, L_RU)) {
|
||||
// // Если ни один из этих слоев не активен, обновляем подсветку на основе текущего базового слоя
|
||||
// default_layer_state_set_user(default_layer_state);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
bool caps_word_press_user(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
// Keycodes that continue Caps Word, with shift applied.
|
||||
case KC_A ... KC_Z:
|
||||
case KC_MINS:
|
||||
case KC_QUOT:
|
||||
case KC_RBRC:
|
||||
case KC_SCLN:
|
||||
case KC_COMM:
|
||||
case KC_GRV:
|
||||
case KC_LBRC:
|
||||
case KC_DOT:
|
||||
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
|
||||
return true;
|
||||
|
||||
// Keycodes that continue Caps Word, without shifting.
|
||||
case KC_1 ... KC_0:
|
||||
case KC_BSPC:
|
||||
case KC_DEL:
|
||||
case KC_UNDS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false; // Deactivate Caps Word.
|
||||
}
|
||||
}
|
||||
|
||||
341
corne/v4.1vial/lang_shift/include.h
Normal file
341
corne/v4.1vial/lang_shift/include.h
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef CUSTOM_SAFE_RANGE
|
||||
#error "You must specify variable CUSTOM_SAFE_RANGE for lang_shift extension."
|
||||
#endif
|
||||
|
||||
enum lang_shift_keycodes {
|
||||
LANG_SHIFT_START = CUSTOM_SAFE_RANGE,
|
||||
|
||||
// Кейкоды, на основе которых реализуются кейкоды ниже, пользователю их лучше не использовать.
|
||||
#include "private_keycodes.h"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Английские символы */
|
||||
EN_GRV, /* ` */
|
||||
EN_TILD, /* ~ */
|
||||
EN_1, /* 1 */
|
||||
EN_EXCL, /* ! */
|
||||
EN_2, /* 2 */
|
||||
EN_AT, /* @ */
|
||||
EN_3, /* 3 */
|
||||
EN_HASH, /* # */
|
||||
EN_4, /* 4 */
|
||||
EN_DLR, /* $ */
|
||||
EN_5, /* 5 */
|
||||
EN_PERC, /* % */
|
||||
EN_6, /* 6 */
|
||||
EN_CIRC, /* ^ */
|
||||
EN_7, /* 7 */
|
||||
EN_AMPR, /* & */
|
||||
EN_8, /* 8 */
|
||||
EN_ASTR, /* * */
|
||||
EN_9, /* 9 */
|
||||
EN_LPRN, /* ( */
|
||||
EN_0, /* 0 */
|
||||
EN_RPRN, /* ) */
|
||||
EN_MINS, /* - */
|
||||
EN_UNDS, /* _ */
|
||||
EN_EQL, /* = */
|
||||
EN_PLUS, /* + */
|
||||
|
||||
EN_Q, /* q */
|
||||
EN_S_Q, /* Q */
|
||||
EN_W, /* w */
|
||||
EN_S_W, /* W */
|
||||
EN_E, /* e */
|
||||
EN_S_E, /* E */
|
||||
EN_R, /* r */
|
||||
EN_S_R, /* R */
|
||||
EN_T, /* t */
|
||||
EN_S_T, /* T */
|
||||
EN_Y, /* y */
|
||||
EN_S_Y, /* Y */
|
||||
EN_U, /* u */
|
||||
EN_S_U, /* U */
|
||||
EN_I, /* i */
|
||||
EN_S_I, /* I */
|
||||
EN_O, /* o */
|
||||
EN_S_O, /* O */
|
||||
EN_P, /* p */
|
||||
EN_S_P, /* P */
|
||||
EN_LBRC, /* [ */
|
||||
EN_LCBR, /* { */
|
||||
EN_RBRC, /* ] */
|
||||
EN_RCBR, /* } */
|
||||
|
||||
EN_A, /* a */
|
||||
EN_S_A, /* A */
|
||||
EN_S, /* s */
|
||||
EN_S_S, /* S */
|
||||
EN_D, /* d */
|
||||
EN_S_D, /* D */
|
||||
EN_F, /* f */
|
||||
EN_S_F, /* F */
|
||||
EN_G, /* g */
|
||||
EN_S_G, /* G */
|
||||
EN_H, /* h */
|
||||
EN_S_H, /* H */
|
||||
EN_J, /* j */
|
||||
EN_S_J, /* J */
|
||||
EN_K, /* k */
|
||||
EN_S_K, /* K */
|
||||
EN_L, /* l */
|
||||
EN_S_L, /* L */
|
||||
EN_SCLN, /* ; */
|
||||
EN_COLN, /* : */
|
||||
EN_QUOT, /* ' */
|
||||
EN_DQUO, /* " */
|
||||
EN_BSLS, /* \ */
|
||||
EN_PIPE, /* | */
|
||||
|
||||
EN_Z, /* z */
|
||||
EN_S_Z, /* Z */
|
||||
EN_X, /* x */
|
||||
EN_S_X, /* X */
|
||||
EN_C, /* c */
|
||||
EN_S_C, /* C */
|
||||
EN_V, /* v */
|
||||
EN_S_V, /* V */
|
||||
EN_B, /* b */
|
||||
EN_S_B, /* B */
|
||||
EN_N, /* n */
|
||||
EN_S_N, /* N */
|
||||
EN_M, /* m */
|
||||
EN_S_M, /* M */
|
||||
EN_COMM, /* , */
|
||||
EN_LT, /* < */
|
||||
EN_DOT, /* . */
|
||||
EN_GT, /* > */
|
||||
EN_SLSH, /* / */
|
||||
EN_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Русские символы */
|
||||
RU_JO, /* ё */
|
||||
RU_S_JO, /* Ё */
|
||||
RU_1, /* 1 */
|
||||
RU_EXCL, /* ! */
|
||||
RU_2, /* 2 */
|
||||
RU_DQUO, /* " */
|
||||
RU_3, /* 3 */
|
||||
RU_NUME, /* № */
|
||||
RU_4, /* 4 */
|
||||
RU_SCLN, /* ; */
|
||||
RU_5, /* 5 */
|
||||
RU_PERC, /* % */
|
||||
RU_6, /* 6 */
|
||||
RU_COLN, /* : */
|
||||
RU_7, /* 7 */
|
||||
RU_QUES, /* ? */
|
||||
RU_8, /* 8 */
|
||||
RU_ASTR, /* * */
|
||||
RU_9, /* 9 */
|
||||
RU_LPRN, /* ( */
|
||||
RU_0, /* 0 */
|
||||
RU_RPRN, /* ) */
|
||||
RU_MINS, /* - */
|
||||
RU_UNDS, /* _ */
|
||||
RU_EQL, /* = */
|
||||
RU_PLUS, /* + */
|
||||
|
||||
RU_J, /* й */
|
||||
RU_S_J, /* Й */
|
||||
RU_TS, /* ц */
|
||||
RU_S_TS, /* Ц */
|
||||
RU_U, /* у */
|
||||
RU_S_U, /* У */
|
||||
RU_K, /* к */
|
||||
RU_S_K, /* К */
|
||||
RU_JE, /* е */
|
||||
RU_S_JE, /* Е */
|
||||
RU_N, /* н */
|
||||
RU_S_N, /* Н */
|
||||
RU_G, /* г */
|
||||
RU_S_G, /* Г */
|
||||
RU_SH, /* ш */
|
||||
RU_S_SH, /* Ш */
|
||||
RU_SC, /* щ */
|
||||
RU_S_SC, /* Щ */
|
||||
RU_Z, /* з */
|
||||
RU_S_Z, /* З */
|
||||
RU_H, /* х */
|
||||
RU_S_H, /* Х */
|
||||
RU_HD, /* ъ */
|
||||
RU_S_HD, /* Ъ */
|
||||
|
||||
RU_F, /* ф */
|
||||
RU_S_F, /* Ф */
|
||||
RU_Y, /* ы */
|
||||
RU_S_Y, /* Ы */
|
||||
RU_V, /* в */
|
||||
RU_S_V, /* В */
|
||||
RU_A, /* а */
|
||||
RU_S_A, /* А */
|
||||
RU_P, /* п */
|
||||
RU_S_P, /* п */
|
||||
RU_R, /* р */
|
||||
RU_S_R, /* Р */
|
||||
RU_O, /* о */
|
||||
RU_S_O, /* О */
|
||||
RU_L, /* л */
|
||||
RU_S_L, /* Л */
|
||||
RU_D, /* д */
|
||||
RU_S_D, /* Д */
|
||||
RU_ZH, /* ж */
|
||||
RU_S_ZH, /* Ж */
|
||||
RU_E, /* э */
|
||||
RU_S_E, /* Э */
|
||||
RU_BSLS, /* \ */
|
||||
RU_SLSH, /* / */
|
||||
|
||||
RU_JA, /* я */
|
||||
RU_S_JA, /* Я */
|
||||
RU_CH, /* ч */
|
||||
RU_S_CH, /* Ч */
|
||||
RU_S, /* с */
|
||||
RU_S_S, /* С */
|
||||
RU_M, /* м */
|
||||
RU_S_M, /* М */
|
||||
RU_I, /* и */
|
||||
RU_S_I, /* И */
|
||||
RU_T, /* т */
|
||||
RU_S_T, /* Т */
|
||||
RU_SF, /* ь */
|
||||
RU_S_SF, /* Ь */
|
||||
RU_B, /* б */
|
||||
RU_S_B, /* Б */
|
||||
RU_JU, /* ю */
|
||||
RU_S_JU, /* Ю */
|
||||
RU_DOT, /* . */
|
||||
RU_COMM, /* , */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Символы, нажимаемые независимо от текущего языка. Language-agnostic-keycodes. */
|
||||
AG_1, /* 1 */
|
||||
AG_2, /* 2 */
|
||||
AG_3, /* 3 */
|
||||
AG_4, /* 4 */
|
||||
AG_5, /* 5 */
|
||||
AG_6, /* 6 */
|
||||
AG_7, /* 7 */
|
||||
AG_8, /* 8 */
|
||||
AG_9, /* 9 */
|
||||
AG_0, /* 0 */
|
||||
AG_EXCL, /* ! */
|
||||
AG_PERC, /* % */
|
||||
AG_ASTR, /* * */
|
||||
AG_LPRN, /* ( */
|
||||
AG_RPRN, /* ) */
|
||||
AG_MINS, /* - */
|
||||
AG_UNDS, /* _ */
|
||||
AG_EQL, /* = */
|
||||
AG_PLUS, /* + */
|
||||
AG_SCLN, /* ; */
|
||||
AG_COLN, /* : */
|
||||
AG_DQUO, /* " */
|
||||
AG_BSLS, /* \ */
|
||||
AG_COMM, /* , */
|
||||
AG_DOT, /* . */
|
||||
AG_SLSH, /* / */
|
||||
AG_QUES, /* ? */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кастомные language-agnostic-кейкоды */
|
||||
AG_3DOT, /* ... */
|
||||
AG_SDOT, /* Space + Dot + Shift to next key */
|
||||
AG_CMSP, /* Comma + Space */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Шифты для набора текста. */
|
||||
SFT_N, /* Работает как обычный шифт, при её зажатии, шифт зажат. Параллельно переключает на (шифтовый) следующий слой относительно текущего языка (если язык 0, то включает слой 1, если язык 1, то включает слой 3). */
|
||||
SFT_N_O, /* Данная клавиша применит шифт и переключение на шифтовый слой только к следующему символу. Неважно, была ли она нажата одновременно со следующей клавишей, или до неё, или вместе с двумя клавишами. Применится только к одной клавише. То есть это как залипающий шифт, если нажимать отдельно от всех клавиш, и как одиночный шифт, если эту клавишу зажимать. Такая клавиша может пригодиться если вы печатаете с большой скоростью и вам сложно выдерживать время удержания шифта, и у вас получается что-то вроде "ПРивет". */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Модификаторы, переключащие текущий слой на 0. Такое нужно чтобы при включённом русском языке были такие же хоткеи с модификаторами, как и на английском языке. */
|
||||
CTRL_0, /* Ctrl on 0 layer */
|
||||
ALT_0, /* Alt on 0 layer */
|
||||
WIN_0, /* Win on 0 layer */
|
||||
SHAL_0, /* Shift+Alt on 0 layer */
|
||||
CTAL_0, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_0, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_0, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* А данные модификаторы помимо включения 0 слоя ещё и переключают язык на английский. Такое разделение нужно, потому что у некоторых смена языка идёт на комбинации с Ctrl, или Shift, и у них может сниматься выделение текста, например. */
|
||||
CTRL_EN, /* Ctrl on 0 layer */
|
||||
ALT_EN, /* Alt on 0 layer */
|
||||
WIN_EN, /* Win on 0 layer */
|
||||
SHAL_EN, /* Shift+Alt on 0 layer */
|
||||
CTAL_EN, /* Ctrl+Alt on 0 layer */
|
||||
CTSH_EN, /* Ctrl+Shift on 0 layer */
|
||||
MCAS_EN, /* Ctrl+Alt+Shift on 0 layer */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кнопки, отвечающие за переключение языка. */
|
||||
LA_CHNG, /* Переключает язык и переключает на 2 или 0 слой в зависимости от текущего языка. */
|
||||
LA_SYNC, /* Кнопка для синхронизации языков. Её нужно нажимать в случае если язык в системе и язык в клавиатуре различаются. Данная клавиша изменит язык в системе. */
|
||||
LA_CAPS, /* Задаёт переключение языка на Caps. */
|
||||
LA_ALSH, /* Задаёт переключение языка на Alt + Shift. */
|
||||
LA_SHAL, /* Задаёт переключение языка на Shift + Alt. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_CTSH, /* Задаёт переключение языка на Ctrl + Shift. */
|
||||
LA_SHCT, /* Задаёт переключение языка на Shift + Ctrl. На Win10 это позволяет избежать появления окна переключения языков. */
|
||||
LA_WISP, /* Задаёт переключение языка на Win + Shift. */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Кейкоды от Buliway. */
|
||||
ONCE_SHIFT, /* Зажимает шифт до тех пор, пока не будет нажата любая другая клавиша. Не работает с кастом кейкодами, только стандартные */
|
||||
SMART_DOT, /* Отправить агностик точку из lang_shift, нажать пробел, активировать одиночный шифт ONCE_SHIFT */
|
||||
COMMA_SPACE, /* Отправить агностик запятую из lang_shift, нажать пробел */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* SAFE_RANGE данной библиотеки. */
|
||||
LANG_SHIFT_NEW_SAFE_RANGE,
|
||||
#undef CUSTOM_SAFE_RANGE
|
||||
#define CUSTOM_SAFE_RANGE LANG_SHIFT_NEW_SAFE_RANGE
|
||||
};
|
||||
|
||||
typedef uint16_t Key;
|
||||
#define NONE_KEY (uint16_t)(65535)
|
||||
|
||||
typedef uint8_t Lang;
|
||||
#define NONE_LANG (uint8_t)(255)
|
||||
|
||||
typedef uint8_t Shift;
|
||||
#define NONE_SHIFT (uint8_t)(255)
|
||||
|
||||
// Способ смены языка
|
||||
enum LangChange {
|
||||
LANG_CHANGE_CAPS,
|
||||
LANG_CHANGE_ALT_SHIFT,
|
||||
LANG_CHANGE_SHIFT_ALT,
|
||||
LANG_CHANGE_CTRL_SHIFT,
|
||||
LANG_CHANGE_SHIFT_CTRL,
|
||||
LANG_CHANGE_WIN_SPACE
|
||||
};
|
||||
|
||||
// Переменная, в которой можно менять текущий способ смены языка
|
||||
enum LangChange lang_current_change =
|
||||
#ifdef LANG_CHANGE_DEFAULT
|
||||
LANG_CHANGE_DEFAULT;
|
||||
#else
|
||||
#error "You must specify default language change method by defining variable LANG_CHANGE_DEFAULT."
|
||||
#endif
|
||||
|
||||
void shift_activate(Shift shift);
|
||||
void shift_activate_from_user(Shift shift);
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer);
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void);
|
||||
void lang_synchronize(void);
|
||||
void lang_activate(Lang lang);
|
||||
void lang_activate_from_user(Lang lang);
|
||||
|
||||
void lang_shift_press_key(Key key, bool down);
|
||||
void lang_shift_tap_key(Key key);
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record);
|
||||
void lang_shift_user_timer(void);
|
||||
|
||||
// Инклюжу код напрямую, потому что нельзя сделать линковку, ведь код внутри использует кейкоды отсюда, и обязательно нужно это делать через safe_range
|
||||
#include "src.c"
|
||||
97
corne/v4.1vial/lang_shift/private_keycodes.h
Normal file
97
corne/v4.1vial/lang_shift/private_keycodes.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
KS_GRV, /* ` */
|
||||
KS_TILD, /* ~ */
|
||||
KS_1, /* 1 */
|
||||
KS_EXCL, /* ! */
|
||||
KS_2, /* 2 */
|
||||
KS_AT, /* @ */
|
||||
KS_3, /* 3 */
|
||||
KS_HASH, /* # */
|
||||
KS_4, /* 4 */
|
||||
KS_DLR, /* $ */
|
||||
KS_5, /* 5 */
|
||||
KS_PERC, /* % */
|
||||
KS_6, /* 6 */
|
||||
KS_CIRC, /* ^ */
|
||||
KS_7, /* 7 */
|
||||
KS_AMPR, /* & */
|
||||
KS_8, /* 8 */
|
||||
KS_ASTR, /* * */
|
||||
KS_9, /* 9 */
|
||||
KS_LPRN, /* ( */
|
||||
KS_0, /* 0 */
|
||||
KS_RPRN, /* ) */
|
||||
KS_MINS, /* - */
|
||||
KS_UNDS, /* _ */
|
||||
KS_EQL, /* = */
|
||||
KS_PLUS, /* + */
|
||||
|
||||
KS_Q, /* q */
|
||||
KS_S_Q, /* Q */
|
||||
KS_W, /* w */
|
||||
KS_S_W, /* W */
|
||||
KS_E, /* e */
|
||||
KS_S_E, /* E */
|
||||
KS_R, /* r */
|
||||
KS_S_R, /* R */
|
||||
KS_T, /* t */
|
||||
KS_S_T, /* T */
|
||||
KS_Y, /* y */
|
||||
KS_S_Y, /* Y */
|
||||
KS_U, /* u */
|
||||
KS_S_U, /* U */
|
||||
KS_I, /* i */
|
||||
KS_S_I, /* I */
|
||||
KS_O, /* o */
|
||||
KS_S_O, /* O */
|
||||
KS_P, /* p */
|
||||
KS_S_P, /* P */
|
||||
KS_LBRC, /* [ */
|
||||
KS_LCBR, /* { */
|
||||
KS_RBRC, /* ] */
|
||||
KS_RCBR, /* } */
|
||||
|
||||
KS_A, /* a */
|
||||
KS_S_A, /* A */
|
||||
KS_S, /* s */
|
||||
KS_S_S, /* S */
|
||||
KS_D, /* d */
|
||||
KS_S_D, /* D */
|
||||
KS_F, /* f */
|
||||
KS_S_F, /* F */
|
||||
KS_G, /* g */
|
||||
KS_S_G, /* G */
|
||||
KS_H, /* h */
|
||||
KS_S_H, /* H */
|
||||
KS_J, /* j */
|
||||
KS_S_J, /* J */
|
||||
KS_K, /* k */
|
||||
KS_S_K, /* K */
|
||||
KS_L, /* l */
|
||||
KS_S_L, /* L */
|
||||
KS_SCLN, /* ; */
|
||||
KS_COLN, /* : */
|
||||
KS_QUOT, /* ' */
|
||||
KS_DQUO, /* " */
|
||||
KS_BSLS, /* \ */
|
||||
KS_PIPE, /* | */
|
||||
|
||||
KS_Z, /* z */
|
||||
KS_S_Z, /* Z */
|
||||
KS_X, /* x */
|
||||
KS_S_X, /* X */
|
||||
KS_C, /* c */
|
||||
KS_S_C, /* C */
|
||||
KS_V, /* v */
|
||||
KS_S_V, /* V */
|
||||
KS_B, /* b */
|
||||
KS_S_B, /* B */
|
||||
KS_N, /* n */
|
||||
KS_S_N, /* N */
|
||||
KS_M, /* m */
|
||||
KS_S_M, /* M */
|
||||
KS_COMM, /* , */
|
||||
KS_LT, /* < */
|
||||
KS_DOT, /* . */
|
||||
KS_GT, /* > */
|
||||
KS_SLSH, /* / */
|
||||
KS_QUES, /* ? */
|
||||
665
corne/v4.1vial/lang_shift/src.c
Normal file
665
corne/v4.1vial/lang_shift/src.c
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
// ---------------------------------------------------------------------------
|
||||
// Работа с шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Shift shift_should_be = 0;
|
||||
Shift shift_current = 0;
|
||||
uint32_t shift_timer = 0;
|
||||
uint8_t shift_pressed_count = 0;
|
||||
|
||||
Key shift_get_key(Key key) {
|
||||
switch (key) {
|
||||
case KS_GRV: return KC_GRV;
|
||||
case KS_TILD: return KC_GRV;
|
||||
case KS_1: return KC_1;
|
||||
case KS_EXCL: return KC_1;
|
||||
case KS_2: return KC_2;
|
||||
case KS_AT: return KC_2;
|
||||
case KS_3: return KC_3;
|
||||
case KS_HASH: return KC_3;
|
||||
case KS_4: return KC_4;
|
||||
case KS_DLR: return KC_4;
|
||||
case KS_5: return KC_5;
|
||||
case KS_PERC: return KC_5;
|
||||
case KS_6: return KC_6;
|
||||
case KS_CIRC: return KC_6;
|
||||
case KS_7: return KC_7;
|
||||
case KS_AMPR: return KC_7;
|
||||
case KS_8: return KC_8;
|
||||
case KS_ASTR: return KC_8;
|
||||
case KS_9: return KC_9;
|
||||
case KS_LPRN: return KC_9;
|
||||
case KS_0: return KC_0;
|
||||
case KS_RPRN: return KC_0;
|
||||
case KS_MINS: return KC_MINS;
|
||||
case KS_UNDS: return KC_MINS;
|
||||
case KS_EQL: return KC_EQL;
|
||||
case KS_PLUS: return KC_EQL;
|
||||
case KS_Q: return KC_Q;
|
||||
case KS_S_Q: return KC_Q;
|
||||
case KS_W: return KC_W;
|
||||
case KS_S_W: return KC_W;
|
||||
case KS_E: return KC_E;
|
||||
case KS_S_E: return KC_E;
|
||||
case KS_R: return KC_R;
|
||||
case KS_S_R: return KC_R;
|
||||
case KS_T: return KC_T;
|
||||
case KS_S_T: return KC_T;
|
||||
case KS_Y: return KC_Y;
|
||||
case KS_S_Y: return KC_Y;
|
||||
case KS_U: return KC_U;
|
||||
case KS_S_U: return KC_U;
|
||||
case KS_I: return KC_I;
|
||||
case KS_S_I: return KC_I;
|
||||
case KS_O: return KC_O;
|
||||
case KS_S_O: return KC_O;
|
||||
case KS_P: return KC_P;
|
||||
case KS_S_P: return KC_P;
|
||||
case KS_LBRC: return KC_LBRC;
|
||||
case KS_LCBR: return KC_LBRC;
|
||||
case KS_RBRC: return KC_RBRC;
|
||||
case KS_RCBR: return KC_RBRC;
|
||||
case KS_A: return KC_A;
|
||||
case KS_S_A: return KC_A;
|
||||
case KS_S: return KC_S;
|
||||
case KS_S_S: return KC_S;
|
||||
case KS_D: return KC_D;
|
||||
case KS_S_D: return KC_D;
|
||||
case KS_F: return KC_F;
|
||||
case KS_S_F: return KC_F;
|
||||
case KS_G: return KC_G;
|
||||
case KS_S_G: return KC_G;
|
||||
case KS_H: return KC_H;
|
||||
case KS_S_H: return KC_H;
|
||||
case KS_J: return KC_J;
|
||||
case KS_S_J: return KC_J;
|
||||
case KS_K: return KC_K;
|
||||
case KS_S_K: return KC_K;
|
||||
case KS_L: return KC_L;
|
||||
case KS_S_L: return KC_L;
|
||||
case KS_SCLN: return KC_SCLN;
|
||||
case KS_COLN: return KC_SCLN;
|
||||
case KS_QUOT: return KC_QUOT;
|
||||
case KS_DQUO: return KC_QUOT;
|
||||
case KS_BSLS: return KC_BSLS;
|
||||
case KS_PIPE: return KC_BSLS;
|
||||
case KS_Z: return KC_Z;
|
||||
case KS_S_Z: return KC_Z;
|
||||
case KS_X: return KC_X;
|
||||
case KS_S_X: return KC_X;
|
||||
case KS_C: return KC_C;
|
||||
case KS_S_C: return KC_C;
|
||||
case KS_V: return KC_V;
|
||||
case KS_S_V: return KC_V;
|
||||
case KS_B: return KC_B;
|
||||
case KS_S_B: return KC_B;
|
||||
case KS_N: return KC_N;
|
||||
case KS_S_N: return KC_N;
|
||||
case KS_M: return KC_M;
|
||||
case KS_S_M: return KC_M;
|
||||
case KS_COMM: return KC_COMM;
|
||||
case KS_LT: return KC_COMM;
|
||||
case KS_DOT: return KC_DOT;
|
||||
case KS_GT: return KC_DOT;
|
||||
case KS_SLSH: return KC_SLSH;
|
||||
case KS_QUES: return KC_SLSH;
|
||||
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Shift shift_get_shift(Key key) {
|
||||
if (KS_GRV <= key && key <= KS_QUES) {
|
||||
return (key - KS_GRV) % 2;
|
||||
} else {
|
||||
return NONE_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_activate(Shift shift) {
|
||||
if (shift_current != shift) {
|
||||
shift_timer = timer_read();
|
||||
if (shift) {
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
}
|
||||
shift_current = shift;
|
||||
}
|
||||
|
||||
void shift_activate_from_user(Shift shift) {
|
||||
shift_should_be = shift;
|
||||
shift_activate(shift);
|
||||
}
|
||||
|
||||
Key shift_process(Key key, bool down) {
|
||||
Shift new_shift = shift_get_shift(key);
|
||||
if (down) {
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
shift_activate(new_shift);
|
||||
} else {
|
||||
shift_activate(shift_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_shift != NONE_SHIFT) {
|
||||
if (down) {
|
||||
shift_pressed_count++;
|
||||
} else {
|
||||
shift_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return shift_get_key(key);
|
||||
}
|
||||
|
||||
void shift_user_timer(void) {
|
||||
// Нужно выключать шифт после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (shift_pressed_count == 0 && shift_current != shift_should_be && timer_read() - shift_timer >= 100) {
|
||||
shift_activate(shift_should_be);
|
||||
shift_timer = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с одиночным шифтом
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t shift_once_disable_stage = 2;
|
||||
uint8_t shift_once_layer_off = 0;
|
||||
uint8_t shift_once_layer_current = 0;
|
||||
uint32_t shift_once_enabled_time = 0;
|
||||
bool shift_once_can_disable = true;
|
||||
|
||||
bool shift_once_is_enabled(void) {
|
||||
return shift_once_disable_stage == 2;
|
||||
}
|
||||
|
||||
void shift_once_use_to_next_key(uint8_t layer) {
|
||||
if (shift_current == 0) {
|
||||
shift_activate_from_user(true);
|
||||
layer_on(layer);
|
||||
shift_once_disable_stage = 2;
|
||||
shift_once_layer_off = layer;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process_key(uint8_t layer, bool down) {
|
||||
if (down) {
|
||||
shift_once_use_to_next_key(layer);
|
||||
shift_once_can_disable = false;
|
||||
} else {
|
||||
shift_once_can_disable = true;
|
||||
shift_once_enabled_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_disable(void) {
|
||||
if (shift_once_disable_stage == 2) {
|
||||
layer_off(shift_once_layer_off);
|
||||
shift_activate_from_user(false);
|
||||
shift_once_disable_stage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_process(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
if (shift_once_disable_stage == 1) {
|
||||
shift_once_disable_stage = 0;
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
if (down && key != SFT_N_O && shift_once_disable_stage == 2) {
|
||||
shift_once_disable_stage = 1;
|
||||
layer_off(shift_once_layer_off);
|
||||
}
|
||||
}
|
||||
|
||||
void shift_once_user_timer(void) {
|
||||
if (shift_once_can_disable && shift_once_is_enabled() && timer_read() - shift_once_enabled_time >= 1000) {
|
||||
shift_once_disable();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Работа с языком
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Lang lang_should_be = 0;
|
||||
Lang lang_current = 0;
|
||||
uint32_t lang_timer = 0;
|
||||
uint8_t lang_pressed_count = 0;
|
||||
|
||||
Key lang_get_key(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return (key - EN_GRV) + KS_GRV;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return (key - RU_JO) + KS_GRV;
|
||||
} else {
|
||||
return NONE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
Lang lang_get_lang(Key key) {
|
||||
if (EN_GRV <= key && key <= EN_QUES) {
|
||||
return 0;
|
||||
} else if (RU_JO <= key && key <= RU_COMM) {
|
||||
return 1;
|
||||
} else {
|
||||
return NONE_LANG;
|
||||
}
|
||||
}
|
||||
|
||||
Key lang_calc_agnostic(Key key) {
|
||||
if (lang_current == 0) {
|
||||
switch (key) {
|
||||
case AG_1: return EN_1;
|
||||
case AG_2: return EN_2;
|
||||
case AG_3: return EN_3;
|
||||
case AG_4: return EN_4;
|
||||
case AG_5: return EN_5;
|
||||
case AG_6: return EN_6;
|
||||
case AG_7: return EN_7;
|
||||
case AG_8: return EN_8;
|
||||
case AG_9: return EN_9;
|
||||
case AG_0: return EN_0;
|
||||
case AG_EXCL: return EN_EXCL;
|
||||
case AG_PERC: return EN_PERC;
|
||||
case AG_ASTR: return EN_ASTR;
|
||||
case AG_LPRN: return EN_LPRN;
|
||||
case AG_RPRN: return EN_RPRN;
|
||||
case AG_MINS: return EN_MINS;
|
||||
case AG_UNDS: return EN_UNDS;
|
||||
case AG_EQL: return EN_EQL;
|
||||
case AG_PLUS: return EN_PLUS;
|
||||
case AG_SCLN: return EN_SCLN;
|
||||
case AG_COLN: return EN_COLN;
|
||||
case AG_DQUO: return EN_DQUO;
|
||||
case AG_BSLS: return EN_BSLS;
|
||||
case AG_COMM: return EN_COMM;
|
||||
case AG_DOT: return EN_DOT;
|
||||
case AG_SLSH: return EN_SLSH;
|
||||
case AG_QUES: return EN_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
} else {
|
||||
switch (key) {
|
||||
case AG_1: return RU_1;
|
||||
case AG_2: return RU_2;
|
||||
case AG_3: return RU_3;
|
||||
case AG_4: return RU_4;
|
||||
case AG_5: return RU_5;
|
||||
case AG_6: return RU_6;
|
||||
case AG_7: return RU_7;
|
||||
case AG_8: return RU_8;
|
||||
case AG_9: return RU_9;
|
||||
case AG_0: return RU_0;
|
||||
case AG_EXCL: return RU_EXCL;
|
||||
case AG_PERC: return RU_PERC;
|
||||
case AG_ASTR: return RU_ASTR;
|
||||
case AG_LPRN: return RU_LPRN;
|
||||
case AG_RPRN: return RU_RPRN;
|
||||
case AG_MINS: return RU_MINS;
|
||||
case AG_UNDS: return RU_UNDS;
|
||||
case AG_EQL: return RU_EQL;
|
||||
case AG_PLUS: return RU_PLUS;
|
||||
case AG_SCLN: return RU_SCLN;
|
||||
case AG_COLN: return RU_COLN;
|
||||
case AG_DQUO: return RU_DQUO;
|
||||
case AG_BSLS: return RU_BSLS;
|
||||
case AG_COMM: return RU_COMM;
|
||||
case AG_DOT: return RU_DOT;
|
||||
case AG_SLSH: return RU_SLSH;
|
||||
case AG_QUES: return RU_QUES;
|
||||
default: return NONE_KEY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lang_get_shift_layer_number(void) {
|
||||
return lang_should_be * 2 + 1;
|
||||
}
|
||||
|
||||
void lang_synchronize(void) {
|
||||
lang_timer = timer_read();
|
||||
switch (lang_current_change) {
|
||||
case LANG_CHANGE_CAPS: {
|
||||
// Костыль, потому что при нажатии Shift+Caps включается режим Caps, а не переключение языка :facepalm:
|
||||
if (shift_current == 1) {
|
||||
unregister_code(KC_LSFT);
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
register_code(KC_CAPS);
|
||||
unregister_code(KC_CAPS);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_ALT_SHIFT: {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LALT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_ALT: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LALT);
|
||||
unregister_code(KC_LALT);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_CTRL_SHIFT: {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_SHIFT_CTRL: {
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_LCTL);
|
||||
unregister_code(KC_LCTL);
|
||||
unregister_code(KC_LSFT);
|
||||
|
||||
// Костыль, потому что при зажатом шифте если хочется нажать клавишу, которая переключает язык, то шифт слетает...
|
||||
if (shift_current == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
} break;
|
||||
case LANG_CHANGE_WIN_SPACE: {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_SPACE);
|
||||
unregister_code(KC_SPACE);
|
||||
unregister_code(KC_LGUI);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void lang_activate(Lang lang) {
|
||||
// Нужно дополнять этот код, если нужно три языка и более
|
||||
if (lang_current != lang) {
|
||||
lang_synchronize();
|
||||
}
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
void lang_activate_from_user(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_activate(lang);
|
||||
}
|
||||
|
||||
void lang_activate_from_user_without_sync(Lang lang) {
|
||||
lang_should_be = lang;
|
||||
lang_current = lang;
|
||||
}
|
||||
|
||||
Key lang_process(Key key, bool down) {
|
||||
Key after_agnostic = lang_calc_agnostic(key);
|
||||
if (after_agnostic != NONE_KEY) {
|
||||
key = after_agnostic;
|
||||
}
|
||||
|
||||
Lang new_lang = lang_get_lang(key);
|
||||
if (down) {
|
||||
if (new_lang != NONE_LANG) {
|
||||
lang_activate(new_lang);
|
||||
} else {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_lang != NONE_LANG) {
|
||||
if (down) {
|
||||
lang_pressed_count++;
|
||||
} else {
|
||||
lang_pressed_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return lang_get_key(key);
|
||||
}
|
||||
|
||||
void lang_user_timer(void) {
|
||||
// Нужно выключать язык после прохождения определённого времени, потому что пользователь ожидает как будто шифт на самом деле включён
|
||||
if (lang_pressed_count == 0 && lang_current != lang_should_be && timer_read() - lang_timer >= 100) {
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Обработка клавиш
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
uint8_t lang_shift_current_shift_layer = 0;
|
||||
|
||||
void lang_shift_press_key(Key key, bool down) {
|
||||
keyrecord_t record = {
|
||||
.event = {
|
||||
.key = {
|
||||
.col = 0,
|
||||
.row = 0,
|
||||
},
|
||||
.pressed = down,
|
||||
.time = timer_read(),
|
||||
},
|
||||
};
|
||||
|
||||
lang_shift_process_record(key, &record);
|
||||
}
|
||||
|
||||
void lang_shift_tap_key(Key key) {
|
||||
lang_shift_press_key(key, true);
|
||||
lang_shift_press_key(key, false);
|
||||
shift_activate(shift_should_be);
|
||||
lang_activate(lang_should_be);
|
||||
}
|
||||
|
||||
bool lang_shift_process_custom_keycodes(Key key, keyrecord_t* record) {
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Обрабатываем клавиши, связанные с кастомным шифтом и кастомным переключением языка
|
||||
switch (key) {
|
||||
case SFT_N_O:
|
||||
shift_once_process_key(lang_get_shift_layer_number(), down);
|
||||
return false;
|
||||
case SFT_N:
|
||||
if (down) {
|
||||
shift_activate_from_user(true);
|
||||
lang_shift_current_shift_layer = lang_get_shift_layer_number();
|
||||
layer_on(lang_shift_current_shift_layer);
|
||||
} else {
|
||||
shift_should_be = false;
|
||||
if (shift_pressed_count == 0) {
|
||||
shift_activate_from_user(false);
|
||||
}
|
||||
layer_off(lang_shift_current_shift_layer);
|
||||
}
|
||||
return false;
|
||||
case LA_CHNG:
|
||||
if (down) {
|
||||
if (lang_should_be == 0) {
|
||||
lang_activate_from_user(1);
|
||||
layer_on(2);
|
||||
} else {
|
||||
lang_activate_from_user(0);
|
||||
layer_off(2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case LA_SYNC:
|
||||
if (down) {
|
||||
lang_synchronize();
|
||||
}
|
||||
return false;
|
||||
case LA_CAPS:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CAPS;
|
||||
}
|
||||
return false;
|
||||
case LA_ALSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_ALT_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHAL:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_ALT;
|
||||
}
|
||||
return false;
|
||||
case LA_CTSH:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_CTRL_SHIFT;
|
||||
}
|
||||
return false;
|
||||
case LA_SHCT:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_SHIFT_CTRL;
|
||||
}
|
||||
return false;
|
||||
case LA_WISP:
|
||||
if (down) {
|
||||
lang_current_change = LANG_CHANGE_WIN_SPACE;
|
||||
}
|
||||
return false;
|
||||
case AG_3DOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_CMSP:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_COMM);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AG_SDOT:
|
||||
if (record->event.pressed) {
|
||||
lang_shift_tap_key(AG_DOT);
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
shift_once_use_to_next_key(lang_get_shift_layer_number());
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_english_modifiers(Key key, keyrecord_t* record) {
|
||||
static Lang lang_stack[3] = {};
|
||||
static uint8_t modifiers_count = 0;
|
||||
#define PROCESS(NAME, REGISTER, UNREGISTER, ACTIVATE_LANG) \
|
||||
case NAME: { \
|
||||
if (record->event.pressed) { \
|
||||
lang_stack[modifiers_count] = lang_should_be; \
|
||||
modifiers_count += 1; \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_off(2); \
|
||||
} \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(0); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(0); \
|
||||
} \
|
||||
REGISTER; \
|
||||
} else { \
|
||||
UNREGISTER; \
|
||||
modifiers_count -= 1; \
|
||||
if (ACTIVATE_LANG) { \
|
||||
lang_activate_from_user(lang_stack[modifiers_count]); \
|
||||
} else { \
|
||||
lang_activate_from_user_without_sync(lang_stack[modifiers_count]); \
|
||||
} \
|
||||
if (lang_should_be == 1) { \
|
||||
layer_on(2); \
|
||||
} \
|
||||
} \
|
||||
return false; \
|
||||
} break;
|
||||
|
||||
#define Rg(x) register_code(KC_L ## x)
|
||||
#define Un(x) unregister_code(KC_L ## x)
|
||||
|
||||
switch (key) {
|
||||
PROCESS(CTRL_0, Rg(CTL), Un(CTL), false);
|
||||
PROCESS(ALT_0, Rg(ALT), Un(ALT), false);
|
||||
PROCESS(WIN_0, Rg(GUI), Un(GUI), false);
|
||||
PROCESS(CTAL_0, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, false);
|
||||
PROCESS(SHAL_0, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, false);
|
||||
PROCESS(CTSH_0, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, false);
|
||||
PROCESS(MCAS_0, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, false);
|
||||
|
||||
PROCESS(CTRL_EN, Rg(CTL), Un(CTL), true);
|
||||
PROCESS(ALT_EN, Rg(ALT), Un(ALT), true);
|
||||
PROCESS(WIN_EN, Rg(GUI), Un(GUI), true);
|
||||
PROCESS(CTAL_EN, { Rg(CTL); Rg(ALT); }, { Un(ALT); Un(CTL); }, true);
|
||||
PROCESS(SHAL_EN, { Rg(SFT); Rg(ALT); }, { Un(ALT); Un(SFT); }, true);
|
||||
PROCESS(CTSH_EN, { Rg(CTL); Rg(SFT); }, { Un(SFT); Un(CTL); }, true);
|
||||
PROCESS(MCAS_EN, { Rg(CTL); Rg(ALT); Rg(SFT); }, { Un(SFT); Un(ALT); Un(CTL); }, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lang_shift_process_record(Key key, keyrecord_t* record) {
|
||||
// Обрабатываем Once Shift
|
||||
shift_once_process(key, record);
|
||||
|
||||
bool down = record->event.pressed;
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша какой-то язык, заданный в ней
|
||||
Key key1 = lang_process(key, down);
|
||||
Key key_to_shift = key;
|
||||
if (key1 != NONE_KEY) {
|
||||
key_to_shift = key1;
|
||||
}
|
||||
|
||||
// Разбираемся, имеет ли эта клавиша шифт, засунутый в неё
|
||||
// Это нужно отдельно от обработки языка, чтобы шифт мог выключаться для обычных клавиш
|
||||
Key key2 = shift_process(key_to_shift, down);
|
||||
if (key2 != NONE_KEY) {
|
||||
if (down) {
|
||||
register_code(key2);
|
||||
} else {
|
||||
unregister_code(key2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_custom_keycodes(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lang_shift_process_english_modifiers(key, record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void lang_shift_user_timer(void) {
|
||||
shift_user_timer();
|
||||
shift_once_user_timer();
|
||||
lang_user_timer();
|
||||
}
|
||||
24
corne/v4.1vial/rules.mk
Normal file
24
corne/v4.1vial/rules.mk
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
LTO_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
RGB_MATRIX_DRIVER = ws2812
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
||||
MUSIC_ENABLE = no
|
||||
OLED_ENABLE = no
|
||||
COMBO_ENABLE = yes
|
||||
KEY_OVERRIDE_ENABLE = yes
|
||||
QMK_SETTINGS = yes
|
||||
|
||||
CAPS_WORD_ENABLE = yes
|
||||
LAYER_LOCK_ENABLE = yes
|
||||
REPEAT_KEY_ENABLE = yes
|
||||
|
||||
VIAL_INSECURE = yes
|
||||
VIA_ENABLE = yes
|
||||
VIAL_ENABLE = yes
|
||||
|
||||
Loading…
Add table
Reference in a new issue