[
  {
    "path": ".gitattributes",
    "content": "*keynavrc* text eol=crlf\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [lesderid]\nko_fi: les\ncustom: ['https://paypal.me/les']\n"
  },
  {
    "path": ".github/workflows/cd.yml",
    "content": "name: CD\n\non:\n  push:\n    tags:\n    - 'v*'\n\njobs:\n  build:\n    runs-on: windows-latest\n    steps:\n      - name: Checkout keynavish\n        uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n      - name: Install dmd and dub\n        uses: dlang-community/setup-dlang@v1\n        with:\n          compiler: dmd-2.100.2\n      - name: Build keynavish (x86_64)\n        run: dub build -b=release -a=x86_64\n      - name: Create release\n        id: create-release\n        uses: actions/create-release@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          tag_name: ${{ github.ref }}\n          release_name: ${{ github.ref }}\n          draft: false\n          prerelease: false\n      - name: Get release version\n        id: get-release-version\n        uses: little-core-labs/get-git-tag@v3.0.1\n      - name: Upload release asset (x86_64)\n        uses: actions/upload-release-asset@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          upload_url: ${{ steps.create-release.outputs.upload_url }}\n          asset_path: ./out/keynavish.exe\n          asset_name: keynavish-${{ steps.get-release-version.outputs.tag }}-x86_64.exe\n          asset_content_type: application/octet-stream\n      - name: Build keynavish (x86)\n        run: dub build -b=release -a=x86\n      - name: Upload release asset (x86)\n        uses: actions/upload-release-asset@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          upload_url: ${{ steps.create-release.outputs.upload_url }}\n          asset_path: ./out/keynavish.exe\n          asset_name: keynavish-${{ steps.get-release-version.outputs.tag }}-x86.exe\n          asset_content_type: application/octet-stream\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: windows-latest\n\n    steps:\n        - name: Checkout keynavish\n          uses: actions/checkout@v2\n          with:\n            fetch-depth: 0\n        - name: Install dmd and dub\n          uses: dlang-community/setup-dlang@v1\n          with:\n            compiler: dmd-latest\n        - name: Build keynavish (x86_64)\n          run: dub build -a=x86_64\n        - name: Rename artifact\n          run: Rename-Item -Path out/keynavish.exe -NewName \"keynavish-${{ github.sha }}-x86_64.exe\"\n        - name: Upload keynavish (x86_64)\n          uses: actions/upload-artifact@v4\n          with:\n            name: keynavish-${{ github.sha }}-x86_64\n            path: out/keynavish-${{ github.sha }}-x86_64.exe\n"
  },
  {
    "path": ".gitignore",
    "content": "/Win32/\n/x64/\n/out/\n/.vs/\n/enc_temp_folder/\n/.dub/\n/src/keynavish/versioninfo.*\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "README.md",
    "content": "# keynavish\n\n[![Latest release](https://img.shields.io/github/v/release/lesderid/keynavish?sort=semver)](https://github.com/lesderid/keynavish/releases/latest)\n[![CI build status](https://img.shields.io/github/actions/workflow/status/lesderid/keynavish/ci.yml)](https://github.com/lesderid/keynavish/actions?query=workflow%3ACI)\n[![Compatibility issues](https://img.shields.io/github/issues/lesderid/keynavish/compatibility)](https://github.com/lesderid/keynavish/labels/compatibility)\n\nControl the mouse with the keyboard, on Windows.\n\nThis is a rewrite of [keynav](https://github.com/jordansissel/keynav)\nfor Windows. It is fully compatible with the original (modulo\n[bugs](https://github.com/lesderid/keynavish/labels/compatibility)),\nso you can use the same configuration files for both programs.\n\nkeynavish works on Windows XP and later, but only versions of Windows\nthat still receive support from Microsoft (currently 8.1 and 10) are\nofficially supported.\n\n## Demo\n\n[![Demo](https://lesderid.net/keynavish-demo.gif)](https://lesderid.net/keynavish-demo.webm)\n\n(click for full quality video)\n\n## Installing\n\nYou can 'install' keynavish by downloading the [latest\nrelease](https://github.com/lesderid/keynavish/releases/latest)\nexecutable, running it, and selecting `Launch keynavish on startup` from\nthe notification icon context menu.\n\n## Configuration\n\nConfiguration format: [keynav\ndocumentation](https://github.com/jordansissel/keynav/blob/master/keynav.pod)\n\nOn startup, keynavish loads a set of\n[default keybindings](https://github.com/lesderid/keynavish/blob/9cce3b7c8ae03791f8ef3aedcc3015bde2f8a054/src/keynavish/keyboardinput.d#L11-L51)\n, and then tries\nto load the following configuration files:\n\n* `<executable path>/keynavrc` (for portability)\n* `~/.keynavrc`\n* `~/keynavrc`\n* `~/.config/keynav/keynavrc`\n\nTildes (`~`) in paths are expanded to the value of `%HOME%` if it's set,\nwith fallback to `%USERPROFILE%` (usually `C:\\Users\\<username>`).\n\n## Building\n\nInstall [dub](https://dub.pm/) and run `dub build`.\n\nFor development, using [VisualD](https://rainers.github.io/visuald/)\nwith the supplied solution file is recommended.\n\n## Contributing\n\nIf you'd like to contribute, thank you! Please feel free to make a pull\nrequest (or open an issue), but make sure that your contribution does\nnot break compatibility with keynav. In particular, any changes to the\nconfiguration format that are not compatible with keynav will generally\nbe rejected.\n\n## License\n\nkeynavish is licensed under the [GNU GPLv2](/LICENSE).\n\nFor commercial licensing or support, please [contact\nme](https://lesderid.net).\n"
  },
  {
    "path": "dub.sdl",
    "content": "name \"keynavish\"\ndescription \"Control the mouse with the keyboard, on Windows.\"\nauthors \"lesderid\"\ncopyright \"Copyright © 2021, Les De Ridder\"\nlicense \"GPL-2.0\"\n\npreBuildCommands \"generate-version-info.bat\"\n\nlibs \"User32\" \"Gdi32\"\nstringImportPaths \".\"\n\ntargetPath \"out\"\n\nlflags \"/SUBSYSTEM:WINDOWS\"\nsourceFiles \"src/keynavish/versioninfo.res\"\n"
  },
  {
    "path": "generate-version-info.bat",
    "content": "@ECHO OFF\n\nREM\nREM This file is a bit of a mess, suggestions for alternatives would be\nREM much appreciated.\nREM\n\nSETLOCAL ENABLEDELAYEDEXPANSION\n\nWHERE /q git\n\nIF ERRORLEVEL 1 (\n    ECHO Please install git in your PATH to generate version info.\n    EXIT /B 1\n) ELSE (\n    FOR /F \"delims=\" %%i IN ('git describe --tags') DO (\n        SET VERSION=%%i\n        FOR /F \"tokens=1,2,3,4 delims=.-\" %%a IN (\"!VERSION:v=!.0\") DO SET WINVERSION=%%a,%%b,%%c,%%d\n\n        ECHO /* This file is automatically generated on build! */ > src/keynavish/versioninfo.d\n        ECHO[ >> src/keynavish/versioninfo.d\n        ECHO module keynavish.versioninfo; >> src/keynavish/versioninfo.d\n        ECHO[ >> src/keynavish/versioninfo.d\n        ECHO enum gitVersion = \"!VERSION!\"; >> src/keynavish/versioninfo.d\n\n        ECHO 1 VERSIONINFO ^\n\n        FILEVERSION !WINVERSION! ^\n\n        PRODUCTVERSION !WINVERSION! ^\n\n        FILEOS 0x40004 ^\n\n        FILETYPE 0x1 ^\n\n        { ^\n\n        BLOCK \"StringFileInfo\" ^\n\n        { ^\n\n        \tBLOCK \"040904B0\" ^\n\n        \t{ ^\n\n        \t\tVALUE \"FileDescription\", \"keynavish – Control the mouse with the keyboard, on Windows\" ^\n\n        \t\tVALUE \"InternalName\", \"keynavish.exe\" ^\n\n        \t\tVALUE \"OriginalFilename\", \"keynavish.exe\" ^\n\n        \t\tVALUE \"CompanyName\", \"Les De Ridder\" ^\n\n        \t\tVALUE \"LegalCopyright\", \"© 2021, Les De Ridder <les@lesderid.net>\" ^\n\n        \t\tVALUE \"ProductName\", \"keynavish\" ^\n\n        \t\tVALUE \"FileVersion\", \"!VERSION:v=!\" ^\n\n        \t\tVALUE \"ProductVersion\", \"!VERSION:v=!\" ^\n\n        \t} ^\n\n        } ^\n\n         ^\n\n        BLOCK \"VarFileInfo\" ^\n\n        { ^\n\n        \tVALUE \"Translation\", 0x0409 0x04B0 ^\n\n        } ^\n\n        } > src/keynavish/versioninfo.rc\n\n        ECHO Version info written to 'src/keynavish/versioninfo.{d,rc}'.\n        .\\tools\\llvm-rc.exe /C 65001 src\\keynavish\\versioninfo.rc\n        ECHO Converted 'src/keynavish/versioninfo.rc' to 'src/keynavish/versioninfo.res'.\n    )\n)\n\nENDLOCAL\n"
  },
  {
    "path": "keynavish.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30804.86\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{002A2DE9-8BB6-484D-9802-7E4AD4084715}\") = \"keynavish\", \"keynavish.visualdproj\", \"{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Debug|x64.Build.0 = Debug|x64\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Debug|x86.ActiveCfg = Debug|Win32\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Debug|x86.Build.0 = Debug|Win32\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Release|x64.ActiveCfg = Release|x64\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Release|x64.Build.0 = Release|x64\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Release|x86.ActiveCfg = Release|Win32\n\t\t{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}.Release|x86.Build.0 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {05ACC96F-91A0-4D4B-945D-6BCFC33DB289}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "keynavish.visualdproj",
    "content": "<DProject>\n <ProjectGuid>{9C2A0942-A891-44EF-B55A-F0DBAAC311C1}</ProjectGuid>\n <Config platform=\"Win32\" name=\"Debug\">\n  <obj>0</obj>\n  <link>0</link>\n  <lib>0</lib>\n  <subsystem>2</subsystem>\n  <multiobj>0</multiobj>\n  <singleFileCompilation>0</singleFileCompilation>\n  <oneobj>0</oneobj>\n  <mscoff>1</mscoff>\n  <trace>0</trace>\n  <quiet>0</quiet>\n  <verbose>0</verbose>\n  <vtls>0</vtls>\n  <vgc>0</vgc>\n  <symdebug>1</symdebug>\n  <symdebugref>1</symdebugref>\n  <optimize>0</optimize>\n  <cpu>0</cpu>\n  <isX86_64>0</isX86_64>\n  <isLinux>0</isLinux>\n  <isOSX>0</isOSX>\n  <isWindows>0</isWindows>\n  <isFreeBSD>0</isFreeBSD>\n  <isSolaris>0</isSolaris>\n  <scheduler>0</scheduler>\n  <useDeprecated>0</useDeprecated>\n  <errDeprecated>0</errDeprecated>\n  <useAssert>0</useAssert>\n  <useInvariants>0</useInvariants>\n  <useIn>0</useIn>\n  <useOut>0</useOut>\n  <useArrayBounds>0</useArrayBounds>\n  <boundscheck>0</boundscheck>\n  <useSwitchError>0</useSwitchError>\n  <useUnitTests>0</useUnitTests>\n  <useInline>0</useInline>\n  <release>0</release>\n  <preservePaths>0</preservePaths>\n  <warnings>0</warnings>\n  <infowarnings>0</infowarnings>\n  <genStackFrame>0</genStackFrame>\n  <pic>0</pic>\n  <cov>0</cov>\n  <nofloat>0</nofloat>\n  <ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>\n  <allinst>0</allinst>\n  <stackStomp>0</stackStomp>\n  <betterC>0</betterC>\n  <dip25>0</dip25>\n  <dip1000>0</dip1000>\n  <dip1008>0</dip1008>\n  <dip1021>0</dip1021>\n  <transition_field>0</transition_field>\n  <revert_import>0</revert_import>\n  <preview_dtorfields>0</preview_dtorfields>\n  <transition_checkimports>0</transition_checkimports>\n  <transition_complex>0</transition_complex>\n  <preview_intpromote>0</preview_intpromote>\n  <preview_fixAliasThis>0</preview_fixAliasThis>\n  <preview_markdown>0</preview_markdown>\n  <preview_rvaluerefparam>0</preview_rvaluerefparam>\n  <preview_nosharedaccess>0</preview_nosharedaccess>\n  <preview_in>0</preview_in>\n  <preview_inclincontracts>0</preview_inclincontracts>\n  <transition_vmarkdown>0</transition_vmarkdown>\n  <compiler>2</compiler>\n  <otherDMD>0</otherDMD>\n  <cccmd>$(CC) -c</cccmd>\n  <ccTransOpt>1</ccTransOpt>\n  <addDepImp>0</addDepImp>\n  <program>$(DMDInstallDir)windows\\bin\\dmd.exe</program>\n  <imppath>src</imppath>\n  <fileImppath>.</fileImppath>\n  <outdir>out</outdir>\n  <objdir>$(OutDir)</objdir>\n  <objname />\n  <libname />\n  <doDocComments>0</doDocComments>\n  <docdir />\n  <docname />\n  <modules_ddoc />\n  <ddocfiles />\n  <doHdrGeneration>0</doHdrGeneration>\n  <hdrdir />\n  <hdrname />\n  <doXGeneration>1</doXGeneration>\n  <xfilename>$(IntDir)\\$(TargetName).json</xfilename>\n  <debuglevel>0</debuglevel>\n  <debugids />\n  <versionlevel>0</versionlevel>\n  <versionids />\n  <dump_source>0</dump_source>\n  <mapverbosity>0</mapverbosity>\n  <createImplib>0</createImplib>\n  <debuglib>0</debuglib>\n  <defaultlibname />\n  <debuglibname />\n  <moduleDepsFile />\n  <run>0</run>\n  <runargs />\n  <runCv2pdb>1</runCv2pdb>\n  <pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>\n  <cv2pdbNoDemangle>0</cv2pdbNoDemangle>\n  <cv2pdbEnumType>0</cv2pdbEnumType>\n  <cv2pdbOptions />\n  <enableMixin>0</enableMixin>\n  <mixinPath>$(IntDir)\\$(SafeProjectName).mixin</mixinPath>\n  <objfiles />\n  <linkswitches />\n  <libfiles />\n  <libpaths />\n  <deffile />\n  <resfile>src\\keynavish\\versioninfo.res</resfile>\n  <exefile>$(OutDir)\\$(ProjectName).exe</exefile>\n  <pdbfile>$(IntDir)\\$(SafeProjectName).pdb</pdbfile>\n  <impfile>$(IntDir)\\$(SafeProjectName).lib</impfile>\n  <mapfile>$(IntDir)\\$(SafeProjectName).map</mapfile>\n  <useStdLibPath>1</useStdLibPath>\n  <cRuntime>2</cRuntime>\n  <privatePhobos>0</privatePhobos>\n  <additionalOptions />\n  <preBuildCommand>call generate-version-info.bat</preBuildCommand>\n  <postBuildCommand />\n  <filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.tlog</filesToClean>\n </Config>\n <Config platform=\"Win32\" name=\"Release\">\n  <obj>0</obj>\n  <link>0</link>\n  <lib>0</lib>\n  <subsystem>2</subsystem>\n  <multiobj>0</multiobj>\n  <singleFileCompilation>0</singleFileCompilation>\n  <oneobj>0</oneobj>\n  <mscoff>1</mscoff>\n  <trace>0</trace>\n  <quiet>0</quiet>\n  <verbose>0</verbose>\n  <vtls>0</vtls>\n  <vgc>0</vgc>\n  <symdebug>0</symdebug>\n  <symdebugref>1</symdebugref>\n  <optimize>1</optimize>\n  <cpu>0</cpu>\n  <isX86_64>0</isX86_64>\n  <isLinux>0</isLinux>\n  <isOSX>0</isOSX>\n  <isWindows>0</isWindows>\n  <isFreeBSD>0</isFreeBSD>\n  <isSolaris>0</isSolaris>\n  <scheduler>0</scheduler>\n  <useDeprecated>0</useDeprecated>\n  <errDeprecated>0</errDeprecated>\n  <useAssert>0</useAssert>\n  <useInvariants>0</useInvariants>\n  <useIn>0</useIn>\n  <useOut>0</useOut>\n  <useArrayBounds>0</useArrayBounds>\n  <boundscheck>0</boundscheck>\n  <useSwitchError>0</useSwitchError>\n  <useUnitTests>0</useUnitTests>\n  <useInline>1</useInline>\n  <release>1</release>\n  <preservePaths>0</preservePaths>\n  <warnings>0</warnings>\n  <infowarnings>0</infowarnings>\n  <genStackFrame>0</genStackFrame>\n  <pic>0</pic>\n  <cov>0</cov>\n  <nofloat>0</nofloat>\n  <ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>\n  <allinst>0</allinst>\n  <stackStomp>0</stackStomp>\n  <betterC>0</betterC>\n  <dip25>0</dip25>\n  <dip1000>0</dip1000>\n  <dip1008>0</dip1008>\n  <dip1021>0</dip1021>\n  <transition_field>0</transition_field>\n  <revert_import>0</revert_import>\n  <preview_dtorfields>0</preview_dtorfields>\n  <transition_checkimports>0</transition_checkimports>\n  <transition_complex>0</transition_complex>\n  <preview_intpromote>0</preview_intpromote>\n  <preview_fixAliasThis>0</preview_fixAliasThis>\n  <preview_markdown>0</preview_markdown>\n  <preview_rvaluerefparam>0</preview_rvaluerefparam>\n  <preview_nosharedaccess>0</preview_nosharedaccess>\n  <preview_in>0</preview_in>\n  <preview_inclincontracts>0</preview_inclincontracts>\n  <transition_vmarkdown>0</transition_vmarkdown>\n  <compiler>2</compiler>\n  <otherDMD>0</otherDMD>\n  <cccmd>$(CC) -c</cccmd>\n  <ccTransOpt>1</ccTransOpt>\n  <addDepImp>0</addDepImp>\n  <program>$(DMDInstallDir)windows\\bin\\dmd.exe</program>\n  <imppath>src</imppath>\n  <fileImppath>.</fileImppath>\n  <outdir>out</outdir>\n  <objdir>$(OutDir)</objdir>\n  <objname />\n  <libname />\n  <doDocComments>0</doDocComments>\n  <docdir />\n  <docname />\n  <modules_ddoc />\n  <ddocfiles />\n  <doHdrGeneration>0</doHdrGeneration>\n  <hdrdir />\n  <hdrname />\n  <doXGeneration>1</doXGeneration>\n  <xfilename>$(IntDir)\\$(TargetName).json</xfilename>\n  <debuglevel>0</debuglevel>\n  <debugids />\n  <versionlevel>0</versionlevel>\n  <versionids />\n  <dump_source>0</dump_source>\n  <mapverbosity>0</mapverbosity>\n  <createImplib>0</createImplib>\n  <debuglib>0</debuglib>\n  <defaultlibname />\n  <debuglibname />\n  <moduleDepsFile />\n  <run>0</run>\n  <runargs />\n  <runCv2pdb>0</runCv2pdb>\n  <pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>\n  <cv2pdbNoDemangle>0</cv2pdbNoDemangle>\n  <cv2pdbEnumType>0</cv2pdbEnumType>\n  <cv2pdbOptions />\n  <enableMixin>0</enableMixin>\n  <mixinPath>$(IntDir)\\$(SafeProjectName).mixin</mixinPath>\n  <objfiles />\n  <linkswitches />\n  <libfiles />\n  <libpaths />\n  <deffile />\n  <resfile>src\\keynavish\\versioninfo.res</resfile>\n  <exefile>$(OutDir)\\$(ProjectName).exe</exefile>\n  <pdbfile>$(IntDir)\\$(SafeProjectName).pdb</pdbfile>\n  <impfile>$(IntDir)\\$(SafeProjectName).lib</impfile>\n  <mapfile>$(IntDir)\\$(SafeProjectName).map</mapfile>\n  <useStdLibPath>1</useStdLibPath>\n  <cRuntime>2</cRuntime>\n  <privatePhobos>0</privatePhobos>\n  <additionalOptions />\n  <preBuildCommand>call generate-version-info.bat</preBuildCommand>\n  <postBuildCommand />\n  <filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.tlog</filesToClean>\n </Config>\n <Config platform=\"x64\" name=\"Debug\">\n  <obj>0</obj>\n  <link>0</link>\n  <lib>0</lib>\n  <subsystem>2</subsystem>\n  <multiobj>0</multiobj>\n  <singleFileCompilation>0</singleFileCompilation>\n  <oneobj>0</oneobj>\n  <mscoff>0</mscoff>\n  <trace>0</trace>\n  <quiet>0</quiet>\n  <verbose>0</verbose>\n  <vtls>0</vtls>\n  <vgc>0</vgc>\n  <symdebug>1</symdebug>\n  <symdebugref>1</symdebugref>\n  <optimize>0</optimize>\n  <cpu>0</cpu>\n  <isX86_64>1</isX86_64>\n  <isLinux>0</isLinux>\n  <isOSX>0</isOSX>\n  <isWindows>0</isWindows>\n  <isFreeBSD>0</isFreeBSD>\n  <isSolaris>0</isSolaris>\n  <scheduler>0</scheduler>\n  <useDeprecated>0</useDeprecated>\n  <errDeprecated>0</errDeprecated>\n  <useAssert>0</useAssert>\n  <useInvariants>0</useInvariants>\n  <useIn>0</useIn>\n  <useOut>0</useOut>\n  <useArrayBounds>0</useArrayBounds>\n  <boundscheck>0</boundscheck>\n  <useSwitchError>0</useSwitchError>\n  <useUnitTests>0</useUnitTests>\n  <useInline>0</useInline>\n  <release>0</release>\n  <preservePaths>0</preservePaths>\n  <warnings>0</warnings>\n  <infowarnings>0</infowarnings>\n  <genStackFrame>0</genStackFrame>\n  <pic>0</pic>\n  <cov>0</cov>\n  <nofloat>0</nofloat>\n  <ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>\n  <allinst>0</allinst>\n  <stackStomp>0</stackStomp>\n  <betterC>0</betterC>\n  <dip25>0</dip25>\n  <dip1000>0</dip1000>\n  <dip1008>0</dip1008>\n  <dip1021>0</dip1021>\n  <transition_field>0</transition_field>\n  <revert_import>0</revert_import>\n  <preview_dtorfields>0</preview_dtorfields>\n  <transition_checkimports>0</transition_checkimports>\n  <transition_complex>0</transition_complex>\n  <preview_intpromote>0</preview_intpromote>\n  <preview_fixAliasThis>0</preview_fixAliasThis>\n  <preview_markdown>0</preview_markdown>\n  <preview_rvaluerefparam>0</preview_rvaluerefparam>\n  <preview_nosharedaccess>0</preview_nosharedaccess>\n  <preview_in>0</preview_in>\n  <preview_inclincontracts>0</preview_inclincontracts>\n  <transition_vmarkdown>0</transition_vmarkdown>\n  <compiler>2</compiler>\n  <otherDMD>0</otherDMD>\n  <cccmd>$(CC) -c</cccmd>\n  <ccTransOpt>1</ccTransOpt>\n  <addDepImp>0</addDepImp>\n  <program>$(DMDInstallDir)windows\\bin\\dmd.exe</program>\n  <imppath>src</imppath>\n  <fileImppath>.</fileImppath>\n  <outdir>out</outdir>\n  <objdir>$(OutDir)</objdir>\n  <objname />\n  <libname />\n  <doDocComments>0</doDocComments>\n  <docdir />\n  <docname />\n  <modules_ddoc />\n  <ddocfiles />\n  <doHdrGeneration>0</doHdrGeneration>\n  <hdrdir />\n  <hdrname />\n  <doXGeneration>1</doXGeneration>\n  <xfilename>$(IntDir)\\$(TargetName).json</xfilename>\n  <debuglevel>0</debuglevel>\n  <debugids />\n  <versionlevel>0</versionlevel>\n  <versionids />\n  <dump_source>0</dump_source>\n  <mapverbosity>0</mapverbosity>\n  <createImplib>0</createImplib>\n  <debuglib>0</debuglib>\n  <defaultlibname />\n  <debuglibname />\n  <moduleDepsFile />\n  <run>0</run>\n  <runargs />\n  <runCv2pdb>1</runCv2pdb>\n  <pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>\n  <cv2pdbNoDemangle>0</cv2pdbNoDemangle>\n  <cv2pdbEnumType>0</cv2pdbEnumType>\n  <cv2pdbOptions />\n  <enableMixin>0</enableMixin>\n  <mixinPath>$(IntDir)\\$(SafeProjectName).mixin</mixinPath>\n  <objfiles />\n  <linkswitches />\n  <libfiles />\n  <libpaths />\n  <deffile />\n  <resfile>src\\keynavish\\versioninfo.res</resfile>\n  <exefile>$(OutDir)\\$(ProjectName).exe</exefile>\n  <pdbfile>$(IntDir)\\$(SafeProjectName).pdb</pdbfile>\n  <impfile>$(IntDir)\\$(SafeProjectName).lib</impfile>\n  <mapfile>$(IntDir)\\$(SafeProjectName).map</mapfile>\n  <useStdLibPath>1</useStdLibPath>\n  <cRuntime>2</cRuntime>\n  <privatePhobos>0</privatePhobos>\n  <additionalOptions />\n  <preBuildCommand>call generate-version-info.bat</preBuildCommand>\n  <postBuildCommand />\n  <filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.tlog</filesToClean>\n </Config>\n <Config platform=\"x64\" name=\"Release\">\n  <obj>0</obj>\n  <link>0</link>\n  <lib>0</lib>\n  <subsystem>2</subsystem>\n  <multiobj>0</multiobj>\n  <singleFileCompilation>0</singleFileCompilation>\n  <oneobj>0</oneobj>\n  <mscoff>0</mscoff>\n  <trace>0</trace>\n  <quiet>0</quiet>\n  <verbose>0</verbose>\n  <vtls>0</vtls>\n  <vgc>0</vgc>\n  <symdebug>0</symdebug>\n  <symdebugref>1</symdebugref>\n  <optimize>1</optimize>\n  <cpu>0</cpu>\n  <isX86_64>1</isX86_64>\n  <isLinux>0</isLinux>\n  <isOSX>0</isOSX>\n  <isWindows>0</isWindows>\n  <isFreeBSD>0</isFreeBSD>\n  <isSolaris>0</isSolaris>\n  <scheduler>0</scheduler>\n  <useDeprecated>0</useDeprecated>\n  <errDeprecated>0</errDeprecated>\n  <useAssert>0</useAssert>\n  <useInvariants>0</useInvariants>\n  <useIn>0</useIn>\n  <useOut>0</useOut>\n  <useArrayBounds>0</useArrayBounds>\n  <boundscheck>0</boundscheck>\n  <useSwitchError>0</useSwitchError>\n  <useUnitTests>0</useUnitTests>\n  <useInline>1</useInline>\n  <release>1</release>\n  <preservePaths>0</preservePaths>\n  <warnings>0</warnings>\n  <infowarnings>0</infowarnings>\n  <genStackFrame>0</genStackFrame>\n  <pic>0</pic>\n  <cov>0</cov>\n  <nofloat>0</nofloat>\n  <ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>\n  <allinst>0</allinst>\n  <stackStomp>0</stackStomp>\n  <betterC>0</betterC>\n  <dip25>0</dip25>\n  <dip1000>0</dip1000>\n  <dip1008>0</dip1008>\n  <dip1021>0</dip1021>\n  <transition_field>0</transition_field>\n  <revert_import>0</revert_import>\n  <preview_dtorfields>0</preview_dtorfields>\n  <transition_checkimports>0</transition_checkimports>\n  <transition_complex>0</transition_complex>\n  <preview_intpromote>0</preview_intpromote>\n  <preview_fixAliasThis>0</preview_fixAliasThis>\n  <preview_markdown>0</preview_markdown>\n  <preview_rvaluerefparam>0</preview_rvaluerefparam>\n  <preview_nosharedaccess>0</preview_nosharedaccess>\n  <preview_in>0</preview_in>\n  <preview_inclincontracts>0</preview_inclincontracts>\n  <transition_vmarkdown>0</transition_vmarkdown>\n  <compiler>2</compiler>\n  <otherDMD>0</otherDMD>\n  <cccmd>$(CC) -c</cccmd>\n  <ccTransOpt>1</ccTransOpt>\n  <addDepImp>0</addDepImp>\n  <program>$(DMDInstallDir)windows\\bin\\dmd.exe</program>\n  <imppath>src</imppath>\n  <fileImppath>.</fileImppath>\n  <outdir>out</outdir>\n  <objdir>$(OutDir)</objdir>\n  <objname />\n  <libname />\n  <doDocComments>0</doDocComments>\n  <docdir />\n  <docname />\n  <modules_ddoc />\n  <ddocfiles />\n  <doHdrGeneration>0</doHdrGeneration>\n  <hdrdir />\n  <hdrname />\n  <doXGeneration>1</doXGeneration>\n  <xfilename>$(IntDir)\\$(TargetName).json</xfilename>\n  <debuglevel>0</debuglevel>\n  <debugids />\n  <versionlevel>0</versionlevel>\n  <versionids />\n  <dump_source>0</dump_source>\n  <mapverbosity>0</mapverbosity>\n  <createImplib>0</createImplib>\n  <debuglib>0</debuglib>\n  <defaultlibname />\n  <debuglibname />\n  <moduleDepsFile />\n  <run>0</run>\n  <runargs />\n  <runCv2pdb>0</runCv2pdb>\n  <pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>\n  <cv2pdbNoDemangle>0</cv2pdbNoDemangle>\n  <cv2pdbEnumType>0</cv2pdbEnumType>\n  <cv2pdbOptions />\n  <enableMixin>0</enableMixin>\n  <mixinPath>$(IntDir)\\$(SafeProjectName).mixin</mixinPath>\n  <objfiles />\n  <linkswitches />\n  <libfiles />\n  <libpaths />\n  <deffile />\n  <resfile>src\\keynavish\\versioninfo.res</resfile>\n  <exefile>$(OutDir)\\$(ProjectName).exe</exefile>\n  <pdbfile>$(IntDir)\\$(SafeProjectName).pdb</pdbfile>\n  <impfile>$(IntDir)\\$(SafeProjectName).lib</impfile>\n  <mapfile>$(IntDir)\\$(SafeProjectName).map</mapfile>\n  <useStdLibPath>1</useStdLibPath>\n  <cRuntime>1</cRuntime>\n  <privatePhobos>0</privatePhobos>\n  <additionalOptions />\n  <preBuildCommand>call generate-version-info.bat</preBuildCommand>\n  <postBuildCommand />\n  <filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.tlog</filesToClean>\n </Config>\n <Folder name=\"keynavish\">\n  <Folder name=\"src\">\n   <Folder name=\"keynavish\">\n    <File path=\"src\\keynavish\\commands.d\" />\n    <File path=\"src\\keynavish\\config.d\" />\n    <File path=\"src\\keynavish\\errorhandling.d\" />\n    <File path=\"src\\keynavish\\grid.d\" />\n    <File path=\"src\\keynavish\\helpers.d\" />\n    <File path=\"src\\keynavish\\keyboardinput.d\" />\n    <File path=\"src\\keynavish\\main.d\" />\n    <File path=\"src\\keynavish\\notifyicon.d\" />\n    <File path=\"src\\keynavish\\package.d\" />\n    <File path=\"src\\keynavish\\recording.d\" />\n    <File path=\"src\\keynavish\\window.d\" />\n   </Folder>\n  </Folder>\n </Folder>\n</DProject>\n"
  },
  {
    "path": "keynavrc",
    "content": "# Project page; https://github.com/lesderid/keynavish\r\n\r\n# Use 'clear' to blow away any previous keybindings\r\n#clear\r\n\r\nctrl+semicolon start\r\nEscape end\r\nctrl+bracketleft end\r\nh cut-left\r\nj cut-down\r\nk cut-up\r\nl cut-right\r\ny cut-left,cut-up\r\nu cut-right,cut-up\r\nb cut-left,cut-down\r\nn cut-right,cut-down\r\nshift+h move-left\r\nshift+j move-down\r\nshift+k move-up\r\nshift+l move-right\r\nshift+y move-left,move-up\r\nshift+u move-right,move-up\r\nshift+b move-left,move-down\r\nshift+n move-right,move-down\r\nspace warp,click 1,end\r\nsemicolon warp,end\r\n1 click 1\r\n2 click 2\r\n3 click 3\r\n\r\n# Zoom to the current window\r\nw windowzoom\r\n\r\n# Zoom to the cursor location with a given height and width\r\nc cursorzoom 200 200\r\n\r\n# Handy for holding ctrl while using keynav(ish):\r\nctrl+h cut-left\r\nctrl+j cut-down\r\nctrl+k cut-up\r\nctrl+l cut-right\r\nctrl+y cut-left,cut-up\r\nctrl+u cut-right,cut-up\r\nctrl+b cut-left,cut-down\r\nctrl+n cut-right,cut-down\r\n\r\n# Arrow keys can move the grid as welll\r\nLeft cut-left\r\nDown cut-down\r\nUp cut-up\r\nRight cut-right\r\nshift+Left move-left\r\nshift+Down move-down\r\nshift+Up move-up\r\nshift+Right move-right\r\nctrl+Left cut-left\r\nctrl+Down cut-down\r\nctrl+Up cut-up\r\nctrl+Right cut-right\r\nctrl+shift+Left move-left\r\nctrl+shift+Down move-down\r\nctrl+shift+Up move-up\r\nctrl+shift+Right move-right\r\n\r\n# Record keynav(ish) actions\r\nq record\r\nshift+at playback\r\n\r\n### Example using the 'sh' command.\r\nv sh \"notepad\"\r\n\r\n### Drag examples\r\n# Start drag holding the left mouse button\r\n#q drag 1\r\n# Start drag holding middle mouse + control and shift\r\n#w drag 2 ctrl+shift\r\n# Dragging with modifiers\r\n#q drag 1\r\n#ctrl+q drag 1 ctrl\r\n#shift+q drag 1 shift\r\n#shift+ctrl+q drag 1 shift+ctrl\r\n\r\n### History\r\na history-back\r\n\r\n### Example of cut and move without the default values\r\n#h cut-left .75\r\n#j cut-down .75\r\n#k cut-up .75\r\n#l cut-right .75\r\n#shift+h move-left .50\r\n#shift+j move-down .50\r\n#shift+k move-up .50\r\n#shift+l move-right .50\r\n\r\n### Example using a 2-row, 3-column grid,\r\n# mapped to Insert/Home/PageUp/etc...\r\n6 grid 3x2\r\nInsert cell-select 1x1\r\nHome cell-select 2x1\r\nPage_Up cell-select 3x1   # PageUp\r\nDelete cell-select 1x2\r\nEnd cell-select 2x2\r\nPage_Down cell-select 3x2   # PageDown\r\n\r\n### Example using a 3x3 grid with nethack-vi keys\r\n#ctrl+semicolon start, grid 3x3\r\n#h cell-select 1x2      # left\r\n#j cell-select 2x3      # down\r\n#k cell-select 2x1      # up\r\n#l cell-select 3x2      # right\r\n#y cell-select 1x1      # up-left\r\n#u cell-select 3x1      # up-right\r\n#b cell-select 1x3      # down-left\r\n#n cell-select 3x3      # down-right\r\n#period cell-select 2x2 # center\r\n"
  },
  {
    "path": "src/keynavish/commands.d",
    "content": "module keynavish.commands;\n\nimport keynavish;\n\nimport core.sys.windows.windows : LONG, DWORD;\n\nDWORD draggingFlag;\nlong delayMilliseconds = 0;\n\nenum Direction\n{\n    up, down, left, right\n}\n\nDirection commandToDirection(string commandString)\n{\n    import std.algorithm : findSkip;\n    findSkip(commandString, \"-\");\n    switch (commandString)\n    {\n        case \"up\":    return Direction.up;\n        case \"down\":  return Direction.down;\n        case \"left\":  return Direction.left;\n        case \"right\": return Direction.right;\n        default:      assert(false);\n    }\n}\n\nvoid redrawWindow()\n{\n    import core.sys.windows.windows : InvalidateRect;\n\n    if (windowHandle == null) return;\n\n    InvalidateRect(windowHandle, null, true);\n}\n\nprivate void start()\n{\n    import core.sys.windows.windows : MoveWindow;\n\n    resetGrid();\n    if (gridNavEnabled)\n    {\n        resetGridNavSelection();\n    }\n\n    auto virtualScreen = virtualScreenRectangle;\n    MoveWindow(windowHandle, virtualScreen.left, virtualScreen.top, virtualScreen.width, virtualScreen.height, false);\n\n    showWindow();\n}\n\nprivate void end()\n{\n    hideWindow();\n}\n\nprivate void toggleStart()\n{\n    if (active) end();\n    else start();\n}\n\nprivate void quit()\n{\n    import core.sys.windows.windows : PostQuitMessage;\n\n    PostQuitMessage(0);\n}\n\nvoid restart()\n{\n    import core.sys.windows.windows : GetModuleFileName;\n    import std.process : spawnProcess;\n    import std.conv : to;\n    import core.runtime : Runtime;\n\n    spawnProcess(Runtime.args);\n\n    quit();\n}\n\nprivate LONG getCutMoveValue(Direction direction, string arg)\n{\n    import std.algorithm : canFind;\n    import std.conv : to;\n\n    if (arg == \"0\")\n    {\n        return 0;\n    }\n\n    auto original = (direction == Direction.up || direction == Direction.down) ? grid.rect.height : grid.rect.width;\n\n    if (arg == \"1\")\n    {\n        return original;\n    }\n    else if (arg.canFind('.'))\n    {\n        return cast(LONG)(arg.to!double * original);\n    }\n    else\n    {\n        return arg.to!LONG;\n    }\n}\n\nprivate void cut(Direction direction, string arg)\n{\n    import core.sys.windows.windows : RECT;\n\n    if (!active) return;\n\n    auto value = getCutMoveValue(direction, arg != null ? arg : \"0.5\");\n    auto diff = (direction == Direction.up || direction == Direction.down) ? grid.rect.height - value : grid.rect.width - value;\n\n    auto virtualScreen = virtualScreenRectangle;\n\n    Grid newGrid = grid;\n    final switch (direction) with (Direction)\n    {\n        case up:\n            newGrid.rect.bottom -= diff;\n            if (newGrid.rect.bottom < virtualScreen.top) newGrid.rect.bottom = virtualScreen.top;\n            break;\n        case down:\n            newGrid.rect.top += diff;\n            if (newGrid.rect.top < virtualScreen.top) newGrid.rect.top = virtualScreen.top;\n            break;\n        case left:\n            newGrid.rect.right -= diff;\n            if (newGrid.rect.right < virtualScreen.left) newGrid.rect.right = virtualScreen.left;\n            break;\n        case right:\n            newGrid.rect.left += diff;\n            if (newGrid.rect.left < virtualScreen.left) newGrid.rect.left = virtualScreen.left;\n            break;\n    }\n\n    grid = newGrid;\n    redrawWindow();\n\n    if (newGrid.rect.height < 2 || newGrid.rect.width < 2)\n    {\n        resetGrid();\n        hideWindow();\n    }\n}\n\nprivate void move(Direction direction, string arg)\n{\n    import core.sys.windows.windows : RECT;\n\n    if (!active) return;\n\n    auto virtualScreen = virtualScreenRectangle;\n    auto virtualScreenRight = virtualScreen.left + virtualScreen.width;\n    auto virtualScreenBottom = virtualScreen.top + virtualScreen.height;\n\n    auto value = getCutMoveValue(direction, arg != null ? arg : \"1\");\n\n    Grid newGrid = grid;\n    final switch (direction) with (Direction)\n    {\n        case up:\n            newGrid.rect.top -= value;\n            newGrid.rect.bottom -= value;\n            if (newGrid.rect.top < virtualScreen.top)\n            {\n                newGrid.rect.bottom -= (newGrid.rect.top - virtualScreen.top);\n                newGrid.rect.top = virtualScreen.top;\n            }\n            break;\n        case down:\n            newGrid.rect.top += value;\n            newGrid.rect.bottom += value;\n            if (newGrid.rect.bottom > virtualScreenBottom)\n            {\n                newGrid.rect.top -= (newGrid.rect.bottom - virtualScreenBottom);\n                newGrid.rect.bottom = virtualScreenBottom;\n            }\n            break;\n        case left:\n            newGrid.rect.left -= value;\n            newGrid.rect.right -= value;\n            if (newGrid.rect.left < virtualScreen.left)\n            {\n                newGrid.rect.right -= (newGrid.rect.left - virtualScreen.left);\n                newGrid.rect.left = virtualScreen.left;\n            }\n            break;\n        case right:\n            newGrid.rect.left += value;\n            newGrid.rect.right += value;\n            if (newGrid.rect.right > virtualScreenRight)\n            {\n                newGrid.rect.left -= (newGrid.rect.right - virtualScreenRight);\n                newGrid.rect.right = virtualScreenRight;\n            }\n            break;\n    }\n\n    grid = newGrid;\n\n    redrawWindow();\n}\n\nprivate void warp()\n{\n    import core.sys.windows.windows : SetCursorPos;\n    import core.sys.windows.winuser;\n\n    if (!active) return;\n\n    auto resolution = primaryDeviceResolution;\n\n    auto middleX = grid.rect.left + grid.rect.width / 2;\n    auto middleY = grid.rect.top + grid.rect.height / 2;\n\n    INPUT input;\n    input.type = INPUT_MOUSE;\n    input.mi.dx = middleX * 65536 / resolution.width;\n    input.mi.dy = middleY * 65536 / resolution.height;\n    input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | draggingFlag;\n    SendInput(1, &input, INPUT.sizeof);\n}\n\nprivate void cursorZoom(int width, int height)\n{\n    import core.sys.windows.windows : RECT, POINT, GetCursorPos;\n\n    POINT cursorPosition;\n\n    auto result = GetCursorPos(&cursorPosition);\n    assert(result);\n\n    Grid newGrid = grid;\n    newGrid.rect.left = cursorPosition.x - width / 2;\n    newGrid.rect.right = cursorPosition.x + width / 2;\n    newGrid.rect.top = cursorPosition.y - height / 2;\n    newGrid.rect.bottom = cursorPosition.y + height / 2;\n    grid = newGrid;\n\n    redrawWindow();\n}\n\nprivate void windowZoom()\n{\n    import core.sys.windows.windows : RECT, GetForegroundWindow, GetWindowRect;\n\n    Grid newGrid = grid;\n    GetWindowRect(GetForegroundWindow(), &newGrid.rect);\n    grid = newGrid;\n\n    redrawWindow();\n}\n\nprivate void click(string button)\n{\n    import core.sys.windows.winuser;\n    import core.thread.osthread : Thread;\n    import core.time : dur;\n\n    INPUT[2] inputs;\n\n    inputs[0].type = INPUT_MOUSE;\n    inputs[1].type = INPUT_MOUSE;\n\n    switch (button)\n    {\n        case \"1\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;\n            break;\n        case \"2\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_MIDDLEUP;\n            break;\n        case \"3\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_RIGHTUP;\n            break;\n        case \"4\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_WHEEL;\n            inputs[0].mi.mouseData = WHEEL_DELTA;\n            inputs[1].mi.dwFlags = 0;\n            break;\n        case \"5\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_WHEEL;\n            inputs[0].mi.mouseData = -WHEEL_DELTA;\n            inputs[1].mi.dwFlags = 0;\n            break;\n        default:\n            showError(\"Invalid mouse button: \" ~ button);\n            break;\n    }\n\n    if (delayMilliseconds == 0)\n    {\n        SendInput(2, inputs.ptr, INPUT.sizeof);\n    }\n    else\n    {\n        SendInput(1, inputs.ptr, INPUT.sizeof);\n        Thread.sleep(dur!(\"msecs\")(delayMilliseconds));\n        SendInput(1, inputs.ptr + 1, INPUT.sizeof);\n    }\n}\n\nprivate void doubleClick(string button)\n{\n    import core.sys.windows.winuser;\n    import core.thread.osthread : Thread;\n    import core.time : dur;\n\n    INPUT[4] inputs;\n\n    inputs[0].type = INPUT_MOUSE;\n    inputs[1].type = INPUT_MOUSE;\n\n    switch (button)\n    {\n        case \"1\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;\n            break;\n        case \"2\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_MIDDLEUP;\n            break;\n        case \"3\":\n            inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;\n            inputs[1].mi.dwFlags = MOUSEEVENTF_RIGHTUP;\n            break;\n        default:\n            showError(\"Invalid mouse button: \" ~ button);\n            break;\n    }\n\n    inputs[2] = inputs[0];\n    inputs[3] = inputs[1];\n\n    if (delayMilliseconds == 0)\n    {\n        SendInput(4, inputs.ptr, INPUT.sizeof);\n    }\n    else\n    {\n        SendInput(1, inputs.ptr, INPUT.sizeof);\n        Thread.sleep(dur!(\"msecs\")(delayMilliseconds));\n        SendInput(1, inputs.ptr + 1, INPUT.sizeof);\n\n        SendInput(1, inputs.ptr + 2, INPUT.sizeof);\n        Thread.sleep(dur!(\"msecs\")(delayMilliseconds));\n        SendInput(1, inputs.ptr + 3, INPUT.sizeof);\n    }\n}\n\nprivate void drag(string button, string modifiers)\n{\n    import core.sys.windows.windows;\n    import std.string : split;\n\n    static bool dragging = false;\n\n    INPUT mouseInput;\n\n    mouseInput.type = INPUT_MOUSE;\n\n    switch (button)\n    {\n        case \"1\":\n            mouseInput.mi.dwFlags = !draggingFlag ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;\n            break;\n        case \"2\":\n            mouseInput.mi.dwFlags = !draggingFlag ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;\n            break;\n        case \"3\":\n            mouseInput.mi.dwFlags = !draggingFlag ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;\n            break;\n        default:\n            showError(\"Invalid mouse button: \" ~ button);\n            break;\n    }\n\n    if (draggingFlag && modifiers != null)\n    {\n        INPUT[] keyUpInputs;\n        INPUT[] keyDownInputs;\n\n        foreach (modifier; modifiers.split('+'))\n        {\n            INPUT keyboardInput;\n            keyboardInput.type = INPUT_KEYBOARD;\n            switch (modifier)\n            {\n                case \"ctrl\":\n                    keyboardInput.ki.wVk = VK_CONTROL;\n                    break;\n                case \"shift\":\n                    keyboardInput.ki.wVk = VK_SHIFT;\n                    break;\n                case \"alt\":\n                    keyboardInput.ki.wVk = VK_MENU;\n                    break;\n                case \"super\":\n                    keyboardInput.ki.wVk = VK_LWIN;\n                    break;\n                default:\n                    break;\n            }\n\n            keyUpInputs ~= keyboardInput;\n\n            keyboardInput.ki.dwFlags = KEYEVENTF_KEYUP;\n            keyDownInputs ~= keyboardInput;\n        }\n\n        INPUT[] inputs = keyUpInputs ~ [mouseInput] ~ keyDownInputs;\n        SendInput(cast(DWORD) inputs.length, inputs.ptr, INPUT.sizeof);\n    }\n    else\n    {\n        SendInput(1, &mouseInput, INPUT.sizeof);\n    }\n\n    draggingFlag = !draggingFlag ? mouseInput.mi.dwFlags : 0;\n}\n\nprivate void runShellCommand(string shellCommand)\n{\n    import std.process : spawnShell;\n\n    spawnShell(shellCommand);\n}\n\nvoid loadAllConfigs()\n{\n    import std.file : thisExePath;\n    import std.path : dirName, buildPath;\n\n    recordings = [];\n\n    auto portableConfigPath = dirName(thisExePath()).buildPath(\"keynavrc\");\n\n    foreach (path; [portableConfigPath] ~ configFilePaths)\n    {\n        loadConfig(path, true);\n    }\n\n    loadRecordings();\n}\n\nvoid loadConfig(string pathString, bool silent = false)\n{\n    import std.file : exists, readText;\n    import std.range : array;\n    import std.conv : to;\n    import std.format : format;\n    import std.array : replace, split;\n\n    string path = pathString.expandPath;\n\n    if (!path.exists)\n    {\n        if (!silent)\n        {\n            if (path == pathString)\n            {\n                showError(format!\"Error loading config file: %s does not exist\"(path));\n            }\n            else\n            {\n                showError(format!\"Error loading config file: %s (expanded to: %s) does not exist\"(pathString, path));\n            }\n        }\n        return;\n    }\n\n    foreach (line; path.readText.replace('\\r', \"\").split('\\n'))\n    {\n        registerKeyBinding(line.to!string);\n    }\n}\n\nprivate void historyBack()\n{\n    tryPopGrid();\n\n    redrawWindow();\n}\n\nprivate void changeGrid(string columnsAndRows)\n{\n    import std.range : split, array;\n    import std.algorithm : map;\n    import std.conv : to;\n\n    auto dimArray = columnsAndRows.split('x').map!(to!int).array;\n\n    Grid newGrid = grid;\n    newGrid.columns = dimArray[0];\n    newGrid.rows = dimArray[1];\n    grid = newGrid;\n\n    redrawWindow();\n}\n\nprivate void setGridNav(string value)\n{\n    import std.string : toLower;\n\n    switch (value.toLower)\n    {\n        case \"on\":\n            enableGridNav(true);\n            break;\n        case \"off\":\n            enableGridNav(false);\n            break;\n        case \"toggle\":\n            enableGridNav(!gridNavEnabled);\n            break;\n        default:\n            showError(\"Invalid grid-nav value: \" ~ value);\n            return;\n    }\n\n    redrawWindow();\n}\n\nvoid cellSelect(string columnsAndRows)\n{\n    import core.sys.windows.windows : RECT;\n    import std.range : split, array;\n    import std.algorithm : map;\n    import std.conv : to;\n\n    auto dimArray = columnsAndRows.split('x').map!(to!int).array;\n\n    auto x = grid.rect.left;\n    auto y = grid.rect.top;\n    auto width = grid.rect.width / grid.columns;\n    auto height = grid.rect.height / grid.rows;\n\n    Grid newGrid = grid;\n    newGrid.rect = RECT(x + (dimArray[0] - 1) * width, y + (dimArray[1] - 1) * height, x + dimArray[0] * width, y + dimArray[1] * height);\n    if (newGrid.rect.height < 2 || newGrid.rect.width < 2)\n    {\n        resetGrid();\n        hideWindow();\n    }\n    else\n    {\n        grid = newGrid;\n        redrawWindow();\n    }\n}\n\nprivate void record(string path = null)\n{\n    if (recordingActive)\n    {\n        stopRecording();\n    }\n    else\n    {\n        startRecording(path);\n    }\n}\n\nprivate void replay()\n{\n    startReplaying();\n}\n\nprivate void clear()\n{\n    startKeyBindings = [];\n    regularKeyBindings = [];\n    delayMilliseconds = 0;\n}\n\nprivate void setDelay(string delayString)\n{\n    import std.conv : to;\n\n    delayMilliseconds = delayString.to!long;\n}\n\nvoid processCommands(string[][] commands)\n{\n    foreach (command; commands)\n    {\n        processCommand(command);\n    }\n}\n\nbool verifyCommands(string[][] commands)\n{\n    auto allCorrect = true;\n    foreach (command; commands)\n    {\n        if (!verifyCommand(command))\n        {\n            allCorrect = false;\n        }\n    }\n    return allCorrect;\n}\n\nvoid processCommand(string[] command)\n{\n    import std.conv : to;\n\n    switch (command[0])\n    {\n        case \"start\":\n            start();\n            break;\n        case \"end\":\n            end();\n            break;\n        case \"toggle-start\":\n            toggleStart();\n            break;\n        case \"quit\":\n            quit();\n            break;\n        case \"restart\":\n            restart();\n            break;\n        case \"warp\":\n            warp();\n            break;\n        case \"windowzoom\":\n            windowZoom();\n            break;\n        case \"click\":\n            click(command[1]);\n            break;\n        case \"doubleclick\":\n            doubleClick(command[1]);\n            break;\n        case \"drag\":\n            drag(command[1], command.length == 3 ? command[2] : null);\n            break;\n        case \"cursorzoom\":\n            cursorZoom(command[1].to!int, command[2].to!int);\n            break;\n        case \"history-back\":\n            historyBack();\n            break;\n        case \"grid\":\n            changeGrid(command[1]);\n            break;\n        case \"grid-nav\":\n            setGridNav(command[1]);\n            break;\n        case \"cell-select\":\n            cellSelect(command[1]);\n            break;\n        case \"cut-up\":\n        case \"cut-down\":\n        case \"cut-left\":\n        case \"cut-right\":\n            cut(command[0].commandToDirection(), command.length == 2 ? command[1] : null);\n            break;\n        case \"move-up\":\n        case \"move-down\":\n        case \"move-left\":\n        case \"move-right\":\n            move(command[0].commandToDirection(), command.length == 2 ? command[1] : null);\n            break;\n        case \"sh\":\n            runShellCommand(command[1]);\n            break;\n        case \"loadconfig\":\n            loadConfig(command[1]);\n            break;\n        case \"record\":\n            record(command.length == 2 ? command[1] : null);\n            break;\n        case \"playback\":\n            replay();\n            break;\n        case \"daemonize\":\n            //we ignore this as we always add a notification icon\n            break;\n        case \"x-set-delay\":\n            setDelay(command[1]);\n            break;\n        case \"clear\":\n            clear();\n            break;\n        default:\n            showError(\"Command not implemented: \" ~ command[0]);\n            break;\n    }\n}\n\nbool verifyCommand(string[] command)\n{\n    //TODO: More command verification (arg types etc.)\n    //TODO: Refactor (with UDAs?)\n\n    import std.format : format;\n    import std.string : join;\n\n    auto commandString = command.join(' ');\n    bool argCount(int minCount, int maxCount)\n    {\n        auto count = command.length - 1;\n        if (count >= minCount && count <= maxCount)\n        {\n            return true;\n        }\n        \n        if (minCount == maxCount)\n        {\n            showError(format!\"Command '%s' needs %d %s but %d %s given: %s\"(command[0],\n                                                                            minCount,\n                                                                            minCount == 1 ? \"arg\" : \"args\",\n                                                                            count,\n                                                                            count == 1 ? \"was\" : \"were\",\n                                                                            commandString));\n        }\n        else\n        {\n            showError(format!\"Command '%s' needs %d~%d %s but %d %s given: %s\"(command[0],\n                                                                               minCount,\n                                                                               maxCount,\n                                                                               maxCount == 1 ? \"arg\" : \"args\",\n                                                                               count,\n                                                                               count == 1 ? \"was\" : \"were\",\n                                                                               commandString));\n        }\n        return false;\n    }\n\n    switch (command[0])\n    {\n        case \"start\":\n        case \"end\":\n        case \"toggle-start\":\n        case \"warp\":\n        case \"windowzoom\":\n        case \"history-back\":\n        case \"quit\":\n        case \"restart\":\n            if (!argCount(0, 0)) return false;\n            break;\n        case \"cut-up\":\n        case \"cut-down\":\n        case \"cut-left\":\n        case \"cut-right\":\n            if (!argCount(0, 1)) return false;\n            break;\n        case \"move-up\":\n        case \"move-down\":\n        case \"move-left\":\n        case \"move-right\":\n            if (!argCount(0, 1)) return false;\n            break;\n        case \"click\":\n        case \"doubleclick\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"drag\":\n            if (!argCount(1, 2)) return false;\n            break;\n        case \"cursorzoom\":\n            if (!argCount(2, 2)) return false;\n            break;\n        case \"grid\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"cell-select\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"sh\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"loadconfig\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"daemonize\":\n            if (!argCount(0, 0)) return false;\n            break;\n        case \"clear\":\n            if (!argCount(0, 0)) return false;\n            break;\n        case \"record\":\n            if (!argCount(0, 1)) return false;\n            break;\n        case \"playback\":\n            if (!argCount(0, 0)) return false;\n            break;\n        case \"grid-nav\":\n            if (!argCount(1, 1)) return false;\n            break;\n        case \"x-set-delay\":\n            if (!argCount(1, 1)) return false;\n            break;\n        default:\n            showError(\"Unknown command: \" ~ command[0]);\n            return false;\n    }\n    return true;\n}\n"
  },
  {
    "path": "src/keynavish/config.d",
    "content": "module keynavish.config;\n\nimport core.sys.windows.windows;\n\nenum windowClassName = \"keynavish-grid\"w;\nenum windowColourKey = RGB(255, 0, 255);\n\nenum mainPenColour = RGB(30, 64, 64);\nenum mainPenWidth = 1;\nenum borderPenColour = RGB(255, 255, 255);\nenum borderPenWidth = 1;\n\nstatic assert(windowColourKey != mainPenColour, \"Colour key and main pen colour can't be the same\");\nstatic assert(windowColourKey != borderPenColour, \"Colour key and border pen colour can't be the same\");\n\nenum programName = \"keynavish\"w;\nenum programInfo = programName ~ q\"EOS\n – Control the mouse with the keyboard, on Windows.\n\nCopyright © 2021, Les De Ridder <les@lesderid.net>\nEOS\" ~ \"Home page: <\" ~ programUrl ~ \">\";\nenum programUrl = \"https://github.com/lesderid/keynavish\";\n\nenum usageHelpString = \"Usage: \" ~ programName ~ \".exe [options] [optional-startup-commands]\\r\\n\" ~\n\"Example: \" ~ programName ~ \".exe \\\"loadconfig ~/myconfigs/keynavrc,loadconfig ~/myconfigs/anotherkeynavrc\\\"\\r\\n\";\n\nenum configFilePaths = [\"~/.keynavrc\", \"~/keynavrc\", \"~/.config/keynav/keynavrc\"];\n\nenum unhandledExceptionMessage = \"This is a bug, please press Ctrl+C and report it at https://github.com/lesderid/keynavish/issues/new.\";\n"
  },
  {
    "path": "src/keynavish/errorhandling.d",
    "content": "module keynavish.errorhandling;\n\nimport keynavish;\n\nvoid showError(Stringish)(Stringish message)\n{\n    import core.sys.windows.windows : MessageBox, MB_ICONERROR;\n    import std.utf : toUTF16z;\n\n    MessageBox(null, message.toUTF16z, programName.ptr, MB_ICONERROR);\n}\n\nvoid showWarning(Stringish)(Stringish message)\n{\n    import core.sys.windows.windows : MessageBox, MB_ICONWARNING;\n    import std.utf : toUTF16z;\n\n    MessageBox(null, message.toUTF16z, programName.ptr, MB_ICONWARNING);\n}\n\nvoid showInfo(Stringish)(Stringish message)\n{\n    import core.sys.windows.windows : MessageBox, MB_ICONINFORMATION;\n    import std.utf : toUTF16z;\n\n    MessageBox(null, message.toUTF16z, programName.ptr, MB_ICONINFORMATION);\n}\n\ntemplate exceptionHandlerWrapper(alias func)\n{\n    import std.traits;\n    import std.exception;\n    import std.utf : toUTF16z;\n    import core.sys.windows.windows : MessageBox, MB_ICONERROR, MB_SYSTEMMODAL;\n\n    extern(Windows)\n    ReturnType!func exceptionHandlerWrapper(Parameters!func args) nothrow @system\n    {\n        try\n        {\n            return func(args);\n        }\n        catch(Throwable t)\n        {\n            auto message = \"Unhandled exception: \" ~ t.message.assumeWontThrow ~ \"\\r\\n\\r\\n\" ~ unhandledExceptionMessage;\n\n            MessageBox(null, message.toUTF16z, programName.ptr, MB_ICONERROR | MB_SYSTEMMODAL).assumeWontThrow;\n\n            assert(0);\n        }\n    }\n}"
  },
  {
    "path": "src/keynavish/grid.d",
    "content": "module keynavish.grid;\n\nimport core.sys.windows.windows : RECT, HDC, HPEN, HFONT;\nimport std.container : SList;\nimport std.typecons : Tuple;\nimport keynavish;\n\nstruct Grid\n{\n    RECT rect;\n    int rows;\n    int columns;\n}\n\nprivate Grid grid_;\nprivate SList!Grid gridStack;\n\nHPEN mainPen;\nHPEN borderPen;\nHFONT labelFont;\n\nenum GridNavState\n{\n    row,\n    column,\n}\n\nbool gridNavEnabled;\nGridNavState gridNavState = GridNavState.row;\nint gridNavRow = -1;\nint gridNavColumn = -1;\n\nvoid enableGridNav(bool enabled)\n{\n    gridNavEnabled = enabled;\n    gridNavState = GridNavState.row;\n    gridNavRow = -1;\n    gridNavColumn = -1;\n}\n\nvoid resetGridNavSelection()\n{\n    gridNavState = GridNavState.row;\n    gridNavRow = -1;\n    gridNavColumn = -1;\n}\n\n@property\nTuple!(int, \"width\", int, \"height\") primaryDeviceResolution()\n{\n    import core.sys.windows.windows : GetDC, GetDeviceCaps, HORZRES, VERTRES;\n\n    auto rootDeviceContext = GetDC(null);\n\n    auto resolution = typeof(return)();\n    resolution.width = GetDeviceCaps(rootDeviceContext, HORZRES);\n    resolution.height = GetDeviceCaps(rootDeviceContext, VERTRES);\n\n    return resolution;\n}\n\n@property\nRECT[] displayRectangles()\n{\n    import core.sys.windows.windows : EnumDisplayMonitors, MONITORENUMPROC, BOOL, TRUE, HMONITOR, HDC, LPRECT, LPARAM;\n\n    RECT[] displayRectangles = [];\n\n    static extern(Windows) BOOL callback(HMONITOR, HDC, LPRECT rectangle, LPARAM userData)\n    {\n        RECT[]* displayRectangles = cast(RECT[]*) cast(void*) userData;\n\n        *displayRectangles ~= *rectangle;\n\n        return TRUE;\n    }\n\n    EnumDisplayMonitors(null, null, &callback, cast(LPARAM) cast(void*) &displayRectangles);\n\n    return displayRectangles;\n}\n\n@property\nTuple!(int, \"width\", int, \"height\", int, \"left\", int, \"top\") virtualScreenRectangle()\n{\n    import core.sys.windows.windows : GetSystemMetrics, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN;\n\n    auto virtualScreen = typeof(return)();\n    virtualScreen.width = GetSystemMetrics(SM_CXVIRTUALSCREEN);\n    virtualScreen.height = GetSystemMetrics(SM_CYVIRTUALSCREEN);\n    virtualScreen.left = GetSystemMetrics(SM_XVIRTUALSCREEN);\n    virtualScreen.top = GetSystemMetrics(SM_YVIRTUALSCREEN);\n\n    return virtualScreen;\n}\n\nconst(Grid) grid()\n{\n    return grid_;\n}\n\nvoid grid(Grid newGrid)\n{\n    if (newGrid == grid) return;\n\n    gridStack.insertFront(grid);\n    grid_ = newGrid;\n}\n\nvoid tryPopGrid()\n{\n    if (gridStack.empty) return;\n\n    grid_ = gridStack.front;\n    gridStack.removeFront();\n}\n\nvoid resetGrid()\n{\n    import core.sys.windows.windows : POINT, GetCursorPos;\n    import std.algorithm : find;\n    import std.range : empty;\n\n    POINT cursorPosition;\n    auto result = GetCursorPos(&cursorPosition);\n    assert(result);\n\n    auto cursorScreen = displayRectangles.find!(r => r.contains(cursorPosition));\n    assert(!cursorScreen.empty);\n\n    grid_.rect = cursorScreen[0];\n    grid_.rows = 2;\n    grid_.columns = 2;\n    gridStack = typeof(gridStack)();\n}\n\nprivate const(RECT[]) splitGrid()\n{\n    import std.algorithm : cartesianProduct, map;\n    import std.range : array, iota;\n\n    auto x = grid.rect.left;\n    auto y = grid.rect.top;\n    auto width = grid.rect.width / grid.columns;\n    auto height = grid.rect.height / grid.rows;\n\n    return cartesianProduct(grid.columns.iota, grid.rows.iota).map!(t => t.rename!(\"x\", \"y\"))\n            .map!(t => RECT(x + t.x * width, y + t.y * height, x + (t.x + 1) * width, y + (t.y + 1) * height))\n            .array;\n}\n\nvoid paintGrid(HDC deviceContext)\n{\n    import core.sys.windows.windows : DWORD, POINT, PolyPolyline, SelectObject, SetBkMode, SetTextColor, GetTextExtentPoint32, TextOut, Rectangle, TRANSPARENT, RGB, SIZE, HGDIOBJ, GetStockObject, DC_BRUSH, SetDCBrushColor;\n    import std.algorithm : map;\n    import std.range : repeat, join, array;\n    import std.utf : toUTF16z;\n\n    auto virtualScreen = virtualScreenRectangle;\n    auto cells = splitGrid;\n\n    auto pointArrays = cells.map!(r => [\n        POINT(r.left, r.top),\n        POINT(r.right, r.top),\n        POINT(r.right, r.bottom),\n        POINT(r.left, r.bottom),\n        POINT(r.left, r.top)\n    ].map!(p => POINT(p.x - virtualScreen.left, p.y - virtualScreen.top))).join;\n\n    DWORD[] sizes = uint(5).repeat(pointArrays.length).array;\n\n    SelectObject(deviceContext, borderPen);\n    PolyPolyline(deviceContext, pointArrays.ptr, sizes.ptr, grid.columns * grid.rows);\n\n    SelectObject(deviceContext, mainPen);\n    PolyPolyline(deviceContext, pointArrays.ptr, sizes.ptr, grid.columns * grid.rows);\n\n    if (!gridNavEnabled) return;\n\n    auto oldFont = SelectObject(deviceContext, cast(HGDIOBJ) labelFont);\n    auto oldBrush = SelectObject(deviceContext, GetStockObject(DC_BRUSH));\n    auto oldBkMode = SetBkMode(deviceContext, TRANSPARENT);\n\n    scope(exit)\n    {\n        SelectObject(deviceContext, oldBrush);\n        SelectObject(deviceContext, oldFont);\n        SetBkMode(deviceContext, oldBkMode);\n    }\n\n    SIZE textSize;\n    auto sampleText = \"AA\".toUTF16z;\n    GetTextExtentPoint32(deviceContext, sampleText, 2, &textSize);\n\n    foreach (column; 0 .. grid.columns)\n    {\n        foreach (row; 0 .. grid.rows)\n        {\n            auto cell = cells[column * grid.rows + row];\n            auto centerX = cell.left + cell.width / 2 - virtualScreen.left;\n            auto centerY = cell.top + cell.height / 2 - virtualScreen.top;\n\n            wchar[3] label;\n            label[0] = cast(wchar) ('A' + row);\n            label[1] = cast(wchar) ('A' + column);\n            label[2] = 0;\n\n            auto labelWidth = textSize.cx + 25;\n            auto labelHeight = textSize.cy + 8;\n            auto labelRectangle = RECT(centerX - labelWidth / 2, centerY - labelHeight / 2, centerX + labelWidth / 2, centerY + labelHeight / 2);\n\n            auto rowSelected = gridNavState == GridNavState.column && gridNavRow == row;\n\n            SetDCBrushColor(deviceContext, rowSelected ? RGB(0, 77, 77) : RGB(0, 51, 0));\n            Rectangle(deviceContext, labelRectangle.left, labelRectangle.top, labelRectangle.right, labelRectangle.bottom);\n\n            SetTextColor(deviceContext, rowSelected ? RGB(255, 255, 255) : RGB(204, 204, 204));\n            auto textX = centerX - textSize.cx / 2;\n            auto textY = centerY - textSize.cy / 2;\n            TextOut(deviceContext, textX, textY, label.ptr, 2);\n        }\n    }\n}\n"
  },
  {
    "path": "src/keynavish/helpers.d",
    "content": "module keynavish.helpers;\n\nimport keynavish;\nimport core.sys.windows.windows;\n\nLONG width(RECT rect)\n{\n    return rect.right - rect.left;\n}\n\nLONG height(RECT rect)\n{\n    return rect.bottom - rect.top;\n}\n\nbool contains(RECT rect, POINT point)\n{\n    return point.x >= rect.left && point.x < rect.right &&\n           point.y >= rect.top && point.y < rect.bottom;\n}\n\nstring expandPath(string inputString)\n{\n    import std.process : environment;\n    import std.algorithm : canFind;\n    import std.array : replace;\n\n    if (inputString.canFind('~'))\n    {\n        auto homeDir = environment.get(\"HOME\", environment.get(\"USERPROFILE\"));\n\n        if (homeDir is null)\n        {\n            showWarning(inputString ~ \": USERPROFILE and HOME environment variables both missing, defaulting to working dir for path expansion\");\n            homeDir = \".\";\n        }\n\n        inputString = inputString.replace(\"~\", homeDir);\n    }\n\n    return inputString.replace(\"/\", \"\\\\\");\n}\n\nstring[][] parseCommaDelimitedCommands(string input)\n{\n    import std.csv : csvReader, Malformed;\n    import std.algorithm : map;\n    import std.array : array;\n    import std.string : strip;\n\n    //abusing csvReader so quoted strings are handled properly\n    return input.csvReader!(string, Malformed.ignore).front\n                .map!strip\n                .map!(c => c.csvReader!(string, Malformed.ignore)(' ').front.array)\n                .array;\n}"
  },
  {
    "path": "src/keynavish/keyboardinput.d",
    "content": "module keynavish.keyboardinput;\n\nimport core.sys.windows.windows;\nimport std.typecons : Nullable, BitFlags;\nimport keynavish;\n\nstatic this()\n{\n    registerKeyBinding(\"clear\");\n    registerKeyBinding(\"ctrl+semicolon start\");\n    registerKeyBinding(\"Escape end\");\n    registerKeyBinding(\"ctrl+bracketleft end\");\n    registerKeyBinding(\"q record ~/.keynav_macros\");\n    registerKeyBinding(\"shift+at playback\");\n    registerKeyBinding(\"a history-back\");\n    registerKeyBinding(\"h cut-left\");\n    registerKeyBinding(\"j cut-down\");\n    registerKeyBinding(\"k cut-up\");\n    registerKeyBinding(\"l cut-right\");\n    registerKeyBinding(\"shift+h move-left\");\n    registerKeyBinding(\"shift+j move-down\");\n    registerKeyBinding(\"shift+k move-up\");\n    registerKeyBinding(\"shift+l move-right\");\n    registerKeyBinding(\"space warp,click 1,end\");\n    registerKeyBinding(\"Return warp,click 1,end\");\n    registerKeyBinding(\"semicolon warp,end\");\n    registerKeyBinding(\"w warp\");\n    registerKeyBinding(\"t windowzoom\");\n    registerKeyBinding(\"c cursorzoom 300 300\");\n    registerKeyBinding(\"e end\");\n    registerKeyBinding(\"1 click 1\");\n    registerKeyBinding(\"2 click 2\");\n    registerKeyBinding(\"3 click 3\");\n    registerKeyBinding(\"ctrl+h cut-left\");\n    registerKeyBinding(\"ctrl+j cut-down\");\n    registerKeyBinding(\"ctrl+k cut-up\");\n    registerKeyBinding(\"ctrl+l cut-right\");\n    registerKeyBinding(\"y cut-left,cut-up\");\n    registerKeyBinding(\"u cut-right,cut-up\");\n    registerKeyBinding(\"b cut-left,cut-down\");\n    registerKeyBinding(\"n cut-right,cut-down\");\n    registerKeyBinding(\"shift+y move-left,move-up\");\n    registerKeyBinding(\"shift+u move-right,move-up\");\n    registerKeyBinding(\"shift+b move-left,move-down\");\n    registerKeyBinding(\"shift+n move-right,move-down\");\n    registerKeyBinding(\"ctrl+y cut-left,cut-up\");\n    registerKeyBinding(\"ctrl+u cut-right,cut-up\");\n    registerKeyBinding(\"ctrl+b cut-left,cut-down\");\n    registerKeyBinding(\"ctrl+n cut-right,cut-down\");\n}\n\nenum ModifierKey\n{\n    none   = 0,\n    ctrl   = 1 << 0,\n    shift  = 1 << 1,\n    alt    = 1 << 2,\n    super_ = 1 << 3,\n}\n\nstruct KeyCombination\n{\n    DWORD vkCode;\n    BitFlags!ModifierKey modifiers;\n}\n\nstruct KeyBinding\n{\n    KeyCombination keyCombination;\n    string[][] commands;\n}\n\nKeyBinding[] regularKeyBindings;\nKeyBinding[] startKeyBindings;\n\nvoid registerKeyboardHook()\n{\n    SetWindowsHookEx(WH_KEYBOARD_LL, &exceptionHandlerWrapper!lowLevelKeyboardProc, GetModuleHandle(null), 0);\n}\n\nNullable!KeyBinding parseKeyBindingString(string bindingString)\n{\n    import std.algorithm : findSplit, map, until, startsWith;\n    import std.array : array;\n    import std.format : format;\n    import std.conv : to;\n    import std.string : strip, split;\n\n    //strip comments, whitespace, and stop if string is empty\n    bindingString = bindingString.until('#').to!string.strip;\n    if (bindingString.length == 0)\n    {\n        return typeof(return)();\n    }\n\n    if (bindingString.startsWith(\"daemonize\", \"clear\", \"loadconfig\", \"x-set-delay\"))\n    {\n        auto command = bindingString.parseCommaDelimitedCommands()[0];\n        verifyCommand(command) && processCommand(command);\n        return typeof(return)();\n    }\n\n    auto parts = bindingString.findSplit(\" \");\n\n    string[] keyStrings = parts[0].split('+');\n\n    string[][] commands = parts[2].parseCommaDelimitedCommands();\n\n    auto keyCombination = keyStrings.parseKeyCombination();\n    if (!verifyCommands(commands) || keyCombination.isNull)\n    {\n        return typeof(return)();\n    }\n\n    return typeof(return)(KeyBinding(keyCombination.get(), commands));\n}\n\nNullable!KeyCombination parseKeyCombination(string[] keyStrings)\n{\n    //TODO: Refactor\n    //TODO: Add more keys from X11/keysymdef.h\n\n    KeyCombination combination;\n\n    foreach (keyString; keyStrings)\n    {\n        bool setVkCode(DWORD vkCode)\n        {\n            if (combination.vkCode != 0)\n            {\n                showError(\"More than one non-modifier key given: \" ~ keyString);\n                return false;\n            }\n            combination.vkCode = vkCode;\n            return true;\n        }\n\n        switch (keyString)\n        {\n            case \"ctrl\":\n                combination.modifiers |= ModifierKey.ctrl;\n                break;\n            case \"alt\":\n                combination.modifiers |= ModifierKey.alt;\n                break;\n            case \"shift\":\n                combination.modifiers |= ModifierKey.shift;\n                break;\n            case \"super\":\n                combination.modifiers |= ModifierKey.super_;\n                break;\n            case \"Super_L\":\n                if (!setVkCode(VK_LWIN)) return typeof(return)();\n                break;\n            case \"Super_R\":\n                if (!setVkCode(VK_RWIN)) return typeof(return)();\n                break;\n            case \"semicolon\":\n                if (!setVkCode(VK_OEM_1)) return typeof(return)();\n                break;\n            case \"Escape\":\n                if (!setVkCode(VK_ESCAPE)) return typeof(return)();\n                break;\n            case \"Tab\":\n                if (!setVkCode(VK_TAB)) return typeof(return)();\n                break;\n            case \"Left\":\n                if (!setVkCode(VK_LEFT)) return typeof(return)();\n                break;\n            case \"Up\":\n                if (!setVkCode(VK_UP)) return typeof(return)();\n                break;\n            case \"Right\":\n                if (!setVkCode(VK_RIGHT)) return typeof(return)();\n                break;\n            case \"Down\":\n                if (!setVkCode(VK_DOWN)) return typeof(return)();\n                break;\n            case \"Insert\":\n                if (!setVkCode(VK_INSERT)) return typeof(return)();\n                break;\n            case \"Home\":\n                if (!setVkCode(VK_HOME)) return typeof(return)();\n                break;\n            case \"End\":\n                if (!setVkCode(VK_END)) return typeof(return)();\n                break;\n            case \"Prior\":\n            case \"Page_Up\":\n                if (!setVkCode(VK_PRIOR)) return typeof(return)();\n                break;\n            case \"Next\":\n            case \"Page_Down\":\n                if (!setVkCode(VK_NEXT)) return typeof(return)();\n                break;\n            case \"Delete\":\n                if (!setVkCode(VK_DELETE)) return typeof(return)();\n                break;\n            case \"Return\":\n                if (!setVkCode(VK_RETURN)) return typeof(return)();\n                break;\n            case \"space\":\n                if (!setVkCode(VK_SPACE)) return typeof(return)();\n                break;\n            case \"bracketleft\":\n                if (!setVkCode(VK_OEM_4)) return typeof(return)();\n                break;\n            case \"backslash\":\n                if (!setVkCode(VK_OEM_5)) return typeof(return)();\n                break;\n            case \"bracketright\":\n                if (!setVkCode(VK_OEM_6)) return typeof(return)();\n                break;\n            case \"at\":\n                //HACK: This doesn't have its own vkcode on Windows, but on X11 it has its own keysym\n                if (!setVkCode('2')) return typeof(return)();\n                break;\n            case \"plus\":\n                if (!setVkCode(VK_OEM_PLUS)) return typeof(return)();\n                break;\n            case \"comma\":\n                if (!setVkCode(VK_OEM_COMMA)) return typeof(return)();\n                break;\n            case \"minus\":\n                if (!setVkCode(VK_OEM_MINUS)) return typeof(return)();\n                break;\n            case \"period\":\n                if (!setVkCode(VK_OEM_PERIOD)) return typeof(return)();\n                break;\n            case \"a\":\n            case \"b\":\n            case \"c\":\n            case \"d\":\n            case \"e\":\n            case \"f\":\n            case \"g\":\n            case \"h\":\n            case \"i\":\n            case \"j\":\n            case \"k\":\n            case \"l\":\n            case \"m\":\n            case \"n\":\n            case \"o\":\n            case \"p\":\n            case \"q\":\n            case \"r\":\n            case \"s\":\n            case \"t\":\n            case \"u\":\n            case \"v\":\n            case \"w\":\n            case \"x\":\n            case \"y\":\n            case \"z\":\n                if(!setVkCode('A' + (keyString[0] - 'a'))) return typeof(return)();\n                break;\n            case \"0\":\n            case \"1\":\n            case \"2\":\n            case \"3\":\n            case \"4\":\n            case \"5\":\n            case \"6\":\n            case \"7\":\n            case \"8\":\n            case \"9\":\n                if (!setVkCode(keyString[0])) return typeof(return)();\n                break;\n            case \"KP_0\":\n            case \"KP_1\":\n            case \"KP_2\":\n            case \"KP_3\":\n            case \"KP_4\":\n            case \"KP_5\":\n            case \"KP_6\":\n            case \"KP_7\":\n            case \"KP_8\":\n            case \"KP_9\":\n                if (!setVkCode(0x60 + keyString[3] - '0')) return typeof(return)();\n                break;\n            default:\n                showError(\"Unknown key: \" ~ keyString);\n                return typeof(return)();\n        }\n    }\n\n    return typeof(return)(combination);\n}\n\nbool registerKeyBinding(string bindingString)\n{\n    import std.algorithm : find;\n    import std.range : empty;\n\n    auto nullableKeyBinding = bindingString.parseKeyBindingString();\n    if (nullableKeyBinding.isNull)\n    {\n        return false;\n    }\n    auto keyBinding = nullableKeyBinding.get();\n\n    if (keyBinding.commands[0][0] == \"start\")\n    {\n        startKeyBindings ~= keyBinding;\n    }\n    else\n    {\n        auto originalBinding = regularKeyBindings.find!(b => b.keyCombination == keyBinding.keyCombination);\n        if (!originalBinding.empty)\n        {\n            originalBinding[0] = keyBinding;\n        }\n        else\n        {\n            regularKeyBindings ~= keyBinding;\n        }\n\n        if (keyBinding.commands[0][0] == \"toggle-start\")\n        {\n            startKeyBindings ~= keyBinding;\n        }\n    }\n\n    return true;\n}\n\nextern(Windows)\nLRESULT lowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)\n{\n    import std.algorithm : find;\n    import std.ascii : toLower;\n    import std.conv : to;\n    import std.range : empty;\n\n    auto hookStruct = cast(PKBDLLHOOKSTRUCT) lParam;\n\n    bool handleGridNavKey(DWORD vkCode, BitFlags!ModifierKey modifiers)\n    {\n        import core.sys.windows.windows : VK_ESCAPE;\n\n        if (!gridNavEnabled)\n        {\n            return false;\n        }\n\n        if (vkCode == VK_ESCAPE)\n        {\n            enableGridNav(false);\n            redrawWindow();\n            return true;\n        }\n\n        if (modifiers || vkCode < 'A' || vkCode > 'Z')\n        {\n            return false;\n        }\n\n        auto value = toLower(cast(char) vkCode) - 'a';\n\n        if (gridNavState == GridNavState.row)\n        {\n            if (value >= grid.rows)\n            {\n                return false;\n            }\n\n            gridNavRow = value;\n            gridNavState = GridNavState.column;\n            redrawWindow();\n            return true;\n        }\n\n        if (value >= grid.columns)\n        {\n            return false;\n        }\n\n        gridNavColumn = value;\n        cellSelect((gridNavColumn + 1).to!string ~ \"x\" ~ (gridNavRow + 1).to!string);\n        resetGridNavSelection();\n        redrawWindow();\n        return true;\n    }\n\n    if (nCode == HC_ACTION)\n    {\n        switch (wParam)\n        {\n            case WM_KEYDOWN:\n            case WM_SYSKEYDOWN:\n                BitFlags!ModifierKey modifiers = ModifierKey.none;\n                modifiers |= (GetKeyState(VK_CONTROL) & 0x8000) != 0 ? ModifierKey.ctrl : ModifierKey.none;\n                modifiers |= (GetKeyState(VK_SHIFT  ) & 0x8000) != 0 ? ModifierKey.shift : ModifierKey.none;\n                modifiers |= (hookStruct.flags & LLKHF_ALTDOWN) != 0 ? ModifierKey.alt : ModifierKey.none;\n                modifiers |= ((GetKeyState(VK_LWIN) & 0x8000) | (GetKeyState(VK_RWIN) & 0x8000)) != 0 ? ModifierKey.super_ : ModifierKey.none;\n\n                auto pressedCombination = KeyCombination(hookStruct.vkCode, modifiers);\n\n                if (!active)\n                {\n                    auto keyBindingRange = startKeyBindings.find!(b => b.keyCombination == pressedCombination);\n                    if (!keyBindingRange.empty)\n                    {\n                        processCommands(keyBindingRange[0].commands);\n                        return 1;\n                    }\n                    else\n                    {\n                        return CallNextHookEx(null, nCode, wParam, lParam);\n                    }\n                }\n                else\n                {\n                    if (waitingForRecordingKey)\n                    {\n                        setRecordingKey(hookStruct.vkCode);\n                    }\n                    else if (replaying)\n                    {\n                        replay(hookStruct.vkCode);\n                    }\n                    else if (handleGridNavKey(hookStruct.vkCode, modifiers))\n                    {\n                        return 1;\n                    }\n                    else\n                    {\n                        auto keyBindingRange = regularKeyBindings.find!(b => b.keyCombination == pressedCombination);\n                        if (!keyBindingRange.empty)\n                        {\n                            if (recordingActive)\n                            {\n                                recordCommands(keyBindingRange[0].commands);\n                            }\n                            processCommands(keyBindingRange[0].commands);\n                        }\n                    }\n\n                    return ((hookStruct.vkCode >= VK_LSHIFT && hookStruct.vkCode <= VK_RCONTROL) || hookStruct.vkCode == VK_LWIN || hookStruct.vkCode == VK_RWIN)\n                        ? CallNextHookEx(null, nCode, wParam, lParam)\n                        : 1;\n                }\n            default:\n                break;\n        }\n    }\n\n    return CallNextHookEx(null, nCode, wParam, lParam);\n}\n"
  },
  {
    "path": "src/keynavish/main.d",
    "content": "module keynavish.main;\n\nimport core.sys.windows.windows;\nstatic import std.getopt;\nimport keynavish;\n\nalias extern(C) int function(string[] args) MainFunc;\nextern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc);\n\nint WinMain_(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\n{\n    import std.algorithm : map;\n    import std.conv : to;\n    import std.array : array;\n    import std.string : fromStringz;\n\n    int argCount;\n    wchar** wideArgs = CommandLineToArgvW(GetCommandLine(), &argCount);\n    char** args = wideArgs[0 .. argCount].map!(cs => cs.fromStringz.to!(char[]).ptr).array.ptr;\n\n    return _d_run_main(argCount, args, &_main);\n}\n\nextern(Windows)\nint WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\n{\n    return exceptionHandlerWrapper!WinMain_(hInstance, hPrevInstance, lpCmdLine, nCmdShow);\n}\n\nstatic this()\n{\n    import core.sys.windows.windows : CreateFont, CreatePen, FW_BOLD, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, FF_MODERN, DEFAULT_CHARSET, PS_SOLID;\n\n    registerWindowClass();\n    registerKeyboardHook();\n\n    mainPen = CreatePen(PS_SOLID, mainPenWidth, mainPenColour);\n    borderPen = CreatePen(PS_SOLID, borderPenWidth * 2 + mainPenWidth, borderPenColour);\n    labelFont = CreateFont(18, 0, 0, 0, FW_BOLD, false, false, false, DEFAULT_CHARSET,\n                           OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,\n                           FIXED_PITCH | FF_MODERN, \"Courier New\"w.ptr);\n}\n\nextern(C)\nint _main(string[] args)\n{\n    loadAllConfigs();\n\n    if (handleArgsAndContinue(args))\n    {\n        createWindow();\n\n        resetGrid();\n\n        addNotifyIcon();\n\n        messageLoop();\n\n        removeNotifyIcon();\n    }\n\n    return 0;\n}\n\nbool handleArgsAndContinue(string[] args)\n{\n    import std.getopt;\n    import std.algorithm : canFind;\n\n    bool printVersion;\n    auto getoptResult = getopt(args, config.passThrough, \"version|V\", \"Program version information.\", &printVersion);\n    printVersion = printVersion || args.canFind(\"version\");\n\n    if (printVersion)\n    {\n        showVersion();\n        return false;\n    }\n    else if (getoptResult.helpWanted || args.length > 2)\n    {\n        showHelp(getoptResult.options);\n        return false;\n    }\n    else\n    {\n        if (args.length == 2)\n        {\n            auto commands = args[1].parseCommaDelimitedCommands();\n            verifyCommands(commands) && processCommands(commands);\n        }\n        return true;\n    }\n}\n\nvoid showHelp(std.getopt.Option[] getoptOptions)\n{\n    import std.getopt : defaultGetoptFormatter;\n    import std.array : appender;\n    import std.conv : to;\n\n    auto helpAppender = appender!(char[]);\n    defaultGetoptFormatter(helpAppender, (programInfo ~ \"\\r\\n\\r\\n\"w ~ usageHelpString).to!string, getoptOptions);\n\n    showInfo(helpAppender[]);\n}\n\nvoid showVersion()\n{\n    showInfo(programName ~ \" \" ~ gitVersion);\n}\n\nvoid messageLoop()\n{\n    MSG msg;\n    while (GetMessage(&msg, null, 0, 0) && !quitting)\n    {\n        DispatchMessage(&msg);\n    }\n}\n"
  },
  {
    "path": "src/keynavish/notifyicon.d",
    "content": "module keynavish.notifyicon;\n\nimport keynavish;\n\nimport core.sys.windows.windows;\n\nNOTIFYICONDATA notifyIconData;\nHMENU popupMenu;\nHKEY registryKey;\n\n//TODO: Error handling\n\nvoid addNotifyIcon()\n{\n    auto icon = LoadIcon(LoadLibrary(\"main.cpl\"), MAKEINTRESOURCE(108));\n\n    notifyIconData.uVersion = 0;\n    notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;\n    notifyIconData.hWnd = windowHandle;\n    notifyIconData.szTip = programName;\n    notifyIconData.hIcon = icon;\n    notifyIconData.uCallbackMessage = WM_USER;\n\n    Shell_NotifyIcon(NIM_ADD, &notifyIconData);\n\n    openRegistryKey();\n}\n\nvoid removeNotifyIcon()\n{\n    Shell_NotifyIcon(NIM_DELETE, &notifyIconData);\n}\n\nvoid handleNotifyIconMessage(WPARAM wParam, LPARAM lParam)\n{\n    if (lParam == WM_RBUTTONUP || lParam == WM_LBUTTONUP)\n    {\n        POINT cursorPosition;\n        GetCursorPos(&cursorPosition);\n\n        SetForegroundWindow(windowHandle);\n        createPopUpMenu();\n\n        auto alignment = GetSystemMetrics(SM_MENUDROPALIGNMENT) != 0 ? TPM_RIGHTALIGN : TPM_LEFTALIGN;\n        auto command = cast(MenuItem) TrackPopupMenu(popupMenu,\n                                                     alignment | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,\n                                                     cursorPosition.x,\n                                                     cursorPosition.y,\n                                                     0,\n                                                     windowHandle,\n                                                     null);\n\n        handleCommand(command);\n    }\n}\n\nvoid handleCommand(MenuItem menuItem)\n{\n    final switch (menuItem) with (MenuItem)\n    {\n        case Help:\n            ShellExecute(null, \"open\", programUrl, null, null, SW_SHOWNORMAL);\n            break;\n        case ToggleLaunchOnStartup:\n            toggleLaunchValue();\n            break;\n        case EditConfigFile:\n            editConfigFile();\n            break;\n        case ReloadConfig:\n            loadAllConfigs();\n            break;\n        case About:\n            showInfo(programInfo);\n            break;\n        case Restart:\n            restart();\n            break;\n        case Exit:\n            PostQuitMessage(0);\n            break;\n        case None:\n            break;\n    }\n}\n\nenum MenuItem\n{\n    None,\n    Help,\n    ToggleLaunchOnStartup,\n    EditConfigFile,\n    ReloadConfig,\n    About,\n    Restart,\n    Exit\n}\n\nvoid createPopUpMenu()\n{\n    import std.format : format;\n    import std.utf : toUTF16z;\n\n    if (popupMenu)\n    {\n        DestroyMenu(popupMenu);\n    }\n\n    popupMenu = CreatePopupMenu();\n\n    void addSeparator()\n    {\n        InsertMenu(popupMenu, -1, MF_BYPOSITION | MF_SEPARATOR, 0, null);\n    }\n\n    void addStringItem(alias formatString, MenuItem menuItem, Args...)(Args args)\n    {\n        InsertMenu(popupMenu, -1, MF_BYPOSITION | MF_STRING, menuItem, format!formatString(args).toUTF16z);\n    }\n\n    void addCheckboxItem(alias formatString, MenuItem menuItem, Args...)(bool checked, Args args)\n    {\n        InsertMenu(popupMenu, -1, MF_BYPOSITION | (checked ? MF_CHECKED : MF_UNCHECKED), menuItem, format!formatString(args).toUTF16z);\n    }\n\n    addStringItem!(\"About %s (%s)...\", MenuItem.About)(programName, gitVersion);\n    addStringItem!(\"Home page\", MenuItem.Help);\n    addSeparator();\n    addCheckboxItem!(\"Launch %s on startup\", MenuItem.ToggleLaunchOnStartup)(launchValueExists, programName);\n    addStringItem!(\"Edit config file\", MenuItem.EditConfigFile);\n    addStringItem!(\"Reload configuration\", MenuItem.ReloadConfig);\n    addSeparator();\n    addStringItem!(\"Restart %s\", MenuItem.Restart)(programName);\n    addStringItem!(\"Exit\", MenuItem.Exit);\n}\n\nvoid openRegistryKey()\n{\n    auto result = RegOpenKeyEx(HKEY_CURRENT_USER, \"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\", 0, KEY_READ | KEY_SET_VALUE, &registryKey);\n    assert(result == ERROR_SUCCESS);\n}\n\nbool launchValueExists()\n{\n    return RegQueryValueExW(registryKey, programName.ptr, null, null, null, null) != ERROR_FILE_NOT_FOUND;\n}\n\nvoid toggleLaunchValue()\n{\n    import core.runtime : Runtime;\n    import std.algorithm : map;\n    import std.string : join;\n    import std.conv : to;\n    import std.utf : toUTF16z;\n\n    if (launchValueExists)\n    {\n        RegDeleteValue(registryKey, programName.ptr);\n    }\n    else\n    {\n        //HACK: We should properly quote the strings when necessary\n        auto launchValue = Runtime.args.map!(s => '\"' ~ s ~ '\"').join(' ');\n\n        RegSetValueEx(registryKey, programName.ptr, 0, REG_SZ, cast(ubyte*) launchValue.toUTF16z, cast(uint) (launchValue.length * wchar.sizeof));\n    }\n}\n\nvoid editConfigFile()\n{\n    import std.file : exists, write;\n    import std.range : empty;\n    import std.algorithm : map, find;\n    import std.utf : toUTF16z;\n    import std.format : format;\n\n    string path;\n\n    auto configFileRange = configFilePaths.map!expandPath.find!exists;\n    if (configFileRange.empty)\n    {\n        path = configFilePaths[0].expandPath;\n\n        auto result = MessageBox(null,\n                                 format!\"No config file found, one will be created at %s. Would you like to use an example config?\"(path).toUTF16z,\n                                 programName.ptr,\n                                 MB_YESNOCANCEL);\n        if (result == IDCANCEL)\n        {\n            return;\n        }\n        else if (result == IDYES)\n        {\n            write(path, import(\"keynavrc\"));\n        }\n        else if (result == IDNO)\n        {\n            write(path, []);\n        }\n        else\n        {\n            assert(false);\n        }\n    }\n    else\n    {\n        path = configFileRange[0];\n    }\n\n    ShellExecute(null, \"open\", path.toUTF16z, null, null, SW_SHOWNORMAL);\n}"
  },
  {
    "path": "src/keynavish/package.d",
    "content": "module keynavish;\n\npublic import keynavish.versioninfo;\npublic import keynavish.config;\n\npublic import keynavish.errorhandling;\npublic import keynavish.helpers;\n\npublic import keynavish.commands;\npublic import keynavish.grid;\npublic import keynavish.keyboardinput;\npublic import keynavish.window;\npublic import keynavish.recording;\npublic import keynavish.notifyicon;"
  },
  {
    "path": "src/keynavish/recording.d",
    "content": "module keynavish.recording;\n\nimport keynavish;\n\nimport core.sys.windows.windows : DWORD;\n\nstruct Recording\n{\n    DWORD vkCode;\n    string[][] commands;\n    string path;\n\n    string toString()\n    {\n        import std.algorithm : map;\n        import std.string : join;\n        import std.format : format;\n\n        return format!\"%d %s\\r\\n\"(vkCode, commands.map!(c => c.join(' ')).join(\", \"));\n    }\n}\n\nRecording[] recordings;\n\nbool waitingForRecordingKey;\nRecording activeRecording;\n\nbool replaying;\n\nbool recordingActive()\n{\n    return activeRecording.vkCode != 0;\n}\n\nvoid loadRecordings()\n{\n    import std.algorithm : map, filter, joiner, splitter, findSplit, find;\n    import std.file : exists, readText;\n    import std.conv : to;\n    import std.array : replace, array;\n    import std.string : strip;\n    import std.format : format;\n    import std.range : empty;\n\n    foreach (path; regularKeyBindings.map!(b => b.commands)\n                                        .joiner\n                                        .filter!(c => c[0] == \"record\" && c.length == 2)\n                                        .map!(c => expandPath(c[1]))\n                                        .filter!(p => p.exists))\n    {\n        foreach (line; path.readText.replace('\\r', \"\").splitter('\\n'))\n        {\n            auto parts = line.findSplit(\" \");\n\n            if (parts[0].length == 0)\n                continue;\n\n            auto vkCode = parts[0].to!DWORD;\n\n            auto commands = parts[2].parseCommaDelimitedCommands();\n\n            auto recording = Recording(vkCode, commands, path);\n            auto recordingRange = recordings.find!(r => r.vkCode == vkCode);\n            if (!recordingRange.empty)\n            {\n                showWarning(format!\"More than one recording found for key code '%d', last one will be used!\"(vkCode));\n                recordingRange[0] = recording;\n            }\n            else\n            {\n                recordings ~= recording;\n            }\n        }\n    }\n}\n\nvoid startReplaying()\n{\n    replaying = true;\n}\n\nvoid replay(DWORD vkCode)\n{\n    import std.algorithm : find;\n    import std.range : empty;\n    import std.format : format;\n\n    auto recordingRange = recordings.find!(r => r.vkCode == vkCode);\n    if (recordingRange.empty)\n    {\n        showWarning(format!\"No recording found for key code '%d'!\"(vkCode));\n    }\n    else\n    {\n        processCommands(recordingRange[0].commands);\n    }\n\n    replaying = false;\n}\n\nvoid startRecording(string path)\n{\n    waitingForRecordingKey = true;\n\n    activeRecording.path = path.expandPath;\n}\n\nvoid stopRecording()\n{\n    import std.algorithm : find, filter, map;\n    import std.range: empty;\n    import std.array : join;\n    import std.file : write, exists;\n    import std.path : dirName;\n\n    auto recordingRange = recordings.find!(r => r.vkCode == activeRecording.vkCode);\n    if (recordingRange.empty)\n    {\n        recordings ~= activeRecording;\n    }\n    else\n    {\n        recordingRange[0] = activeRecording;\n    }\n\n    if (activeRecording.path != null)\n    {\n        auto recordingText = recordings.filter!(r => r.path == activeRecording.path).map!(r => r.toString).join;\n\n        if (!activeRecording.path.dirName.exists)\n        {\n            showError(\"Can't save recording, parent dir doesn't exist: \" ~ activeRecording.path.dirName);\n        }\n        else\n        {\n            activeRecording.path.write(recordingText);\n        }\n    }\n\n    activeRecording = Recording();\n}\n\nvoid setRecordingKey(DWORD vkCode)\n{\n    activeRecording.vkCode = vkCode;\n\n    waitingForRecordingKey = false;\n}\n\nvoid recordCommands(string[][] commands)\n{\n    foreach (command; commands)\n    {\n        if (command[0] == \"record\")\n        {\n            break;\n        }\n\n        activeRecording.commands ~= command;\n    }\n}"
  },
  {
    "path": "src/keynavish/window.d",
    "content": "module keynavish.window;\n\nimport core.sys.windows.windows;\nimport keynavish;\n\nHWND windowHandle;\n\nbool active;\nbool quitting;\n\nUINT taskbarCreatedMessage;\n\nvoid registerWindowClass()\n{\n    WNDCLASSEX windowsClassEx;\n    windowsClassEx.style = CS_HREDRAW | CS_VREDRAW;\n    windowsClassEx.lpfnWndProc = &exceptionHandlerWrapper!windowProc;\n    windowsClassEx.hInstance = GetModuleHandle(null);\n    windowsClassEx.hbrBackground = CreateSolidBrush(windowColourKey);\n    windowsClassEx.lpszClassName = windowClassName.ptr;\n\n    RegisterClassEx(&windowsClassEx);\n}\n\nvoid createWindow()\n{\n    auto resolution = virtualScreenRectangle;\n\n    windowHandle = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_TOPMOST,\n                                  windowClassName.ptr,\n                                  programName.ptr,\n                                  WS_POPUP,\n                                  0,\n                                  0,\n                                  resolution.width,\n                                  resolution.height,\n                                  null,\n                                  null,\n                                  GetModuleHandle(null),\n                                  null);\n\n    SetLayeredWindowAttributes(windowHandle, windowColourKey, 0, LWA_COLORKEY);\n    SetWindowPos(windowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);\n}\n\nvoid showWindow()\n{\n    active = true;\n\n    ShowWindow(windowHandle, SW_SHOW);\n    UpdateWindow(windowHandle);\n}\n\nvoid hideWindow()\n{\n    active = false;\n\n    ShowWindow(windowHandle, SW_HIDE);\n    UpdateWindow(windowHandle);\n}\n\nextern(Windows)\nLRESULT windowProc(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    assert(handle == windowHandle || windowHandle == null);\n\n    switch (message)\n    {\n        case WM_CREATE:\n            taskbarCreatedMessage = RegisterWindowMessage(\"TaskbarCreated\");\n            goto default;\n        case WM_PAINT:\n            PAINTSTRUCT ps;\n            auto deviceContext = BeginPaint(handle, &ps);\n            paintGrid(deviceContext);\n            EndPaint(handle, &ps);\n            break;\n        case WM_DESTROY:\n        case WM_QUIT:\n            quitting = true;\n            break;\n        case WM_USER:\n            handleNotifyIconMessage(wParam, lParam);\n            break;\n        default:\n            if (message == taskbarCreatedMessage)\n            {\n                removeNotifyIcon();\n                addNotifyIcon();\n            }\n\n            return DefWindowProc(handle, message, wParam, lParam);\n    }\n    return 0;\n}\n"
  },
  {
    "path": "tools/LICENSE.LLVM",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n    1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n    2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n    3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n    4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n    5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n    6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n    7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n    8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n    9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n    END OF TERMS AND CONDITIONS\n\n    APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n    Copyright [yyyy] [name of copyright owner]\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n--- LLVM Exceptions to the Apache 2.0 License ----\n\nAs an exception, if, as a result of your compiling your source code, portions\nof this Software are embedded into an Object form of such source code, you\nmay redistribute such embedded portions in such Object form without complying\nwith the conditions of Sections 4(a), 4(b) and 4(d) of the License.\n\nIn addition, if you combine or link compiled forms of this Software with\nsoftware that is licensed under the GPLv2 (\"Combined Software\") and if a\ncourt of competent jurisdiction determines that the patent provision (Section\n3), the indemnity provision (Section 9) or other Section of the License\nconflicts with the conditions of the GPLv2, you may retroactively and\nprospectively choose to deem waived or otherwise exclude such Section(s) of\nthe License, but only in their entirety and only with respect to the Combined\nSoftware.\n\n"
  },
  {
    "path": "tools/README.md",
    "content": "# Tools\n\nThis directory contains tools required for building the project.\n\n## llvm-rc.exe\n\nThis tool is used to compile .rc files to .res, and is part of the LLVM\nProject, which is under the [Apache License v2.0 with LLVM\nExceptions](./LICENSE.LLVM).\n"
  }
]