├── .gitignore ├── LICENSE ├── Noo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── Debug.xcscheme │ └── Release.xcscheme ├── Noo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── 1024.png │ │ ├── 128.png │ │ ├── 16.png │ │ ├── 256.png │ │ ├── 32.png │ │ ├── 512.png │ │ ├── 64.png │ │ └── Contents.json ├── Config.swift ├── EventLoop.swift ├── Info.plist ├── Noo.entitlements ├── NooCGEvent.swift ├── SettingsViewController.swift ├── ShortcutEditor.swift ├── fonts │ └── FontAwesome-Solid.otf └── main.swift ├── NooTests ├── EventLoopEventCallBackTests.swift ├── EventLoopRespondToTests.swift ├── EventLoopTriggerTests.swift ├── Info.plist └── Mocks.swift ├── NooUITests ├── Info.plist └── NooUITests.swift ├── PRIVACY_POLICY ├── README.md ├── download-button.svg ├── originalicon.png └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Gcc Patch 26 | /*.gcno 27 | 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 2021 Tanin Na Nakorn 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Noo Copyright (C) 2021 Tanin Na Nakorn 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Noo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F32C935E24778484007B1F26 /* NooCGEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32C935D24778484007B1F26 /* NooCGEvent.swift */; }; 11 | F3383A6A23BD42A000EECE6C /* FontAwesome-Solid.otf in Resources */ = {isa = PBXBuildFile; fileRef = F3383A6923BD42A000EECE6C /* FontAwesome-Solid.otf */; }; 12 | F377AF9324739FB600175F1A /* EventLoopTriggerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F377AF9224739FB600175F1A /* EventLoopTriggerTests.swift */; }; 13 | F3832BE72471C1FE00ACF791 /* ShortcutEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3832BE62471C1FE00ACF791 /* ShortcutEditor.swift */; }; 14 | F3832BE92472096A00ACF791 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3832BE82472096A00ACF791 /* Config.swift */; }; 15 | F3AE0C7D245936F1005C7FEF /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3AE0C7B245936F1005C7FEF /* SettingsViewController.swift */; }; 16 | F3B80EA124566276007431E6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B80EA024566276007431E6 /* AppDelegate.swift */; }; 17 | F3B80EA3245662E0007431E6 /* EventLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B80EA2245662E0007431E6 /* EventLoop.swift */; }; 18 | F3B80EA724567AA6007431E6 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B80EA624567AA6007431E6 /* main.swift */; }; 19 | F3E29B652478C93A0098AE9A /* EventLoopRespondToTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E29B642478C93A0098AE9A /* EventLoopRespondToTests.swift */; }; 20 | F3E29B672478CA4C0098AE9A /* EventLoopEventCallBackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E29B662478CA4C0098AE9A /* EventLoopEventCallBackTests.swift */; }; 21 | F3E29B692478CCC40098AE9A /* Mocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E29B682478CCC40098AE9A /* Mocks.swift */; }; 22 | F3E29B6B2478E8A50098AE9A /* NooUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E29B6A2478E8A50098AE9A /* NooUITests.swift */; }; 23 | F3E29B6E2479D2460098AE9A /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3832BE82472096A00ACF791 /* Config.swift */; }; 24 | F3E29B732479EC2F0098AE9A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3E29B722479EC2F0098AE9A /* Assets.xcassets */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | F3383A4A23BD172B00EECE6C /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = F3383A2E23BD172A00EECE6C /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = F3383A3523BD172A00EECE6C; 33 | remoteInfo = mouse; 34 | }; 35 | F3383A5523BD172B00EECE6C /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = F3383A2E23BD172A00EECE6C /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = F3383A3523BD172A00EECE6C; 40 | remoteInfo = mouse; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | F32C935D24778484007B1F26 /* NooCGEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NooCGEvent.swift; sourceTree = ""; }; 46 | F3383A3623BD172A00EECE6C /* Noo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Noo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | F3383A3C23BD172A00EECE6C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | F3383A4123BD172B00EECE6C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | F3383A4423BD172B00EECE6C /* Noo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Noo.entitlements; sourceTree = ""; }; 50 | F3383A4923BD172B00EECE6C /* NooTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NooTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | F3383A4F23BD172B00EECE6C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | F3383A5423BD172B00EECE6C /* NooUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NooUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | F3383A5A23BD172B00EECE6C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | F3383A6923BD42A000EECE6C /* FontAwesome-Solid.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "FontAwesome-Solid.otf"; sourceTree = ""; }; 55 | F377AF9224739FB600175F1A /* EventLoopTriggerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLoopTriggerTests.swift; sourceTree = ""; }; 56 | F3832BE62471C1FE00ACF791 /* ShortcutEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutEditor.swift; sourceTree = ""; }; 57 | F3832BE82472096A00ACF791 /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; 58 | F3AE0C7B245936F1005C7FEF /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 59 | F3B80EA024566276007431E6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 60 | F3B80EA2245662E0007431E6 /* EventLoop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLoop.swift; sourceTree = ""; }; 61 | F3B80EA624567AA6007431E6 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 62 | F3E29B642478C93A0098AE9A /* EventLoopRespondToTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLoopRespondToTests.swift; sourceTree = ""; }; 63 | F3E29B662478CA4C0098AE9A /* EventLoopEventCallBackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLoopEventCallBackTests.swift; sourceTree = ""; }; 64 | F3E29B682478CCC40098AE9A /* Mocks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mocks.swift; sourceTree = ""; }; 65 | F3E29B6A2478E8A50098AE9A /* NooUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NooUITests.swift; sourceTree = ""; }; 66 | F3E29B722479EC2F0098AE9A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | F3383A3323BD172A00EECE6C /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | F3383A4623BD172B00EECE6C /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | F3383A5123BD172B00EECE6C /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | F3383A2D23BD172A00EECE6C = { 95 | isa = PBXGroup; 96 | children = ( 97 | F3383A3823BD172A00EECE6C /* Noo */, 98 | F3383A4C23BD172B00EECE6C /* NooTests */, 99 | F3383A5723BD172B00EECE6C /* NooUITests */, 100 | F3383A3723BD172A00EECE6C /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | F3383A3723BD172A00EECE6C /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | F3383A3623BD172A00EECE6C /* Noo.app */, 108 | F3383A4923BD172B00EECE6C /* NooTests.xctest */, 109 | F3383A5423BD172B00EECE6C /* NooUITests.xctest */, 110 | ); 111 | name = Products; 112 | sourceTree = ""; 113 | }; 114 | F3383A3823BD172A00EECE6C /* Noo */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | F3E29B722479EC2F0098AE9A /* Assets.xcassets */, 118 | F3383A6623BD3FBD00EECE6C /* fonts */, 119 | F3B80EA024566276007431E6 /* AppDelegate.swift */, 120 | F3B80EA2245662E0007431E6 /* EventLoop.swift */, 121 | F3383A3C23BD172A00EECE6C /* Assets.xcassets */, 122 | F3383A4123BD172B00EECE6C /* Info.plist */, 123 | F3383A4423BD172B00EECE6C /* Noo.entitlements */, 124 | F3B80EA624567AA6007431E6 /* main.swift */, 125 | F3AE0C7B245936F1005C7FEF /* SettingsViewController.swift */, 126 | F3832BE62471C1FE00ACF791 /* ShortcutEditor.swift */, 127 | F3832BE82472096A00ACF791 /* Config.swift */, 128 | F32C935D24778484007B1F26 /* NooCGEvent.swift */, 129 | ); 130 | path = Noo; 131 | sourceTree = ""; 132 | }; 133 | F3383A4C23BD172B00EECE6C /* NooTests */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | F3383A4F23BD172B00EECE6C /* Info.plist */, 137 | F377AF9224739FB600175F1A /* EventLoopTriggerTests.swift */, 138 | F3E29B642478C93A0098AE9A /* EventLoopRespondToTests.swift */, 139 | F3E29B662478CA4C0098AE9A /* EventLoopEventCallBackTests.swift */, 140 | F3E29B682478CCC40098AE9A /* Mocks.swift */, 141 | ); 142 | path = NooTests; 143 | sourceTree = ""; 144 | }; 145 | F3383A5723BD172B00EECE6C /* NooUITests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | F3383A5A23BD172B00EECE6C /* Info.plist */, 149 | F3E29B6A2478E8A50098AE9A /* NooUITests.swift */, 150 | ); 151 | path = NooUITests; 152 | sourceTree = ""; 153 | }; 154 | F3383A6623BD3FBD00EECE6C /* fonts */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | F3383A6923BD42A000EECE6C /* FontAwesome-Solid.otf */, 158 | ); 159 | path = fonts; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXGroup section */ 163 | 164 | /* Begin PBXNativeTarget section */ 165 | F3383A3523BD172A00EECE6C /* Noo */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = F3383A5D23BD172B00EECE6C /* Build configuration list for PBXNativeTarget "Noo" */; 168 | buildPhases = ( 169 | F3383A3223BD172A00EECE6C /* Sources */, 170 | F3383A3323BD172A00EECE6C /* Frameworks */, 171 | F3383A3423BD172A00EECE6C /* Resources */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | ); 177 | name = Noo; 178 | productName = mouse; 179 | productReference = F3383A3623BD172A00EECE6C /* Noo.app */; 180 | productType = "com.apple.product-type.application"; 181 | }; 182 | F3383A4823BD172B00EECE6C /* NooTests */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = F3383A6023BD172B00EECE6C /* Build configuration list for PBXNativeTarget "NooTests" */; 185 | buildPhases = ( 186 | F3383A4523BD172B00EECE6C /* Sources */, 187 | F3383A4623BD172B00EECE6C /* Frameworks */, 188 | F3383A4723BD172B00EECE6C /* Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | F3383A4B23BD172B00EECE6C /* PBXTargetDependency */, 194 | ); 195 | name = NooTests; 196 | productName = mouseTests; 197 | productReference = F3383A4923BD172B00EECE6C /* NooTests.xctest */; 198 | productType = "com.apple.product-type.bundle.unit-test"; 199 | }; 200 | F3383A5323BD172B00EECE6C /* NooUITests */ = { 201 | isa = PBXNativeTarget; 202 | buildConfigurationList = F3383A6323BD172B00EECE6C /* Build configuration list for PBXNativeTarget "NooUITests" */; 203 | buildPhases = ( 204 | F3383A5023BD172B00EECE6C /* Sources */, 205 | F3383A5123BD172B00EECE6C /* Frameworks */, 206 | F3383A5223BD172B00EECE6C /* Resources */, 207 | ); 208 | buildRules = ( 209 | ); 210 | dependencies = ( 211 | F3383A5623BD172B00EECE6C /* PBXTargetDependency */, 212 | ); 213 | name = NooUITests; 214 | productName = mouseUITests; 215 | productReference = F3383A5423BD172B00EECE6C /* NooUITests.xctest */; 216 | productType = "com.apple.product-type.bundle.ui-testing"; 217 | }; 218 | /* End PBXNativeTarget section */ 219 | 220 | /* Begin PBXProject section */ 221 | F3383A2E23BD172A00EECE6C /* Project object */ = { 222 | isa = PBXProject; 223 | attributes = { 224 | BuildIndependentTargetsInParallel = YES; 225 | LastUpgradeCheck = 1520; 226 | ORGANIZATIONNAME = "Tanin Na Nakorn"; 227 | TargetAttributes = { 228 | F3383A3523BD172A00EECE6C = { 229 | CreatedOnToolsVersion = 11.2.1; 230 | LastSwiftMigration = 1120; 231 | }; 232 | F3383A4823BD172B00EECE6C = { 233 | CreatedOnToolsVersion = 11.2.1; 234 | LastSwiftMigration = 1120; 235 | TestTargetID = F3383A3523BD172A00EECE6C; 236 | }; 237 | F3383A5323BD172B00EECE6C = { 238 | CreatedOnToolsVersion = 11.2.1; 239 | LastSwiftMigration = 1120; 240 | TestTargetID = F3383A3523BD172A00EECE6C; 241 | }; 242 | }; 243 | }; 244 | buildConfigurationList = F3383A3123BD172A00EECE6C /* Build configuration list for PBXProject "Noo" */; 245 | compatibilityVersion = "Xcode 9.3"; 246 | developmentRegion = en; 247 | hasScannedForEncodings = 0; 248 | knownRegions = ( 249 | en, 250 | Base, 251 | ); 252 | mainGroup = F3383A2D23BD172A00EECE6C; 253 | productRefGroup = F3383A3723BD172A00EECE6C /* Products */; 254 | projectDirPath = ""; 255 | projectRoot = ""; 256 | targets = ( 257 | F3383A3523BD172A00EECE6C /* Noo */, 258 | F3383A4823BD172B00EECE6C /* NooTests */, 259 | F3383A5323BD172B00EECE6C /* NooUITests */, 260 | ); 261 | }; 262 | /* End PBXProject section */ 263 | 264 | /* Begin PBXResourcesBuildPhase section */ 265 | F3383A3423BD172A00EECE6C /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | F3383A6A23BD42A000EECE6C /* FontAwesome-Solid.otf in Resources */, 270 | F3E29B732479EC2F0098AE9A /* Assets.xcassets in Resources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | F3383A4723BD172B00EECE6C /* Resources */ = { 275 | isa = PBXResourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | F3383A5223BD172B00EECE6C /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | /* End PBXResourcesBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | F3383A3223BD172A00EECE6C /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | F3832BE72471C1FE00ACF791 /* ShortcutEditor.swift in Sources */, 296 | F3B80EA124566276007431E6 /* AppDelegate.swift in Sources */, 297 | F3B80EA3245662E0007431E6 /* EventLoop.swift in Sources */, 298 | F3B80EA724567AA6007431E6 /* main.swift in Sources */, 299 | F3AE0C7D245936F1005C7FEF /* SettingsViewController.swift in Sources */, 300 | F3832BE92472096A00ACF791 /* Config.swift in Sources */, 301 | F32C935E24778484007B1F26 /* NooCGEvent.swift in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | F3383A4523BD172B00EECE6C /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | F377AF9324739FB600175F1A /* EventLoopTriggerTests.swift in Sources */, 310 | F3E29B672478CA4C0098AE9A /* EventLoopEventCallBackTests.swift in Sources */, 311 | F3E29B652478C93A0098AE9A /* EventLoopRespondToTests.swift in Sources */, 312 | F3E29B692478CCC40098AE9A /* Mocks.swift in Sources */, 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | }; 316 | F3383A5023BD172B00EECE6C /* Sources */ = { 317 | isa = PBXSourcesBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | F3E29B6B2478E8A50098AE9A /* NooUITests.swift in Sources */, 321 | F3E29B6E2479D2460098AE9A /* Config.swift in Sources */, 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | /* End PBXSourcesBuildPhase section */ 326 | 327 | /* Begin PBXTargetDependency section */ 328 | F3383A4B23BD172B00EECE6C /* PBXTargetDependency */ = { 329 | isa = PBXTargetDependency; 330 | target = F3383A3523BD172A00EECE6C /* Noo */; 331 | targetProxy = F3383A4A23BD172B00EECE6C /* PBXContainerItemProxy */; 332 | }; 333 | F3383A5623BD172B00EECE6C /* PBXTargetDependency */ = { 334 | isa = PBXTargetDependency; 335 | target = F3383A3523BD172A00EECE6C /* Noo */; 336 | targetProxy = F3383A5523BD172B00EECE6C /* PBXContainerItemProxy */; 337 | }; 338 | /* End PBXTargetDependency section */ 339 | 340 | /* Begin XCBuildConfiguration section */ 341 | F3383A5B23BD172B00EECE6C /* Debug */ = { 342 | isa = XCBuildConfiguration; 343 | buildSettings = { 344 | ALWAYS_SEARCH_USER_PATHS = NO; 345 | CLANG_ANALYZER_NONNULL = YES; 346 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 347 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 348 | CLANG_CXX_LIBRARY = "libc++"; 349 | CLANG_ENABLE_MODULES = YES; 350 | CLANG_ENABLE_OBJC_ARC = YES; 351 | CLANG_ENABLE_OBJC_WEAK = YES; 352 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_COMMA = YES; 355 | CLANG_WARN_CONSTANT_CONVERSION = YES; 356 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 357 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 358 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 359 | CLANG_WARN_EMPTY_BODY = YES; 360 | CLANG_WARN_ENUM_CONVERSION = YES; 361 | CLANG_WARN_INFINITE_RECURSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 364 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 365 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 368 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 369 | CLANG_WARN_STRICT_PROTOTYPES = YES; 370 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 371 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 372 | CLANG_WARN_UNREACHABLE_CODE = YES; 373 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 374 | COPY_PHASE_STRIP = NO; 375 | DEAD_CODE_STRIPPING = YES; 376 | DEBUG_INFORMATION_FORMAT = dwarf; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | ENABLE_TESTABILITY = YES; 379 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 380 | GCC_C_LANGUAGE_STANDARD = gnu11; 381 | GCC_DYNAMIC_NO_PIC = NO; 382 | GCC_NO_COMMON_BLOCKS = YES; 383 | GCC_OPTIMIZATION_LEVEL = 0; 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 389 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 390 | GCC_WARN_UNDECLARED_SELECTOR = YES; 391 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 392 | GCC_WARN_UNUSED_FUNCTION = YES; 393 | GCC_WARN_UNUSED_VARIABLE = YES; 394 | MACOSX_DEPLOYMENT_TARGET = 13.5; 395 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 396 | MTL_FAST_MATH = YES; 397 | ONLY_ACTIVE_ARCH = YES; 398 | SDKROOT = macosx; 399 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 400 | }; 401 | name = Debug; 402 | }; 403 | F3383A5C23BD172B00EECE6C /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ALWAYS_SEARCH_USER_PATHS = NO; 407 | CLANG_ANALYZER_NONNULL = YES; 408 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 409 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 410 | CLANG_CXX_LIBRARY = "libc++"; 411 | CLANG_ENABLE_MODULES = YES; 412 | CLANG_ENABLE_OBJC_ARC = YES; 413 | CLANG_ENABLE_OBJC_WEAK = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 421 | CLANG_WARN_EMPTY_BODY = YES; 422 | CLANG_WARN_ENUM_CONVERSION = YES; 423 | CLANG_WARN_INFINITE_RECURSION = YES; 424 | CLANG_WARN_INT_CONVERSION = YES; 425 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 426 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 427 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 428 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 429 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 430 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 431 | CLANG_WARN_STRICT_PROTOTYPES = YES; 432 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 433 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 434 | CLANG_WARN_UNREACHABLE_CODE = YES; 435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 436 | COPY_PHASE_STRIP = NO; 437 | DEAD_CODE_STRIPPING = YES; 438 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 439 | ENABLE_NS_ASSERTIONS = NO; 440 | ENABLE_STRICT_OBJC_MSGSEND = YES; 441 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 442 | GCC_C_LANGUAGE_STANDARD = gnu11; 443 | GCC_NO_COMMON_BLOCKS = YES; 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | MACOSX_DEPLOYMENT_TARGET = 13.5; 451 | MTL_ENABLE_DEBUG_INFO = NO; 452 | MTL_FAST_MATH = YES; 453 | ONLY_ACTIVE_ARCH = YES; 454 | SDKROOT = macosx; 455 | SWIFT_COMPILATION_MODE = wholemodule; 456 | }; 457 | name = Release; 458 | }; 459 | F3383A5E23BD172B00EECE6C /* Debug */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 463 | CLANG_ENABLE_MODULES = YES; 464 | CODE_SIGN_ENTITLEMENTS = Noo/Noo.entitlements; 465 | CODE_SIGN_IDENTITY = "Apple Development"; 466 | CODE_SIGN_STYLE = Automatic; 467 | COMBINE_HIDPI_IMAGES = YES; 468 | DEAD_CODE_STRIPPING = YES; 469 | DEVELOPMENT_TEAM = S6482XAL5E; 470 | ENABLE_HARDENED_RUNTIME = YES; 471 | INFOPLIST_FILE = Noo/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = ( 473 | "$(inherited)", 474 | "@executable_path/../Frameworks", 475 | ); 476 | MACOSX_DEPLOYMENT_TARGET = 13.5; 477 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 480 | SWIFT_VERSION = 5.0; 481 | }; 482 | name = Debug; 483 | }; 484 | F3383A5F23BD172B00EECE6C /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CLANG_ENABLE_MODULES = YES; 489 | CODE_SIGN_ENTITLEMENTS = Noo/Noo.entitlements; 490 | CODE_SIGN_IDENTITY = "Apple Development"; 491 | CODE_SIGN_STYLE = Automatic; 492 | COMBINE_HIDPI_IMAGES = YES; 493 | DEAD_CODE_STRIPPING = YES; 494 | DEVELOPMENT_TEAM = S6482XAL5E; 495 | ENABLE_HARDENED_RUNTIME = YES; 496 | INFOPLIST_FILE = Noo/Info.plist; 497 | LD_RUNPATH_SEARCH_PATHS = ( 498 | "$(inherited)", 499 | "@executable_path/../Frameworks", 500 | ); 501 | MACOSX_DEPLOYMENT_TARGET = 13.5; 502 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | SWIFT_VERSION = 5.0; 505 | }; 506 | name = Release; 507 | }; 508 | F3383A6123BD172B00EECE6C /* Debug */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 512 | BUNDLE_LOADER = "$(TEST_HOST)"; 513 | CLANG_ENABLE_MODULES = YES; 514 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; 515 | CODE_SIGN_STYLE = Automatic; 516 | COMBINE_HIDPI_IMAGES = YES; 517 | DEAD_CODE_STRIPPING = YES; 518 | DEVELOPMENT_TEAM = S6482XAL5E; 519 | INFOPLIST_FILE = NooTests/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "@executable_path/../Frameworks", 523 | "@loader_path/../Frameworks", 524 | ); 525 | MACOSX_DEPLOYMENT_TARGET = 13.5; 526 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo.NooTests; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 529 | SWIFT_VERSION = 5.0; 530 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Noo.app/Contents/MacOS/Noo"; 531 | }; 532 | name = Debug; 533 | }; 534 | F3383A6223BD172B00EECE6C /* Release */ = { 535 | isa = XCBuildConfiguration; 536 | buildSettings = { 537 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 538 | BUNDLE_LOADER = "$(TEST_HOST)"; 539 | CLANG_ENABLE_MODULES = YES; 540 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; 541 | CODE_SIGN_STYLE = Automatic; 542 | COMBINE_HIDPI_IMAGES = YES; 543 | DEAD_CODE_STRIPPING = YES; 544 | DEVELOPMENT_TEAM = S6482XAL5E; 545 | INFOPLIST_FILE = NooTests/Info.plist; 546 | LD_RUNPATH_SEARCH_PATHS = ( 547 | "$(inherited)", 548 | "@executable_path/../Frameworks", 549 | "@loader_path/../Frameworks", 550 | ); 551 | MACOSX_DEPLOYMENT_TARGET = 13.5; 552 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo.NooTests; 553 | PRODUCT_NAME = "$(TARGET_NAME)"; 554 | SWIFT_VERSION = 5.0; 555 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Noo.app/Contents/MacOS/Noo"; 556 | }; 557 | name = Release; 558 | }; 559 | F3383A6423BD172B00EECE6C /* Debug */ = { 560 | isa = XCBuildConfiguration; 561 | buildSettings = { 562 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 563 | CLANG_ENABLE_MODULES = YES; 564 | CODE_SIGN_STYLE = Automatic; 565 | COMBINE_HIDPI_IMAGES = YES; 566 | DEAD_CODE_STRIPPING = YES; 567 | DEVELOPMENT_TEAM = S6482XAL5E; 568 | INFOPLIST_FILE = NooUITests/Info.plist; 569 | LD_RUNPATH_SEARCH_PATHS = ( 570 | "$(inherited)", 571 | "@executable_path/../Frameworks", 572 | "@loader_path/../Frameworks", 573 | ); 574 | MACOSX_DEPLOYMENT_TARGET = 13.5; 575 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo.NooUITests; 576 | PRODUCT_NAME = "$(TARGET_NAME)"; 577 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 578 | SWIFT_VERSION = 5.0; 579 | TEST_TARGET_NAME = Noo; 580 | }; 581 | name = Debug; 582 | }; 583 | F3383A6523BD172B00EECE6C /* Release */ = { 584 | isa = XCBuildConfiguration; 585 | buildSettings = { 586 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 587 | CLANG_ENABLE_MODULES = YES; 588 | CODE_SIGN_STYLE = Automatic; 589 | COMBINE_HIDPI_IMAGES = YES; 590 | DEAD_CODE_STRIPPING = YES; 591 | DEVELOPMENT_TEAM = S6482XAL5E; 592 | INFOPLIST_FILE = NooUITests/Info.plist; 593 | LD_RUNPATH_SEARCH_PATHS = ( 594 | "$(inherited)", 595 | "@executable_path/../Frameworks", 596 | "@loader_path/../Frameworks", 597 | ); 598 | MACOSX_DEPLOYMENT_TARGET = 13.5; 599 | PRODUCT_BUNDLE_IDENTIFIER = tanin.noo.NooUITests; 600 | PRODUCT_NAME = "$(TARGET_NAME)"; 601 | SWIFT_VERSION = 5.0; 602 | TEST_TARGET_NAME = Noo; 603 | }; 604 | name = Release; 605 | }; 606 | /* End XCBuildConfiguration section */ 607 | 608 | /* Begin XCConfigurationList section */ 609 | F3383A3123BD172A00EECE6C /* Build configuration list for PBXProject "Noo" */ = { 610 | isa = XCConfigurationList; 611 | buildConfigurations = ( 612 | F3383A5B23BD172B00EECE6C /* Debug */, 613 | F3383A5C23BD172B00EECE6C /* Release */, 614 | ); 615 | defaultConfigurationIsVisible = 0; 616 | defaultConfigurationName = Release; 617 | }; 618 | F3383A5D23BD172B00EECE6C /* Build configuration list for PBXNativeTarget "Noo" */ = { 619 | isa = XCConfigurationList; 620 | buildConfigurations = ( 621 | F3383A5E23BD172B00EECE6C /* Debug */, 622 | F3383A5F23BD172B00EECE6C /* Release */, 623 | ); 624 | defaultConfigurationIsVisible = 0; 625 | defaultConfigurationName = Release; 626 | }; 627 | F3383A6023BD172B00EECE6C /* Build configuration list for PBXNativeTarget "NooTests" */ = { 628 | isa = XCConfigurationList; 629 | buildConfigurations = ( 630 | F3383A6123BD172B00EECE6C /* Debug */, 631 | F3383A6223BD172B00EECE6C /* Release */, 632 | ); 633 | defaultConfigurationIsVisible = 0; 634 | defaultConfigurationName = Release; 635 | }; 636 | F3383A6323BD172B00EECE6C /* Build configuration list for PBXNativeTarget "NooUITests" */ = { 637 | isa = XCConfigurationList; 638 | buildConfigurations = ( 639 | F3383A6423BD172B00EECE6C /* Debug */, 640 | F3383A6523BD172B00EECE6C /* Release */, 641 | ); 642 | defaultConfigurationIsVisible = 0; 643 | defaultConfigurationName = Release; 644 | }; 645 | /* End XCConfigurationList section */ 646 | }; 647 | rootObject = F3383A2E23BD172A00EECE6C /* Project object */; 648 | } 649 | -------------------------------------------------------------------------------- /Noo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Noo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Noo.xcodeproj/xcshareddata/xcschemes/Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 65 | 67 | 73 | 74 | 75 | 76 | 80 | 81 | 82 | 83 | 89 | 91 | 97 | 98 | 99 | 100 | 102 | 103 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Noo.xcodeproj/xcshareddata/xcschemes/Release.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Noo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 4/26/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate { 12 | 13 | static let CONFIG = Config() 14 | static let controller: SettingsViewController = SettingsViewController() 15 | 16 | var statusItem: NSStatusItem?; 17 | let window: NSWindow; 18 | 19 | override init() { 20 | NSLog("Init Noo.app") 21 | 22 | self.window = NSWindow.init( 23 | contentRect: NSRect.init(x: 0, y: 0, width: 10, height: 10), 24 | styleMask: NSWindow.StyleMask.init(arrayLiteral: NSWindow.StyleMask.closable, NSWindow.StyleMask.resizable, NSWindow.StyleMask.miniaturizable, NSWindow.StyleMask.titled), 25 | backing: NSWindow.BackingStoreType.buffered, 26 | defer: false) 27 | window.isReleasedWhenClosed = false; 28 | window.setIsVisible(false) 29 | 30 | super.init() 31 | 32 | 33 | window.contentViewController = AppDelegate.controller 34 | window.title = "Noo" 35 | window.delegate = AppDelegate.controller 36 | } 37 | 38 | @objc func showSettings() { 39 | NSApp.setActivationPolicy(.regular) 40 | NSApp.activate(ignoringOtherApps: true) 41 | window.center() 42 | window.makeKeyAndOrderFront(self) 43 | window.setIsVisible(true) 44 | } 45 | 46 | 47 | @objc func terminate() { 48 | NSApp.terminate(nil) 49 | } 50 | 51 | @objc func hide() { 52 | statusItem!.isVisible = false; 53 | } 54 | 55 | func setupEventLoop() { 56 | let accessibilityEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true] as NSDictionary); 57 | NSLog("Noo can access Accessibility: %@", accessibilityEnabled ? "true" : "false"); 58 | 59 | eventTap = CGEvent.tapCreate( 60 | tap: CGEventTapLocation.cghidEventTap, 61 | place: CGEventTapPlacement.headInsertEventTap, 62 | options: CGEventTapOptions.defaultTap, 63 | eventsOfInterest: NSEvent.EventTypeMask.init( 64 | arrayLiteral: 65 | NSEvent.EventTypeMask.otherMouseUp, 66 | NSEvent.EventTypeMask.otherMouseDown, 67 | NSEvent.EventTypeMask.otherMouseDragged, 68 | NSEvent.EventTypeMask.rightMouseUp, 69 | NSEvent.EventTypeMask.rightMouseDown, 70 | NSEvent.EventTypeMask.rightMouseDragged, 71 | NSEvent.EventTypeMask.gesture 72 | ).rawValue, 73 | callback: eventCallback, 74 | userInfo: nil) 75 | 76 | if eventTap == nil { 77 | NSLog("Unable to invoke CGEvent.tapCreate. Please enable Accessibility for Noo.app"); 78 | let alert = NSAlert() 79 | alert.messageText = "Accessibility is off" 80 | alert.informativeText = "Please grant Accessibility and start Noo again." 81 | alert.alertStyle = .warning 82 | alert.addButton(withTitle: "Open the Accessibility setting and quit Noo") 83 | alert.runModal() 84 | 85 | let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility")! 86 | NSWorkspace.shared.open(url) 87 | 88 | NSApp.terminate(nil) 89 | return 90 | } 91 | 92 | eventLoop = CFMachPortCreateRunLoopSource(nil, eventTap!, 0) 93 | CFRunLoopAddSource(CFRunLoopGetCurrent(), eventLoop!, CFRunLoopMode.commonModes) 94 | 95 | CGEvent.tapEnable(tap: eventTap!, enable: true); 96 | } 97 | 98 | func setupStatusItem() { 99 | let item = NSStatusBar.system.statusItem(withLength: 25) 100 | item.isVisible = true 101 | 102 | item.button!.cell!.font = NSFont.init(name: "Font Awesome 5 Free", size: 14) 103 | 104 | item.button!.title = "\u{f8cc}" 105 | item.button!.isEnabled = true 106 | 107 | item.menu = NSMenu.init(title: "Noo") 108 | item.menu!.addItem(withTitle: "Settings", action: #selector(showSettings), keyEquivalent: "") 109 | item.menu!.addItem(withTitle: "Hide this menu", action: #selector(hide), keyEquivalent: "") 110 | item.menu!.addItem(NSMenuItem.separator()) 111 | item.menu!.addItem(withTitle: "Quit", action: #selector(terminate), keyEquivalent: "") 112 | statusItem = item 113 | } 114 | 115 | func applicationDidBecomeActive(_ notification: Notification) { 116 | // App is activated by user double-clicking on the binary. 117 | statusItem!.isVisible = true; 118 | showSettings() 119 | } 120 | 121 | func applicationDidFinishLaunching(_ notification: Notification) { 122 | setupStatusItem() 123 | setupEventLoop() 124 | 125 | let event = NSAppleEventManager.shared().currentAppleEvent 126 | let launchedAsLogInItem = 127 | event?.eventID == kAEOpenApplication && 128 | event?.paramDescriptor(forKeyword: keyAEPropData)?.enumCodeValue == keyAELaunchedAsLogInItem 129 | 130 | if (!launchedAsLogInItem) { 131 | showSettings() 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/128.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/16.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/256.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/32.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/512.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/Assets.xcassets/AppIcon.appiconset/64.png -------------------------------------------------------------------------------- /Noo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"128x128","expected-size":"128","filename":"128.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"256x256","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"128x128","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"256x256","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"512x512","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"16","filename":"16.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"64","filename":"64.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"512x512","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"}]} -------------------------------------------------------------------------------- /Noo/Config.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Config.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 5/17/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import os.log 11 | import Carbon.HIToolbox.Events 12 | 13 | public class Shortcut: NSObject { 14 | 15 | let id: String 16 | var enabled: Bool = false 17 | var cmd: Bool = true 18 | var ctrl: Bool = false 19 | var option: Bool = false 20 | var shift: Bool = true 21 | var key: String = "7" 22 | 23 | public override var description: String { 24 | return "Shortcut(id: \(id), enabled: \(enabled), cmd: \(cmd), ctrl: \(ctrl), option: \(option), shift: \(shift), key: \(key))" 25 | } 26 | 27 | init(id: String, key: String, enabled: Bool = false, cmd: Bool = false, ctrl: Bool = false, option: Bool = false, shift: Bool = false) { 28 | self.id = id 29 | self.enabled = enabled 30 | self.cmd = cmd 31 | self.ctrl = ctrl 32 | self.option = option 33 | self.shift = shift 34 | self.key = key 35 | 36 | super.init() 37 | } 38 | 39 | static func encode(_ s: Shortcut) -> [String: Any] { 40 | return [ 41 | "enabled": s.enabled, 42 | "cmd": s.cmd, 43 | "ctrl": s.ctrl, 44 | "option": s.option, 45 | "shift": s.shift, 46 | "key": s.key 47 | ] 48 | } 49 | 50 | public static func decode(_ id: String, _ dict: [String: Any]) throws -> Shortcut { 51 | return Shortcut( 52 | id: id, 53 | key: dict["key"] as! String, 54 | enabled: dict["enabled"] as! Bool, 55 | cmd: dict["cmd"] as! Bool, 56 | ctrl: dict["ctrl"] as! Bool, 57 | option: dict["option"] as! Bool, 58 | shift: dict["shift"] as! Bool 59 | ) 60 | } 61 | 62 | } 63 | 64 | 65 | class Config: NSObject { 66 | var gestures: [String: Shortcut] = [:] 67 | 68 | static let IDS = [ 69 | "finger-3", "finger-4", "finger-5", 70 | "mouse-button-right", 71 | "mouse-button-2", "mouse-button-3", "mouse-button-4", "mouse-button-5", "mouse-button-6", "mouse-button-7", "mouse-button-8" 72 | ] 73 | 74 | static let KEYS = [ 75 | ("0", kVK_ANSI_0), 76 | ("1", kVK_ANSI_1), 77 | ("2", kVK_ANSI_2), 78 | ("3", kVK_ANSI_3), 79 | ("4", kVK_ANSI_4), 80 | ("5", kVK_ANSI_5), 81 | ("6", kVK_ANSI_6), 82 | ("7", kVK_ANSI_7), 83 | ("8", kVK_ANSI_8), 84 | ("9", kVK_ANSI_9), 85 | ("A", kVK_ANSI_A), 86 | ("B", kVK_ANSI_B), 87 | ("C", kVK_ANSI_C), 88 | ("D", kVK_ANSI_D), 89 | ("E", kVK_ANSI_E), 90 | ("F", kVK_ANSI_F), 91 | ("G", kVK_ANSI_G), 92 | ("H", kVK_ANSI_H), 93 | ("I", kVK_ANSI_I), 94 | ("J", kVK_ANSI_J), 95 | ("K", kVK_ANSI_K), 96 | ("L", kVK_ANSI_L), 97 | ("M", kVK_ANSI_M), 98 | ("N", kVK_ANSI_N), 99 | ("O", kVK_ANSI_O), 100 | ("P", kVK_ANSI_P), 101 | ("Q", kVK_ANSI_Q), 102 | ("R", kVK_ANSI_R), 103 | ("S", kVK_ANSI_S), 104 | ("T", kVK_ANSI_T), 105 | ("U", kVK_ANSI_U), 106 | ("V", kVK_ANSI_V), 107 | ("W", kVK_ANSI_W), 108 | ("X", kVK_ANSI_X), 109 | ("Y", kVK_ANSI_Y), 110 | ("Z", kVK_ANSI_Z), 111 | ("\\", kVK_ANSI_Backslash), 112 | (",", kVK_ANSI_Comma), 113 | ("=", kVK_ANSI_Equal), 114 | ("`", kVK_ANSI_Grave), 115 | ("[", kVK_ANSI_LeftBracket), 116 | ("-", kVK_ANSI_Minus), 117 | (".", kVK_ANSI_Period), 118 | ("\"", kVK_ANSI_Quote), 119 | ("]", kVK_ANSI_RightBracket), 120 | (";", kVK_ANSI_Semicolon), 121 | ("/", kVK_ANSI_Slash), 122 | ("End", kVK_End), 123 | ("Esc", kVK_Escape), 124 | ("F1", kVK_F1), 125 | ("F2", kVK_F2), 126 | ("F3", kVK_F3), 127 | ("F4", kVK_F4), 128 | ("F5", kVK_F5), 129 | ("F6", kVK_F6), 130 | ("F7", kVK_F7), 131 | ("F8", kVK_F8), 132 | ("F9", kVK_F9), 133 | ("F10", kVK_F10), 134 | ("F11", kVK_F11), 135 | ("F12", kVK_F12), 136 | ("F13", kVK_F13), 137 | ("F14", kVK_F14), 138 | ("F15", kVK_F15), 139 | ("F16", kVK_F16), 140 | ("F17", kVK_F17), 141 | ("F18", kVK_F18), 142 | ("F19", kVK_F19), 143 | ("F20", kVK_F20), 144 | ("Help", kVK_Help), 145 | ("Home", kVK_Home), 146 | ("Left arrow", kVK_LeftArrow), 147 | ("Up arrow", kVK_UpArrow), 148 | ("Right arrow", kVK_RightArrow), 149 | ("Down arrow", kVK_DownArrow), 150 | ("Mute", kVK_Mute), 151 | ("Page down", kVK_PageDown), 152 | ("Page up", kVK_PageUp), 153 | ("Return", kVK_Return), 154 | ("Space", kVK_Space), 155 | ("Tab", kVK_Tab), 156 | ("Volume down", kVK_VolumeDown), 157 | ("Volume up", kVK_VolumeUp) 158 | ] 159 | 160 | static let KEY_MAP = Dictionary(uniqueKeysWithValues: KEYS) 161 | 162 | static let USER_DEFAULTS_NAMESPACE = "NooMappings" 163 | static var DEFAULTS = UserDefaults.standard 164 | static var MAPPINGS = Config.getMappings() 165 | 166 | #if DEBUG 167 | static var USER_DEFAULTS_FILE_NAME: String? 168 | #endif 169 | 170 | override init() { 171 | super.init() 172 | 173 | #if DEBUG 174 | let uiTesting = ProcessInfo.processInfo.arguments.contains("-ui-testing") 175 | 176 | if (uiTesting) { 177 | Config.USER_DEFAULTS_FILE_NAME = ProcessInfo.processInfo.arguments[2] 178 | Config.DEFAULTS = UserDefaults.init(suiteName: "EventLoopTest")! 179 | 180 | Config.MAPPINGS = Config.getMappings() 181 | for (key, _) in Config.MAPPINGS { 182 | Config.MAPPINGS.removeValue(forKey: key) 183 | } 184 | 185 | save() 186 | } 187 | #endif 188 | 189 | loadDefaults() 190 | } 191 | 192 | static func getMappings() -> [String: Any] { 193 | let dict = Config.DEFAULTS.dictionary(forKey: Config.USER_DEFAULTS_NAMESPACE) 194 | if dict == nil { 195 | Config.DEFAULTS.set([:], forKey: Config.USER_DEFAULTS_NAMESPACE) 196 | } 197 | return Config.DEFAULTS.dictionary(forKey: Config.USER_DEFAULTS_NAMESPACE)! 198 | } 199 | 200 | func loadDefaults() { 201 | for id in Config.IDS { 202 | let value = Config.MAPPINGS[id] 203 | 204 | if let shortcut = value as? [String: Any] { 205 | do { 206 | try gestures[id] = Shortcut.decode(id, shortcut) 207 | } catch { 208 | os_log("Error reading %@: %@", id, shortcut) 209 | } 210 | } else { 211 | gestures[id] = Shortcut(id: id, key: "0", enabled: false, cmd: false, ctrl: false, option: false, shift: false) 212 | } 213 | } 214 | 215 | self.save() 216 | } 217 | 218 | func save() { 219 | for (key, shortcut) in gestures { 220 | Config.MAPPINGS[key] = Shortcut.encode(shortcut) 221 | } 222 | 223 | Config.DEFAULTS.set(Config.MAPPINGS, forKey: Config.USER_DEFAULTS_NAMESPACE) 224 | 225 | #if DEBUG 226 | if Config.USER_DEFAULTS_FILE_NAME != nil { 227 | try! JSONSerialization.data( 228 | withJSONObject: Config.MAPPINGS, 229 | options: .prettyPrinted 230 | ).write( 231 | to: NSURL.fileURL( 232 | withPathComponents: [NSTemporaryDirectory(), Config.USER_DEFAULTS_FILE_NAME!] 233 | )! 234 | ) 235 | } 236 | #endif 237 | } 238 | 239 | } 240 | -------------------------------------------------------------------------------- /Noo/EventLoop.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventLoop.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 4/26/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Carbon.HIToolbox 11 | 12 | var eventLoop: CFRunLoopSource? = nil 13 | public var eventTap: CFMachPort? = nil 14 | var timer: Timer? = nil 15 | var currentFingerCount: Int = 0 16 | var latestTimerId: Int = 0 17 | 18 | public var CGEventClass: NooCGEventBase.Type = NooCGEvent.self 19 | public var NSWorkspaceClass: NSWorkspace.Type = NSWorkspace.self 20 | public var NSEventClass: NooNSEventBase.Type = NooNSEvent.self 21 | 22 | func eventCallback(proxy: CGEventTapProxy, type: CGEventType, event: CGEvent, refcon: UnsafeMutableRawPointer?) -> Unmanaged? { 23 | let accessibilityEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: false] as NSDictionary); 24 | 25 | if (!accessibilityEnabled) { 26 | CGEventClass.tapEnable(tap: eventTap!, enable: false) 27 | CFRunLoopRemoveSource(CFRunLoopGetCurrent(), eventLoop!, CFRunLoopMode.commonModes) 28 | 29 | let alert = NSAlert() 30 | alert.messageText = "Accessibility has been turned off" 31 | alert.informativeText = "Noo will quit. Please grant Accessibility and start Noo again." 32 | alert.alertStyle = .warning 33 | alert.addButton(withTitle: "Quit Noo") 34 | alert.runModal() 35 | NSApp.terminate(nil) 36 | 37 | return Unmanaged.passUnretained(event) 38 | } 39 | 40 | if (type == CGEventType.tapDisabledByTimeout) { 41 | CGEventClass.tapEnable(tap: eventTap!, enable: true) 42 | return Unmanaged.passUnretained(event) 43 | } 44 | 45 | let nsEvent = NSEventClass.init(cgEvent: event) 46 | 47 | if (nsEvent.type == NSEvent.EventType.gesture) { 48 | let latestTouchCount = nsEvent.touches(matching: NSTouch.Phase.stationary, in: nil).count 49 | 50 | if (currentFingerCount < latestTouchCount && latestTouchCount >= 3) { 51 | currentFingerCount = latestTouchCount; 52 | 53 | let id = "finger-\(latestTouchCount)" 54 | 55 | if ( 56 | respondTo(id) || 57 | NSApplication.shared.keyWindow?.contentViewController == AppDelegate.controller // the window is in focused 58 | ) { 59 | if let _ = timer?.isValid { 60 | timer?.invalidate() 61 | } 62 | 63 | latestTimerId += 1 64 | let timerId = latestTimerId; 65 | timer = Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false, block: { (_: Timer) in 66 | if (timerId != latestTimerId) { return; } 67 | 68 | if (currentFingerCount == latestTouchCount) { 69 | AppDelegate.controller.gestured(id) 70 | 71 | if (respondTo(id)) { 72 | trigger("finger-\(currentFingerCount)") 73 | } 74 | } 75 | 76 | currentFingerCount = 0; 77 | }) 78 | return nil 79 | } 80 | 81 | currentFingerCount = 0; 82 | } 83 | return Unmanaged.passUnretained(event); 84 | } 85 | 86 | // This method responds to mouse down, up, and dragged. 87 | // However, we needed to swallow mouse down and dragged. 88 | // Otherwise, IntelliJ would not accept any mouse event when it sees a mouse down but never sees a subsequent mouse up. 89 | 90 | if (nsEvent.type == NSEvent.EventType.rightMouseUp || nsEvent.type == NSEvent.EventType.rightMouseDown) { 91 | let id = "mouse-button-right" 92 | 93 | if (nsEvent.type == NSEvent.EventType.rightMouseDown) { 94 | AppDelegate.controller.gestured(id) 95 | } 96 | 97 | if respondTo(id) { 98 | if (nsEvent.type == NSEvent.EventType.rightMouseUp) { 99 | trigger(id) 100 | } 101 | return nil; 102 | } 103 | } 104 | 105 | if (nsEvent.type == NSEvent.EventType.otherMouseUp || nsEvent.type == NSEvent.EventType.otherMouseDown) { 106 | let id = "mouse-button-\(nsEvent.buttonNumber)" 107 | 108 | if (nsEvent.type == NSEvent.EventType.otherMouseDown) { 109 | AppDelegate.controller.gestured(id) 110 | } 111 | 112 | if respondTo(id) { 113 | if (nsEvent.type == NSEvent.EventType.otherMouseUp) { 114 | trigger(id) 115 | } 116 | return nil; 117 | } 118 | } 119 | 120 | return Unmanaged.passUnretained(event); 121 | } 122 | 123 | func respondTo(_ id: String) -> Bool { 124 | let gestureOpt = AppDelegate.CONFIG.gestures[id] 125 | 126 | if (gestureOpt == nil) { return false } 127 | let gesture = gestureOpt! 128 | 129 | return gesture.enabled 130 | } 131 | 132 | func trigger(_ id: String) { 133 | let gestureOpt = AppDelegate.CONFIG.gestures[id] 134 | if (gestureOpt == nil) { return } 135 | let gesture = gestureOpt! 136 | 137 | if (gesture.enabled == false) { return } 138 | 139 | let keyCodeOpt = Config.KEY_MAP[gesture.key] 140 | if (keyCodeOpt == nil) { return } 141 | let keyCode = keyCodeOpt! 142 | 143 | let down = CGEventClass.init(virtualKey: keyCode, keyDown: true) 144 | let up = CGEventClass.init(virtualKey: keyCode, keyDown: false) 145 | 146 | if gesture.cmd { 147 | down.addFlag(CGEventFlags.maskCommand) 148 | up.addFlag(CGEventFlags.maskCommand) 149 | } 150 | 151 | if gesture.ctrl { 152 | down.addFlag(CGEventFlags.maskControl) 153 | up.addFlag(CGEventFlags.maskControl) 154 | } 155 | 156 | if gesture.option { 157 | down.addFlag(CGEventFlags.maskAlternate) 158 | up.addFlag(CGEventFlags.maskAlternate) 159 | } 160 | 161 | if gesture.shift { 162 | down.addFlag(CGEventFlags.maskShift) 163 | up.addFlag(CGEventFlags.maskShift) 164 | } 165 | 166 | down.post() 167 | up.post() 168 | } 169 | -------------------------------------------------------------------------------- /Noo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | ATSApplicationFontsPath 8 | . 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIconFile 12 | AppIcon 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 21 | CFBundleShortVersionString 22 | 3.2 23 | CFBundleVersion 24 | 6 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2020 Tanin Na Nakorn. All rights reserved. 29 | NSPrincipalClass 30 | NSApplication 31 | NSSupportsAutomaticTermination 32 | 33 | NSSupportsSuddenTermination 34 | 35 | LSUIElement 36 | 37 | LSMultipleInstancesProhibited 38 | 39 | LSApplicationCategoryType 40 | public.app-category.utilities 41 | 42 | 43 | -------------------------------------------------------------------------------- /Noo/Noo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Noo/NooCGEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NooCGEvent.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 5/21/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | public protocol NooCGEventBase { 12 | init(virtualKey: Int, keyDown: Bool); 13 | func addFlag(_ flag: CGEventFlags); 14 | func post(); 15 | static func tapEnable(tap: CFMachPort, enable: Bool); 16 | } 17 | 18 | class NooCGEvent: NooCGEventBase { 19 | let event: CGEvent 20 | required init(virtualKey: Int, keyDown: Bool) { 21 | event = CGEvent.init(keyboardEventSource: nil, virtualKey: UInt16(virtualKey), keyDown: keyDown)! 22 | } 23 | 24 | func addFlag(_ flag: CGEventFlags) { 25 | event.flags.insert(flag) 26 | } 27 | 28 | func post() { 29 | event.post(tap: .cghidEventTap) 30 | } 31 | 32 | static func tapEnable(tap: CFMachPort, enable: Bool) { 33 | CGEvent.tapEnable(tap: tap, enable: enable) 34 | } 35 | } 36 | 37 | public protocol NooNSEventBase { 38 | init(cgEvent: CGEvent); 39 | var type: NSEvent.EventType { get }; 40 | var buttonNumber: Int { get }; 41 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set; 42 | } 43 | 44 | class NooNSEvent: NooNSEventBase { 45 | let event: NSEvent 46 | required init(cgEvent: CGEvent) { 47 | event = NSEvent.init(cgEvent: cgEvent)! 48 | } 49 | 50 | var type: NSEvent.EventType { 51 | get { return event.type } 52 | } 53 | 54 | var buttonNumber: Int { 55 | get { return event.buttonNumber } 56 | } 57 | 58 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 59 | return event.touches(matching: phase, in: view) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Noo/SettingsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewController.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 4/28/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class SettingsViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate, NSTextViewDelegate, NSWindowDelegate { 12 | 13 | var blinkingId: Int = 0 14 | var instructionView: NSStackView 15 | var scrollView: NSScrollView 16 | var tableView: NSTableView 17 | var originColumn: NSTableColumn 18 | var shortcutColumn: NSTableColumn 19 | var editingShortcutEditor: ShortcutEditor? 20 | static let LABELS: [String: String] = [ 21 | "finger-3": "3-finger touch", 22 | "finger-4": "4-finger touch", 23 | "finger-5": "5-finger touch", 24 | "mouse-button-right": "Mouse right button", 25 | "mouse-button-2": "Mouse button 2", 26 | "mouse-button-3": "Mouse button 3", 27 | "mouse-button-4": "Mouse button 4", 28 | "mouse-button-5": "Mouse button 5", 29 | "mouse-button-6": "Mouse button 6", 30 | "mouse-button-7": "Mouse button 7", 31 | "mouse-button-8": "Mouse button 8" 32 | ] 33 | 34 | init() { 35 | scrollView = NSScrollView() 36 | tableView = NSTableView() 37 | instructionView = NSStackView() 38 | originColumn = NSTableColumn(identifier: NSUserInterfaceItemIdentifier("Origin")) 39 | shortcutColumn = NSTableColumn(identifier: NSUserInterfaceItemIdentifier("Shortcut")) 40 | super.init(nibName: nil, bundle: nil) 41 | 42 | instructionView.edgeInsets = NSEdgeInsets(top: 5.0, left: 5.0, bottom: 5.0, right: 5.0) 43 | instructionView.orientation = .vertical 44 | instructionView.alignment = .centerX 45 | instructionView.wantsLayer = true 46 | 47 | let instructionText = NSTextField() 48 | instructionText.isBezeled = false 49 | instructionText.drawsBackground = false 50 | instructionText.isEditable = false 51 | instructionText.isSelectable = true 52 | instructionText.stringValue = "Click a mouse button to identify its button number" 53 | instructionView.addArrangedSubview(instructionText) 54 | 55 | scrollView.translatesAutoresizingMaskIntoConstraints = false 56 | scrollView.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 57 | scrollView.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.vertical) 58 | scrollView.setContentHuggingPriority(NSLayoutConstraint.Priority.defaultLow, for: NSLayoutConstraint.Orientation.horizontal) 59 | scrollView.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.vertical) 60 | 61 | scrollView.hasVerticalScroller = false 62 | scrollView.hasHorizontalScroller = false 63 | scrollView.documentView = tableView 64 | 65 | tableView.translatesAutoresizingMaskIntoConstraints = false 66 | scrollView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[table]-0-|", options: [], metrics: nil, views: ["table": tableView])) 67 | scrollView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[table]-26-|", options: [], metrics: nil, views: ["table": tableView])) 68 | 69 | tableView.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 70 | tableView.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.vertical) 71 | tableView.setContentHuggingPriority(NSLayoutConstraint.Priority.defaultLow, for: NSLayoutConstraint.Orientation.horizontal) 72 | tableView.setContentHuggingPriority(NSLayoutConstraint.Priority.defaultLow, for: NSLayoutConstraint.Orientation.vertical) 73 | 74 | tableView.gridStyleMask = NSTableView.GridLineStyle.init(arrayLiteral: NSTableView.GridLineStyle.solidHorizontalGridLineMask, NSTableView.GridLineStyle.solidVerticalGridLineMask) 75 | tableView.allowsEmptySelection = true 76 | tableView.allowsColumnSelection = false 77 | tableView.allowsMultipleSelection = false 78 | tableView.allowsTypeSelect = false 79 | tableView.allowsColumnResizing = true 80 | tableView.allowsColumnReordering = false 81 | tableView.usesAutomaticRowHeights = true 82 | tableView.columnAutoresizingStyle = NSTableView.ColumnAutoresizingStyle.lastColumnOnlyAutoresizingStyle; 83 | 84 | tableView.dataSource = self; 85 | tableView.delegate = self; 86 | 87 | originColumn.title = "Action" 88 | originColumn.width = 130 89 | originColumn.headerCell.alignment = NSTextAlignment.center 90 | shortcutColumn.title = "Key combination" 91 | shortcutColumn.headerCell.alignment = NSTextAlignment.center 92 | 93 | tableView.addTableColumn(originColumn) 94 | tableView.addTableColumn(shortcutColumn) 95 | } 96 | 97 | func gestured(_ id: String) { 98 | if (NSApplication.shared.keyWindow?.contentViewController != self) { return } 99 | 100 | var rowIndex = -1 101 | 102 | for i in 0...(Config.IDS.count - 1) { 103 | if id == Config.IDS[i] { 104 | rowIndex = i 105 | break 106 | } 107 | } 108 | 109 | if (rowIndex == -1) { 110 | return 111 | } 112 | 113 | let view = tableView.view(atColumn: 0, row: rowIndex, makeIfNecessary: false) 114 | 115 | if (view != nil) { 116 | blinkingId += 1 117 | animateBlinking(view!, id: blinkingId, visible: false, count: 4) 118 | } 119 | } 120 | 121 | func animateBlinking(_ view: NSView, id: Int, visible: Bool, count: Int) { 122 | if (blinkingId != id) { 123 | view.alphaValue = 1.0 124 | return 125 | } 126 | 127 | if (count <= 0) { return } 128 | 129 | NSAnimationContext.runAnimationGroup({ (context) in 130 | context.duration = 0.125 131 | view.animator().alphaValue = visible ? 1.0 : 0.0 132 | 133 | }, completionHandler:{ 134 | self.animateBlinking(view, id: id, visible: !visible, count: count - 1) 135 | }) 136 | } 137 | 138 | @objc func windowWillClose(_ notification: Notification) { 139 | NSApp.setActivationPolicy(.accessory) 140 | } 141 | 142 | required init?(coder: NSCoder) { 143 | fatalError("init(coder:) has not been implemented") 144 | } 145 | 146 | override func loadView() { 147 | self.view = NSView(frame: NSRect.init(x: 0, y: 0, width: 480, height: 10)) 148 | self.view.becomeFirstResponder() 149 | let view = NSStackView(views: [instructionView, scrollView]) 150 | view.alignment = .centerX 151 | view.orientation = .vertical 152 | view.setCustomSpacing(0.0, after: instructionView) 153 | 154 | self.view.addSubview(view) 155 | self.view.translatesAutoresizingMaskIntoConstraints = false 156 | 157 | self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[view]-0-|", options: [], metrics: nil, views: ["view": view])) 158 | self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[view]-0-|", options: [], metrics: nil, views: ["view": view])) 159 | 160 | self.view.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 161 | self.view.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.vertical) 162 | self.view.setContentHuggingPriority(NSLayoutConstraint.Priority.defaultLow, for: NSLayoutConstraint.Orientation.horizontal) 163 | self.view.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.vertical) 164 | 165 | tableView.sizeLastColumnToFit() 166 | tableView.reloadData() 167 | } 168 | 169 | override func viewDidLoad() { 170 | super.viewDidLoad() 171 | update() 172 | } 173 | 174 | func numberOfRows(in tableView: NSTableView) -> Int { 175 | return Config.IDS.count; 176 | } 177 | 178 | func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool { 179 | return false; 180 | } 181 | 182 | @objc func checked(_ sender: NSButton) { 183 | let button = tableView.view(atColumn: 0, row: sender.tag, makeIfNecessary: true)!.subviews[0] as! NSButton; 184 | let editor = tableView.view(atColumn: 1, row: sender.tag, makeIfNecessary: true)! as! ShortcutEditor; 185 | 186 | editor.shortcut.enabled = button.state == NSControl.StateValue.on 187 | editor.update() 188 | AppDelegate.CONFIG.save() 189 | } 190 | 191 | func update() { 192 | for rowIndex in 0...(tableView.numberOfRows - 1) { 193 | let button = tableView.view(atColumn: 0, row: rowIndex, makeIfNecessary: true)!.subviews[0] as! NSButton; 194 | let editor = tableView.view(atColumn: 1, row: rowIndex, makeIfNecessary: true)! as! ShortcutEditor; 195 | 196 | editor.update() 197 | button.state = editor.enabled ? NSButton.StateValue.on : NSButton.StateValue.off 198 | } 199 | } 200 | 201 | func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { 202 | if (tableColumn == originColumn) { 203 | var viewOpt = tableView.makeView(withIdentifier: tableColumn!.identifier, owner: self) as NSView?; 204 | if viewOpt == nil { 205 | viewOpt = NSView.init() 206 | } 207 | 208 | let view = viewOpt! as NSView 209 | let button = NSButton.init() 210 | button.translatesAutoresizingMaskIntoConstraints = false 211 | button.setButtonType(NSButton.ButtonType.switch) 212 | button.title = SettingsViewController.LABELS[Config.IDS[row]]! 213 | button.action = #selector(checked) 214 | button.target = self 215 | button.tag = row 216 | 217 | view.addSubview(button) 218 | view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-2-[button]", options: [], metrics: nil, views: ["button":button])) 219 | view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-2-[button]-2-|", options: [], metrics: nil, views: ["button":button])) 220 | view.setContentCompressionResistancePriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 221 | view.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 222 | 223 | return view 224 | } else if (tableColumn == shortcutColumn) { 225 | var viewOpt = tableView.makeView(withIdentifier: tableColumn!.identifier, owner: self) as! ShortcutEditor?; 226 | if viewOpt == nil { 227 | viewOpt = ShortcutEditor.init(frame: NSRect.init(x: 0, y: 0, width: 1, height: 1), shortcut: AppDelegate.CONFIG.gestures[Config.IDS[row]]!) 228 | } 229 | 230 | let view = viewOpt! as ShortcutEditor 231 | 232 | return view 233 | } 234 | 235 | return nil 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /Noo/ShortcutEditor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ShortcutEditor.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 5/17/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ShortcutEditor: NSView { 12 | 13 | let shortcut: Shortcut 14 | let cmdButton: NSButton 15 | let ctrlButton: NSButton 16 | let optionButton: NSButton 17 | let shiftButton: NSButton 18 | let keyPopUpButton: NSPopUpButton 19 | 20 | 21 | var enabled: Bool { 22 | get { 23 | return shortcut.enabled 24 | } 25 | } 26 | 27 | init(frame frameRect: NSRect, shortcut: Shortcut) { 28 | self.shortcut = shortcut 29 | cmdButton = NSButton.init() 30 | ctrlButton = NSButton.init() 31 | optionButton = NSButton.init() 32 | shiftButton = NSButton.init() 33 | keyPopUpButton = NSPopUpButton.init() 34 | 35 | super.init(frame: NSMakeRect(0, 0, 0, 0)) 36 | 37 | self.translatesAutoresizingMaskIntoConstraints = false 38 | cmdButton.translatesAutoresizingMaskIntoConstraints = false 39 | ctrlButton.translatesAutoresizingMaskIntoConstraints = false 40 | optionButton.translatesAutoresizingMaskIntoConstraints = false 41 | shiftButton.translatesAutoresizingMaskIntoConstraints = false 42 | keyPopUpButton.translatesAutoresizingMaskIntoConstraints = false 43 | 44 | keyPopUpButton.addItems(withTitles: Config.KEYS.map { tuple in return tuple.0 }) 45 | 46 | self.addSubview(cmdButton) 47 | self.addSubview(ctrlButton) 48 | self.addSubview(optionButton) 49 | self.addSubview(shiftButton) 50 | self.addSubview(keyPopUpButton) 51 | 52 | cmdButton.title = "Cmd" 53 | ctrlButton.title = "Ctrl" 54 | optionButton.title = "Option" 55 | shiftButton.title = "Shift" 56 | 57 | cmdButton.bezelStyle = NSButton.BezelStyle.rounded 58 | ctrlButton.bezelStyle = NSButton.BezelStyle.rounded 59 | optionButton.bezelStyle = NSButton.BezelStyle.rounded 60 | shiftButton.bezelStyle = NSButton.BezelStyle.rounded 61 | 62 | cmdButton.setButtonType(NSButton.ButtonType.pushOnPushOff) 63 | ctrlButton.setButtonType(NSButton.ButtonType.pushOnPushOff) 64 | optionButton.setButtonType(NSButton.ButtonType.pushOnPushOff) 65 | shiftButton.setButtonType(NSButton.ButtonType.pushOnPushOff) 66 | keyPopUpButton.bezelStyle = NSPopUpButton.BezelStyle.rounded 67 | 68 | cmdButton.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 69 | ctrlButton.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 70 | optionButton.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 71 | shiftButton.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 72 | keyPopUpButton.setContentHuggingPriority(NSLayoutConstraint.Priority.required, for: NSLayoutConstraint.Orientation.horizontal) 73 | 74 | self.addConstraints(NSLayoutConstraint.constraints( 75 | withVisualFormat: "H:|-2-[cmd]-2-[ctrl]-2-[option]-2-[shift]-2-[key(==100)]", 76 | options: [], 77 | metrics: nil, 78 | views: ["cmd": cmdButton, "ctrl": ctrlButton, "option": optionButton, "shift": shiftButton, "key": keyPopUpButton] 79 | )) 80 | self.addConstraints(NSLayoutConstraint.constraints( 81 | withVisualFormat: "V:|-1-[cmd]-(>=1)-|", 82 | options: [], 83 | metrics: nil, 84 | views: ["cmd": cmdButton] 85 | )) 86 | self.addConstraints(NSLayoutConstraint.constraints( 87 | withVisualFormat: "V:|-1-[ctrl]-(>=1)-|", 88 | options: [], 89 | metrics: nil, 90 | views: ["ctrl": ctrlButton] 91 | )) 92 | self.addConstraints(NSLayoutConstraint.constraints( 93 | withVisualFormat: "V:|-1-[option]-(>=1)-|", 94 | options: [], 95 | metrics: nil, 96 | views: ["option": optionButton] 97 | )) 98 | self.addConstraints(NSLayoutConstraint.constraints( 99 | withVisualFormat: "V:|-1-[shift]-(>=1)-|", 100 | options: [], 101 | metrics: nil, 102 | views: ["shift": shiftButton] 103 | )) 104 | self.addConstraints(NSLayoutConstraint.constraints( 105 | withVisualFormat: "V:|-1-[key]-(>=1)-|", 106 | options: [], 107 | metrics: nil, 108 | views: ["key": keyPopUpButton] 109 | )) 110 | 111 | self.needsUpdateConstraints = true 112 | 113 | cmdButton.action = #selector(checked) 114 | cmdButton.target = self 115 | ctrlButton.action = #selector(checked) 116 | ctrlButton.target = self 117 | optionButton.action = #selector(checked) 118 | optionButton.target = self 119 | shiftButton.action = #selector(checked) 120 | shiftButton.target = self 121 | keyPopUpButton.action = #selector(keySelected) 122 | keyPopUpButton.target = self 123 | } 124 | 125 | @objc func checked(_ sender: NSButton) { 126 | if sender == cmdButton { 127 | shortcut.cmd = cmdButton.state == NSButton.StateValue.on 128 | } else if sender == ctrlButton { 129 | shortcut.ctrl = ctrlButton.state == NSButton.StateValue.on 130 | } else if sender == optionButton { 131 | shortcut.option = optionButton.state == NSButton.StateValue.on 132 | } else if sender == shiftButton { 133 | shortcut.shift = shiftButton.state == NSButton.StateValue.on 134 | } 135 | 136 | update() 137 | AppDelegate.CONFIG.save() 138 | } 139 | 140 | @objc func keySelected(_ sender: NSPopUpButton) { 141 | shortcut.key = keyPopUpButton.selectedItem!.title 142 | update() 143 | AppDelegate.CONFIG.save() 144 | } 145 | 146 | required init?(coder: NSCoder) { 147 | fatalError("init(coder:) has not been implemented") 148 | } 149 | 150 | func update() { 151 | cmdButton.state = shortcut.cmd ? NSButton.StateValue.on : NSButton.StateValue.off 152 | ctrlButton.state = shortcut.ctrl ? NSButton.StateValue.on : NSButton.StateValue.off 153 | optionButton.state = shortcut.option ? NSButton.StateValue.on : NSButton.StateValue.off 154 | shiftButton.state = shortcut.shift ? NSButton.StateValue.on : NSButton.StateValue.off 155 | keyPopUpButton.selectItem(withTitle: shortcut.key) 156 | isHidden = !shortcut.enabled 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Noo/fonts/FontAwesome-Solid.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/Noo/fonts/FontAwesome-Solid.otf -------------------------------------------------------------------------------- /Noo/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // Noo 4 | // 5 | // Created by Tanin Na Nakorn on 4/26/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | let delegate = AppDelegate() 12 | NSApplication.shared.delegate = delegate 13 | 14 | _ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv) 15 | -------------------------------------------------------------------------------- /NooTests/EventLoopEventCallBackTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventLoopEventCallBackTests.swift 3 | // NooTests 4 | // 5 | // Created by Tanin Na Nakorn on 5/22/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import Noo 11 | 12 | 13 | func mockCallback(proxy: CGEventTapProxy, type: CGEventType, event: CGEvent, refcon: UnsafeMutableRawPointer?) -> Unmanaged? { 14 | return nil 15 | } 16 | 17 | class EventLoopEventCallBackTests: XCTestCase { 18 | var OriginalCGEventClass = CGEventClass 19 | var OriginalNSWorkspaceClass = NSWorkspaceClass 20 | var OriginalNSEventClass = NSEventClass 21 | 22 | override func setUp() { 23 | continueAfterFailure = false 24 | MockCGEvent.clear() 25 | Config.DEFAULTS = UserDefaults.init(suiteName: "EventLoopTest")! 26 | AppDelegate.CONFIG.loadDefaults() 27 | 28 | CGEventClass = MockCGEvent.self 29 | NSWorkspaceClass = MockNSWorkspace.self 30 | 31 | // Need to close the windows because the active window supports testing the action. 32 | NSApplication.shared.keyWindow?.close() 33 | } 34 | 35 | override func tearDown() { 36 | CGEventClass = OriginalCGEventClass 37 | NSWorkspaceClass = OriginalNSWorkspaceClass 38 | NSEventClass = OriginalNSEventClass 39 | } 40 | 41 | func checkKeyEvent() { 42 | XCTAssertEqual(2, MockCGEvent.events.count) 43 | XCTAssertEqual( 44 | [CGEventFlags.maskCommand,CGEventFlags.maskCommand], 45 | MockCGEvent.events.map({ e in e.flags }) 46 | ) 47 | XCTAssertEqual( 48 | [Config.KEY_MAP["F3"], Config.KEY_MAP["F3"]], 49 | MockCGEvent.events.map({ e in e.virtualKey }) 50 | ) 51 | XCTAssertEqual( 52 | [true, true], 53 | MockCGEvent.events.map({ e in e.posted }) 54 | ) 55 | 56 | let down = MockCGEvent.events[0]; 57 | let up = MockCGEvent.events[1]; 58 | 59 | XCTAssertEqual(true, down.keyDown) 60 | XCTAssertEqual(false, up.keyDown) 61 | } 62 | 63 | func testTimeout() { 64 | let event = CGEvent.init(keyboardEventSource: nil, virtualKey: 0, keyDown: false)! 65 | XCTAssertEqual( 66 | event, 67 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: CGEventType.tapDisabledByTimeout, event: event, refcon: nil)?.takeUnretainedValue() 68 | ) 69 | } 70 | 71 | func testLeftClick() { 72 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.leftMouseDown, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.left)! 73 | XCTAssertEqual( 74 | event, 75 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 76 | ) 77 | } 78 | 79 | func testMouseButtonNotConfigured() { 80 | let mouseButton = 2; 81 | 82 | AppDelegate.CONFIG.gestures["mouse-button-\(mouseButton)"]!.enabled = false 83 | 84 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.leftMouseDown, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.init(rawValue: UInt32(mouseButton))!)! 85 | XCTAssertEqual( 86 | event, 87 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 88 | ) 89 | } 90 | 91 | func testRightMouseDown() { 92 | AppDelegate.CONFIG.gestures["mouse-button-right"] = Shortcut( 93 | id: "mouse-button-right", 94 | key: "F3", 95 | enabled: true, 96 | cmd: true 97 | ) 98 | 99 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.rightMouseDown, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.right)! 100 | XCTAssertEqual( 101 | nil, 102 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 103 | ) 104 | XCTAssertEqual(0, MockCGEvent.events.count) 105 | } 106 | 107 | func testRightMouseUp() { 108 | AppDelegate.CONFIG.gestures["mouse-button-right"] = Shortcut( 109 | id: "mouse-button-right", 110 | key: "F3", 111 | enabled: true, 112 | cmd: true 113 | ) 114 | 115 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.rightMouseUp, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.right)! 116 | XCTAssertEqual( 117 | nil, 118 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 119 | ) 120 | 121 | checkKeyEvent() 122 | } 123 | 124 | func testOtherMouseDown() { 125 | let mouseButton = 5; 126 | 127 | AppDelegate.CONFIG.gestures["mouse-button-\(mouseButton)"] = Shortcut( 128 | id: "mouse-button-\(mouseButton)", 129 | key: "F3", 130 | enabled: true, 131 | cmd: true 132 | ) 133 | 134 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.otherMouseDown, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.init(rawValue: UInt32(mouseButton))!)! 135 | XCTAssertEqual( 136 | nil, 137 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 138 | ) 139 | XCTAssertEqual(0, MockCGEvent.events.count) 140 | } 141 | 142 | func testOtherMouseUp() { 143 | let mouseButton = 5; 144 | 145 | AppDelegate.CONFIG.gestures["mouse-button-\(mouseButton)"] = Shortcut( 146 | id: "mouse-button-\(mouseButton)", 147 | key: "F3", 148 | enabled: true, 149 | cmd: true 150 | ) 151 | 152 | let event = CGEvent.init(mouseEventSource: nil, mouseType: CGEventType.otherMouseUp, mouseCursorPosition: CGPoint(), mouseButton: CGMouseButton.init(rawValue: UInt32(mouseButton))!)! 153 | XCTAssertEqual( 154 | nil, 155 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 156 | ) 157 | 158 | checkKeyEvent() 159 | } 160 | 161 | func testFingerNotConfigured() { 162 | AppDelegate.CONFIG.gestures["finger-3"]!.enabled = false 163 | AppDelegate.CONFIG.gestures["finger-4"]!.enabled = false 164 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 165 | 166 | class MockNSEvent: NooNSEventBase { 167 | static var capturedEvent: CGEvent? 168 | required init(cgEvent: CGEvent) { 169 | MockNSEvent.capturedEvent = cgEvent 170 | } 171 | 172 | var type: NSEvent.EventType { 173 | get { return NSEvent.EventType.gesture } 174 | } 175 | 176 | var buttonNumber: Int { 177 | get { return 0 } 178 | } 179 | 180 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 181 | return Set.init(arrayLiteral: NSTouch.init(), NSTouch.init(), NSTouch.init()) 182 | } 183 | } 184 | 185 | NSEventClass = MockNSEvent.self 186 | 187 | let event = CGEvent.init(keyboardEventSource: nil, virtualKey: 0, keyDown: false)! 188 | XCTAssertEqual( 189 | event, 190 | eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue() 191 | ) 192 | XCTAssertEqual( 193 | MockNSEvent.capturedEvent, 194 | event 195 | ) 196 | 197 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.14) as Date) 198 | XCTAssertEqual(0, MockCGEvent.events.count) 199 | } 200 | 201 | func testFinger3() { 202 | AppDelegate.CONFIG.gestures["finger-3"] = Shortcut( 203 | id: "finger-3", 204 | key: "F3", 205 | enabled: true, 206 | cmd: true 207 | ) 208 | AppDelegate.CONFIG.gestures["finger-4"]!.enabled = false 209 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 210 | 211 | class MockNSEvent: NooNSEventBase { 212 | static var capturedEvent: CGEvent? 213 | required init(cgEvent: CGEvent) { 214 | MockNSEvent.capturedEvent = cgEvent 215 | } 216 | 217 | var type: NSEvent.EventType { 218 | get { return NSEvent.EventType.gesture } 219 | } 220 | 221 | var buttonNumber: Int { 222 | get { return 0 } 223 | } 224 | 225 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 226 | return Set.init(arrayLiteral: NSTouch.init(), NSTouch.init(), NSTouch.init()) 227 | } 228 | } 229 | 230 | NSEventClass = MockNSEvent.self 231 | 232 | let event = CGEvent.init(keyboardEventSource: nil, virtualKey: 0, keyDown: false)! 233 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: event.type, event: event, refcon: nil)?.takeUnretainedValue()) 234 | XCTAssertEqual(MockNSEvent.capturedEvent, event) 235 | 236 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 237 | checkKeyEvent() 238 | } 239 | 240 | func testFinger34() { 241 | AppDelegate.CONFIG.gestures["finger-3"] = Shortcut( 242 | id: "finger-3", 243 | key: "A", 244 | enabled: true, 245 | cmd: true 246 | ) 247 | AppDelegate.CONFIG.gestures["finger-4"] = Shortcut( 248 | id: "finger-4", 249 | key: "F3", 250 | enabled: true, 251 | cmd: true 252 | ) 253 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 254 | 255 | class MockNSEvent: NooNSEventBase { 256 | 257 | let cgEvent: CGEvent 258 | required init(cgEvent: CGEvent) { 259 | self.cgEvent = cgEvent 260 | } 261 | 262 | var type: NSEvent.EventType { 263 | get { return NSEvent.EventType.gesture } 264 | } 265 | 266 | var buttonNumber: Int { 267 | get { return 0 } 268 | } 269 | 270 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 271 | if NSEvent.init(cgEvent: self.cgEvent)?.keyCode == 3 { 272 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch()) 273 | } else { 274 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch(), NSTouch()) 275 | } 276 | } 277 | } 278 | 279 | NSEventClass = MockNSEvent.self 280 | 281 | let eventFinger3 = CGEvent.init(keyboardEventSource: nil, virtualKey: 3, keyDown: true)! 282 | let eventFinger4 = CGEvent.init(keyboardEventSource: nil, virtualKey: 4, keyDown: false)! 283 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger3.type, event: eventFinger3, refcon: nil)?.takeUnretainedValue()) 284 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.01) as Date) 285 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger4.type, event: eventFinger4, refcon: nil)?.takeUnretainedValue()) 286 | 287 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 288 | checkKeyEvent() 289 | } 290 | 291 | func testFinger43with4Disabled() { 292 | AppDelegate.CONFIG.gestures["finger-3"] = Shortcut( 293 | id: "finger-3", 294 | key: "F3", 295 | enabled: true, 296 | cmd: true 297 | ) 298 | AppDelegate.CONFIG.gestures["finger-4"]!.enabled = false 299 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 300 | 301 | class MockNSEvent: NooNSEventBase { 302 | 303 | let cgEvent: CGEvent 304 | required init(cgEvent: CGEvent) { 305 | self.cgEvent = cgEvent 306 | } 307 | 308 | var type: NSEvent.EventType { 309 | get { return NSEvent.EventType.gesture } 310 | } 311 | 312 | var buttonNumber: Int { 313 | get { return 0 } 314 | } 315 | 316 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 317 | if NSEvent.init(cgEvent: self.cgEvent)?.keyCode == 3 { 318 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch()) 319 | } else { 320 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch(), NSTouch()) 321 | } 322 | } 323 | } 324 | 325 | NSEventClass = MockNSEvent.self 326 | 327 | let eventFinger3 = CGEvent.init(keyboardEventSource: nil, virtualKey: 3, keyDown: true)! 328 | let eventFinger4 = CGEvent.init(keyboardEventSource: nil, virtualKey: 4, keyDown: false)! 329 | 330 | XCTAssertEqual(eventFinger4, eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger4.type, event: eventFinger4, refcon: nil)?.takeUnretainedValue()) 331 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 332 | XCTAssertEqual(0, MockCGEvent.events.count) 333 | 334 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger3.type, event: eventFinger3, refcon: nil)?.takeUnretainedValue()) 335 | 336 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 337 | checkKeyEvent() 338 | } 339 | 340 | func testFingerCancel3() { 341 | AppDelegate.CONFIG.gestures["finger-3"] = Shortcut( 342 | id: "finger-3", 343 | key: "A", 344 | enabled: true, 345 | cmd: true 346 | ) 347 | AppDelegate.CONFIG.gestures["finger-4"]!.enabled = false 348 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 349 | 350 | class MockNSEvent: NooNSEventBase { 351 | 352 | let cgEvent: CGEvent 353 | required init(cgEvent: CGEvent) { 354 | self.cgEvent = cgEvent 355 | } 356 | 357 | var type: NSEvent.EventType { 358 | get { return NSEvent.EventType.gesture } 359 | } 360 | 361 | var buttonNumber: Int { 362 | get { return 0 } 363 | } 364 | 365 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 366 | if NSEvent.init(cgEvent: self.cgEvent)?.keyCode == 3 { 367 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch()) 368 | } else { 369 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch(), NSTouch(), NSTouch()) 370 | } 371 | } 372 | } 373 | 374 | NSEventClass = MockNSEvent.self 375 | 376 | let eventFinger3 = CGEvent.init(keyboardEventSource: nil, virtualKey: 3, keyDown: true)! 377 | let eventFinger5 = CGEvent.init(keyboardEventSource: nil, virtualKey: 5, keyDown: false)! 378 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger3.type, event: eventFinger3, refcon: nil)?.takeUnretainedValue()) 379 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.01) as Date) 380 | XCTAssertEqual(eventFinger5, eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger5.type, event: eventFinger5, refcon: nil)?.takeUnretainedValue()) 381 | 382 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 383 | XCTAssertEqual(0, MockCGEvent.events.count) 384 | } 385 | 386 | func testFinger34With3Disabled() { 387 | AppDelegate.CONFIG.gestures["finger-3"]!.enabled = false 388 | AppDelegate.CONFIG.gestures["finger-4"] = Shortcut( 389 | id: "finger-4", 390 | key: "F3", 391 | enabled: true, 392 | cmd: true 393 | ) 394 | AppDelegate.CONFIG.gestures["finger-5"]!.enabled = false 395 | 396 | class MockNSEvent: NooNSEventBase { 397 | 398 | let cgEvent: CGEvent 399 | required init(cgEvent: CGEvent) { 400 | self.cgEvent = cgEvent 401 | } 402 | 403 | var type: NSEvent.EventType { 404 | get { return NSEvent.EventType.gesture } 405 | } 406 | 407 | var buttonNumber: Int { 408 | get { return 0 } 409 | } 410 | 411 | func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set { 412 | if NSEvent.init(cgEvent: self.cgEvent)?.keyCode == 3 { 413 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch()) 414 | } else { 415 | return Set.init(arrayLiteral: NSTouch(), NSTouch(), NSTouch(), NSTouch()) 416 | } 417 | } 418 | } 419 | 420 | NSEventClass = MockNSEvent.self 421 | 422 | let eventFinger3 = CGEvent.init(keyboardEventSource: nil, virtualKey: 3, keyDown: true)! 423 | let eventFinger4 = CGEvent.init(keyboardEventSource: nil, virtualKey: 4, keyDown: false)! 424 | XCTAssertEqual(eventFinger3, eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger3.type, event: eventFinger3, refcon: nil)?.takeUnretainedValue()) 425 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.01) as Date) 426 | XCTAssertNil(eventCallback(proxy: CGEventTapProxy(bitPattern: 1)!, type: eventFinger4.type, event: eventFinger4, refcon: nil)?.takeUnretainedValue()) 427 | 428 | RunLoop.current.run(until: NSDate.init(timeIntervalSinceNow: 0.21) as Date) 429 | checkKeyEvent() 430 | } 431 | } 432 | -------------------------------------------------------------------------------- /NooTests/EventLoopRespondToTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventLoopRespondToTestss.swift 3 | // NooTests 4 | // 5 | // Created by Tanin Na Nakorn on 5/22/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import Noo 11 | 12 | class EventLoopRespondToTests: XCTestCase { 13 | 14 | override func setUp() { 15 | continueAfterFailure = false 16 | Config.DEFAULTS = UserDefaults.init(suiteName: "EventLoopTest")! 17 | } 18 | 19 | func testRespondTo() { 20 | AppDelegate.CONFIG.gestures[Config.IDS.first!]!.enabled = false 21 | XCTAssertEqual(false, respondTo(Config.IDS.first!)) 22 | 23 | AppDelegate.CONFIG.gestures[Config.IDS.first!]!.enabled = true 24 | XCTAssertEqual(true, respondTo(Config.IDS.first!)) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /NooTests/EventLoopTriggerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventLoopTests.swift 3 | // NooTests 4 | // 5 | // Created by Tanin Na Nakorn on 5/18/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import Noo 11 | 12 | class EventLoopTriggerTests: XCTestCase { 13 | 14 | var OriginalCGEventClass = CGEventClass 15 | var OriginalNSWorkspaceClass = NSWorkspaceClass 16 | 17 | override func setUp() { 18 | continueAfterFailure = false 19 | MockCGEvent.clear() 20 | Config.DEFAULTS = UserDefaults.init(suiteName: "EventLoopTest")! 21 | AppDelegate.CONFIG.loadDefaults() 22 | 23 | CGEventClass = MockCGEvent.self 24 | NSWorkspaceClass = MockNSWorkspace.self 25 | } 26 | 27 | override func tearDown() { 28 | CGEventClass = OriginalCGEventClass 29 | NSWorkspaceClass = OriginalNSWorkspaceClass 30 | } 31 | 32 | func testTriggerCmd() { 33 | let id = Config.IDS.first! 34 | AppDelegate.CONFIG.gestures[id] = Shortcut( 35 | id: id, 36 | key: "A", 37 | enabled: true, 38 | cmd: true 39 | ) 40 | 41 | trigger(id) 42 | 43 | XCTAssertEqual(2, MockCGEvent.events.count) 44 | XCTAssertEqual( 45 | [CGEventFlags.maskCommand,CGEventFlags.maskCommand], 46 | MockCGEvent.events.map({ e in e.flags }) 47 | ) 48 | XCTAssertEqual( 49 | [Config.KEY_MAP["A"], Config.KEY_MAP["A"]], 50 | MockCGEvent.events.map({ e in e.virtualKey }) 51 | ) 52 | XCTAssertEqual( 53 | [true, true], 54 | MockCGEvent.events.map({ e in e.posted }) 55 | ) 56 | 57 | let down = MockCGEvent.events[0]; 58 | let up = MockCGEvent.events[1]; 59 | 60 | XCTAssertEqual(true, down.keyDown) 61 | XCTAssertEqual(false, up.keyDown) 62 | } 63 | 64 | func testTriggerCmdCtrl() { 65 | let id = Config.IDS.first! 66 | AppDelegate.CONFIG.gestures[id] = Shortcut( 67 | id: id, 68 | key: "F3", 69 | enabled: true, 70 | cmd: true, 71 | ctrl: true 72 | ) 73 | 74 | trigger(id) 75 | 76 | XCTAssertEqual(2, MockCGEvent.events.count) 77 | 78 | let flags = CGEventFlags.init(arrayLiteral: CGEventFlags.maskCommand, CGEventFlags.maskControl) 79 | XCTAssertEqual( 80 | [flags, flags], 81 | MockCGEvent.events.map({ e in e.flags }) 82 | ) 83 | XCTAssertEqual( 84 | [Config.KEY_MAP["F3"], Config.KEY_MAP["F3"]], 85 | MockCGEvent.events.map({ e in e.virtualKey }) 86 | ) 87 | XCTAssertEqual( 88 | [true, true], 89 | MockCGEvent.events.map({ e in e.posted }) 90 | ) 91 | 92 | let down = MockCGEvent.events[0]; 93 | let up = MockCGEvent.events[1]; 94 | 95 | XCTAssertEqual(true, down.keyDown) 96 | XCTAssertEqual(false, up.keyDown) 97 | } 98 | 99 | func testTriggerCmdCtrlOption() { 100 | let id = Config.IDS.first! 101 | AppDelegate.CONFIG.gestures[id] = Shortcut( 102 | id: id, 103 | key: "7", 104 | enabled: true, 105 | cmd: true, 106 | ctrl: true, 107 | option: true 108 | ) 109 | 110 | trigger(id) 111 | 112 | XCTAssertEqual(2, MockCGEvent.events.count) 113 | 114 | let flags = CGEventFlags.init(arrayLiteral: CGEventFlags.maskCommand, CGEventFlags.maskControl, CGEventFlags.maskAlternate) 115 | XCTAssertEqual( 116 | [flags, flags], 117 | MockCGEvent.events.map({ e in e.flags }) 118 | ) 119 | XCTAssertEqual( 120 | [Config.KEY_MAP["7"], Config.KEY_MAP["7"]], 121 | MockCGEvent.events.map({ e in e.virtualKey }) 122 | ) 123 | XCTAssertEqual( 124 | [true, true], 125 | MockCGEvent.events.map({ e in e.posted }) 126 | ) 127 | 128 | let down = MockCGEvent.events[0]; 129 | let up = MockCGEvent.events[1]; 130 | 131 | XCTAssertEqual(true, down.keyDown) 132 | XCTAssertEqual(false, up.keyDown) 133 | } 134 | 135 | func testTriggerCmdCtrlOptionShift() { 136 | let id = Config.IDS.first! 137 | AppDelegate.CONFIG.gestures[id] = Shortcut( 138 | id: id, 139 | key: "7", 140 | enabled: true, 141 | cmd: true, 142 | ctrl: true, 143 | option: true, 144 | shift: true 145 | ) 146 | 147 | trigger(id) 148 | 149 | XCTAssertEqual(2, MockCGEvent.events.count) 150 | 151 | let flags = CGEventFlags.init(arrayLiteral: CGEventFlags.maskCommand, CGEventFlags.maskControl, CGEventFlags.maskAlternate, CGEventFlags.maskShift) 152 | XCTAssertEqual( 153 | [flags, flags], 154 | MockCGEvent.events.map({ e in e.flags }) 155 | ) 156 | XCTAssertEqual( 157 | [Config.KEY_MAP["7"], Config.KEY_MAP["7"]], 158 | MockCGEvent.events.map({ e in e.virtualKey }) 159 | ) 160 | XCTAssertEqual( 161 | [true, true], 162 | MockCGEvent.events.map({ e in e.posted }) 163 | ) 164 | 165 | let down = MockCGEvent.events[0]; 166 | let up = MockCGEvent.events[1]; 167 | 168 | XCTAssertEqual(true, down.keyDown) 169 | XCTAssertEqual(false, up.keyDown) 170 | } 171 | 172 | } 173 | -------------------------------------------------------------------------------- /NooTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NooTests/Mocks.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mocks.swift 3 | // NooTests 4 | // 5 | // Created by Tanin Na Nakorn on 5/22/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | @testable import Noo 11 | 12 | class MockCGEvent: NooCGEventBase { 13 | static var events: [MockCGEvent] = [] 14 | var virtualKey: Int?; 15 | var keyDown: Bool?; 16 | var flags: CGEventFlags = CGEventFlags(); 17 | var posted: Bool = false; 18 | static var tapEnableInvoked: (tap: CFMachPort, enable: Bool)? 19 | 20 | static func clear() { 21 | MockCGEvent.tapEnableInvoked = nil 22 | MockCGEvent.events.removeAll() 23 | } 24 | 25 | required init(virtualKey: Int, keyDown: Bool) { 26 | self.virtualKey = virtualKey 27 | self.keyDown = keyDown 28 | MockCGEvent.events.append(self) 29 | } 30 | 31 | func addFlag(_ flag: CGEventFlags) { 32 | flags.insert(flag) 33 | } 34 | 35 | func post() { 36 | self.posted = true 37 | } 38 | 39 | static func tapEnable(tap: CFMachPort, enable: Bool) { 40 | MockCGEvent.tapEnableInvoked = (tap: tap, enable: enable) 41 | } 42 | } 43 | 44 | class MockNSRunningApplication: NSRunningApplication { 45 | override open var processIdentifier: pid_t { 46 | get { return 1234 } 47 | } 48 | } 49 | 50 | class MockNSWorkspace: NSWorkspace { 51 | override class var shared: NSWorkspace { 52 | get { 53 | return MockNSWorkspace() 54 | } 55 | } 56 | 57 | override var frontmostApplication: NSRunningApplication? { 58 | get { 59 | return MockNSRunningApplication() 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /NooUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NooUITests/NooUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NooUITests.swift 3 | // NooUITests 4 | // 5 | // Created by Tanin Na Nakorn on 5/22/20. 6 | // Copyright © 2020 Tanin Na Nakorn. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | extension Shortcut { 12 | override public func isEqual(_ object: Any?) -> Bool { 13 | guard let other = object as? Shortcut else { return false } 14 | return self.id == other.id && 15 | self.key == other.key && 16 | self.enabled == other.enabled && 17 | self.cmd == other.cmd && 18 | self.ctrl == other.ctrl && 19 | self.option == other.option && 20 | self.shift == other.shift; 21 | } 22 | } 23 | 24 | class NooUITests: XCTestCase { 25 | 26 | var app: XCUIApplication! 27 | var userDefaultsFileName: String! 28 | 29 | override func setUp() { 30 | continueAfterFailure = false 31 | userDefaultsFileName = NSUUID().uuidString 32 | app = XCUIApplication() 33 | app.launchArguments = ["-ui-testing", userDefaultsFileName] 34 | app.launch() 35 | } 36 | 37 | override func tearDown() { 38 | // Put teardown code here. This method is called after the invocation of each test method in the class. 39 | } 40 | 41 | func readConfig(_ id: String) -> Shortcut { 42 | let data = try! Data(contentsOf: NSURL.fileURL(withPathComponents: [NSTemporaryDirectory(), "..", "tanin.noo", userDefaultsFileName])!) 43 | let mappings = try! JSONSerialization.jsonObject(with: data) as! [String:Any] 44 | 45 | return try! Shortcut.decode(id, mappings[id]! as! [String:Any]) 46 | } 47 | 48 | func testExample() { 49 | let statusItem = app.statusItems.firstMatch 50 | statusItem.click() 51 | statusItem.menuItems.firstMatch.click() 52 | 53 | let row = app.tableRows.element(boundBy: 1) 54 | row.cells.firstMatch.checkBoxes.firstMatch.click() 55 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 0).click() 56 | row.cells.element(boundBy: 1).descendants(matching: .popUpButton).element(boundBy: 0).click() 57 | row.menuItems.element(boundBy: 3).click() 58 | 59 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "3", enabled: true, cmd: true)) 60 | 61 | row.cells.element(boundBy: 1).descendants(matching: .popUpButton).element(boundBy: 0).click() 62 | row.menuItems.element(boundBy: 5).click() 63 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: true, cmd: true)) 64 | 65 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 1).click() 66 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: true, cmd: true, ctrl: true)) 67 | 68 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 2).click() 69 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: true, cmd: true, ctrl: true, option: true)) 70 | 71 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 3).click() 72 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: true, cmd: true, ctrl: true, option: true, shift: true)) 73 | 74 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 0).click() 75 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 1).click() 76 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 2).click() 77 | row.cells.element(boundBy: 1).descendants(matching: .checkBox).element(boundBy: 3).click() 78 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: true)) 79 | 80 | row.cells.firstMatch.checkBoxes.firstMatch.click() 81 | XCTAssertEqual(readConfig("finger-4"), Shortcut(id: "finger-4", key: "5", enabled: false)) 82 | 83 | let anotherRow = app.tableRows.element(boundBy: 5) 84 | anotherRow.cells.firstMatch.checkBoxes.firstMatch.click() 85 | XCTAssertEqual(readConfig("mouse-button-3"), Shortcut(id: "mouse-button-3", key: "0", enabled: true)) 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /PRIVACY_POLICY: -------------------------------------------------------------------------------- 1 | Privacy policy 2 | =============== 3 | 4 | Noo doesn't collect any information about you. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Noo 2 | ---- 3 | 4 | [![Download from Mac App Store](./download-button.svg)](https://apps.apple.com/us/app/noo-mouse/id1514904040) 5 | 6 | Noo allows you to map mouse buttons and multi-touch gestures to any combination of keys. 7 | 8 | ![screenshot](./screenshot.png) 9 | 10 | When working at a desk, I use [Evoluent mouse](https://evoluent.com/) which has 6 buttons. Here are the mappings I use: 11 | 12 | * an extra mouse button to `Cmd + c` for copying 13 | * an extra mouse button to `Cmd + v` for pasting 14 | * an extra mouse button to `Cmd + F3` for activating [Tip](https://github.com/tanin47/tip) (a programmable tooltip on OS X) 15 | 16 | When on the go, I use Noo to map 4-finger touch to `Cmd + F3` for activating [Tip](https://github.com/tanin47/tip). 17 | 18 | I strongly recommend investing in a mouse with extra buttons (e.g. [Evoluent mouse](https://evoluent.com/) with has 3 extra buttons and [Logitech G600](https://www.amazon.com/Logitech-Gaming-Backlit-Programmable-Buttons/dp/B0086UK7IQ/) with 12 extra buttons). 19 | 20 | These mouse are great for reducing hand movement that will reduce the risk of injury (e.g. [RSI](https://www.nhs.uk/conditions/repetitive-strain-injury-rsi/) and [Carpal tunnel syndrome](https://www.webmd.com/pain-management/carpal-tunnel/carpal-tunnel-syndrome#1)). 21 | 22 | Installation 23 | ------------- 24 | 25 | You can install it from the Mac App Store: https://apps.apple.com/us/app/noo-mouse/id1514904040 26 | 27 | Noo needs access to the accessbility feature. You can grant it under "Security & Privacy". 28 | 29 | Testing 30 | -------- 31 | 32 | - Test Ctrl + Up Arrow for Mission Control 33 | - Test Option + C that types ç 34 | - Test Cmd + C that copies text 35 | - Test Shift + C that types C 36 | - Test touchpad for 3 fingers 37 | 38 | 39 | Questions? 40 | ----------- 41 | 42 | Please don't hesitate to open [a Github issue](https://github.com/tanin47/noo/issues). 43 | -------------------------------------------------------------------------------- /download-button.svg: -------------------------------------------------------------------------------- 1 | 2 | Download_on_the_Mac_App_Store_Badge_US-UK_RGB_blk_092917 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /originalicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/originalicon.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanin47/noo/0477c5d6c1f442dd703048d63e57a12f33eaff6f/screenshot.png --------------------------------------------------------------------------------