├── source ├── icon.png └── info.plist ├── QR Code.alfredworkflow ├── LICENSE └── README.md /source/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TorreyBetts/Alfred-QRCode/HEAD/source/icon.png -------------------------------------------------------------------------------- /QR Code.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TorreyBetts/Alfred-QRCode/HEAD/QR Code.alfredworkflow -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Torrey Betts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Alfred-QRCode 2 | All of the QR code generator workflows I've come across use a dependency, such as an external installation, embedded app, or web service. Given that MacOS can create QR codes natively, that's what I did with this workflow. 3 | image 4 | 5 | # Installation 6 | This workflow doesn't require any dependencies for installation, all that is required is to double click and import the workflow into Alfred. If you wish to enable a selection hotkey, look for the yellow workflow action to configure. 7 | 8 | image 9 | 10 | # Usage 11 | The current version of this workflow contains two keywords for Alfred, **qrc** & **qrp**. When using either **qrc** or **qrp** without a parameter this workflow will attempt to use text contained on the clipboard. This same flow is followed if you set a hotkey for the selection and nothing is selected. 12 | 13 | The universal actions use the selected text as the parameter. 14 | 15 | - **qrc [your text]** -- Creates your QR code and copies it to the clipboard 16 | - **qrp [your text]** -- Creates your QR code, by copying it to the clipboard and also opens it with Preview for saving 17 | 18 | image 19 | image 20 | 21 | -------------------------------------------------------------------------------- /source/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | torreybetts.qrcode 7 | category 8 | Tools 9 | connections 10 | 11 | 085ABB0D-A6F1-4195-AF37-23C05BC3A68F 12 | 13 | 14 | destinationuid 15 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 26D6F3D1-0F26-4DF6-9DC8-5907D095CC7D 25 | 26 | 27 | destinationuid 28 | ED4BA57A-6E92-465F-804D-C0610F36F3D8 29 | modifiers 30 | 0 31 | modifiersubtext 32 | 33 | vitoclose 34 | 35 | 36 | 37 | 69E74F08-81D7-4945-A81C-D2152D5B903A 38 | 39 | 40 | destinationuid 41 | DD056B37-7CB9-4DF6-8E62-AA7BFF44323A 42 | modifiers 43 | 0 44 | modifiersubtext 45 | 46 | vitoclose 47 | 48 | 49 | 50 | 6D021D24-E739-4C01-9FCF-D4080D197015 51 | 52 | 53 | destinationuid 54 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 55 | modifiers 56 | 0 57 | modifiersubtext 58 | 59 | vitoclose 60 | 61 | 62 | 63 | 7E5026FA-0CEB-44B4-A9A4-09B7AE9A9E03 64 | 65 | 66 | destinationuid 67 | 9D4FD58E-9295-46E7-AE60-61E5353CF1DF 68 | modifiers 69 | 0 70 | modifiersubtext 71 | 72 | sourceoutputuid 73 | C43E5DC4-79EB-42A1-A07E-6170E1173C63 74 | vitoclose 75 | 76 | 77 | 78 | destinationuid 79 | 69E74F08-81D7-4945-A81C-D2152D5B903A 80 | modifiers 81 | 0 82 | modifiersubtext 83 | 84 | vitoclose 85 | 86 | 87 | 88 | 97570741-BC1B-4431-95D9-00CED513F925 89 | 90 | 91 | destinationuid 92 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 93 | modifiers 94 | 0 95 | modifiersubtext 96 | 97 | vitoclose 98 | 99 | 100 | 101 | 9D4FD58E-9295-46E7-AE60-61E5353CF1DF 102 | 103 | 104 | destinationuid 105 | D800CE2C-2360-449D-9F4E-526651F15365 106 | modifiers 107 | 0 108 | modifiersubtext 109 | 110 | vitoclose 111 | 112 | 113 | 114 | C33AEA5B-EF43-41A0-A642-D58BC42BB124 115 | 116 | 117 | destinationuid 118 | ED4BA57A-6E92-465F-804D-C0610F36F3D8 119 | modifiers 120 | 0 121 | modifiersubtext 122 | 123 | vitoclose 124 | 125 | 126 | 127 | D800CE2C-2360-449D-9F4E-526651F15365 128 | 129 | 130 | destinationuid 131 | 2C5AB846-2028-4D02-9553-4DAB82486288 132 | modifiers 133 | 0 134 | modifiersubtext 135 | 136 | sourceoutputuid 137 | A7859C22-C529-4B8A-9CC1-2223C36027C1 138 | vitoclose 139 | 140 | 141 | 142 | destinationuid 143 | FB75E7A7-CEE2-4D7E-8E0E-C2644A591D77 144 | modifiers 145 | 0 146 | modifiersubtext 147 | 148 | vitoclose 149 | 150 | 151 | 152 | DD056B37-7CB9-4DF6-8E62-AA7BFF44323A 153 | 154 | 155 | destinationuid 156 | 9D4FD58E-9295-46E7-AE60-61E5353CF1DF 157 | modifiers 158 | 0 159 | modifiersubtext 160 | 161 | sourceoutputuid 162 | 011E373E-95CC-4934-941E-ACB64E5D1D60 163 | vitoclose 164 | 165 | 166 | 167 | destinationuid 168 | 13509B60-16B9-4CAB-B12C-8DF10B5ED8C1 169 | modifiers 170 | 0 171 | modifiersubtext 172 | 173 | vitoclose 174 | 175 | 176 | 177 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 178 | 179 | 180 | destinationuid 181 | 7E5026FA-0CEB-44B4-A9A4-09B7AE9A9E03 182 | modifiers 183 | 0 184 | modifiersubtext 185 | 186 | vitoclose 187 | 188 | 189 | 190 | ED4BA57A-6E92-465F-804D-C0610F36F3D8 191 | 192 | 193 | destinationuid 194 | 7E5026FA-0CEB-44B4-A9A4-09B7AE9A9E03 195 | modifiers 196 | 0 197 | modifiersubtext 198 | 199 | vitoclose 200 | 201 | 202 | 203 | 204 | createdby 205 | Torrey Betts 206 | description 207 | Generates a QR code 208 | disabled 209 | 210 | name 211 | QR Code 212 | objects 213 | 214 | 215 | config 216 | 217 | action 218 | 0 219 | argument 220 | 1 221 | focusedappvariable 222 | 223 | focusedappvariablename 224 | 225 | hotkey 226 | 0 227 | hotmod 228 | 0 229 | hotstring 230 | 231 | leftcursor 232 | 233 | modsmode 234 | 0 235 | relatedAppsMode 236 | 0 237 | 238 | type 239 | alfred.workflow.trigger.hotkey 240 | uid 241 | 085ABB0D-A6F1-4195-AF37-23C05BC3A68F 242 | version 243 | 2 244 | 245 | 246 | config 247 | 248 | concurrently 249 | 250 | escaping 251 | 68 252 | script 253 | on run argv 254 | tell application "Preview" 255 | activate 256 | end tell 257 | 258 | tell application "System Events" 259 | tell process "Preview" 260 | keystroke "n" using {command down} 261 | end tell 262 | end tell 263 | end run 264 | scriptargtype 265 | 1 266 | scriptfile 267 | 268 | type 269 | 6 270 | 271 | type 272 | alfred.workflow.action.script 273 | uid 274 | 2C5AB846-2028-4D02-9553-4DAB82486288 275 | version 276 | 2 277 | 278 | 279 | config 280 | 281 | concurrently 282 | 283 | escaping 284 | 68 285 | script 286 | use framework "Foundation" use framework "CoreImage" use framework "AppKit" use framework "CoreGraphics" use scripting additions 287 | 288 | on run argv 289 | try 290 | set theQuery to item 1 of argv set theQRCode to my createQRCodeImageObjectForString(theQuery) set theClipBooard to current application's NSPasteboard's generalPasteboard() theClipBooard's clearContents() theClipBooard's writeObjects:{theQRCode} end try 291 | end run 292 | 293 | on createQRCodeImageObjectForString(thisString) set thisString to current application's NSString's stringWithString:thisString set thisData to thisString's dataUsingEncoding:(current application's NSUTF8StringEncoding) set anImageFilter to current application's CIFilter's filterWithName:"CIQRCodeGenerator" anImageFilter's setDefaults() anImageFilter's setValue:thisData forKey:"inputMessage" anImageFilter's setValue:"L" forKey:"inputCorrectionLevel" set baseImage to anImageFilter's outputImage() set aTransform to current application's CGAffineTransform's CGAffineTransformMakeScale(100.0, 100.0) set outputImage to baseImage's imageByApplyingTransform:aTransform set imageRepresentation to current application's NSCIImageRep's imageRepWithCIImage:outputImage set resultingImageObject to current application's NSImage's alloc()'s initWithSize:(imageRepresentation's |size|()) resultingImageObject's addRepresentation:imageRepresentation return resultingImageObject end createQRCodeImageObjectForString 294 | scriptargtype 295 | 1 296 | scriptfile 297 | 298 | type 299 | 6 300 | 301 | type 302 | alfred.workflow.action.script 303 | uid 304 | 9D4FD58E-9295-46E7-AE60-61E5353CF1DF 305 | version 306 | 2 307 | 308 | 309 | config 310 | 311 | acceptsfiles 312 | 313 | acceptsmulti 314 | 0 315 | acceptstext 316 | 317 | acceptsurls 318 | 319 | name 320 | Create QR Code (Preview) 321 | 322 | type 323 | alfred.workflow.trigger.universalaction 324 | uid 325 | 6D021D24-E739-4C01-9FCF-D4080D197015 326 | version 327 | 1 328 | 329 | 330 | config 331 | 332 | conditions 333 | 334 | 335 | inputstring 336 | {var:USES_PREVIEW} 337 | matchcasesensitive 338 | 339 | matchmode 340 | 0 341 | matchstring 342 | yes 343 | outputlabel 344 | Preview 345 | uid 346 | A7859C22-C529-4B8A-9CC1-2223C36027C1 347 | 348 | 349 | elselabel 350 | Notification 351 | 352 | type 353 | alfred.workflow.utility.conditional 354 | uid 355 | D800CE2C-2360-449D-9F4E-526651F15365 356 | version 357 | 1 358 | 359 | 360 | config 361 | 362 | lastpathcomponent 363 | 364 | onlyshowifquerypopulated 365 | 366 | removeextension 367 | 368 | text 369 | The QR code was copied to the clipboard 370 | title 371 | QR Copied 372 | 373 | type 374 | alfred.workflow.output.notification 375 | uid 376 | FB75E7A7-CEE2-4D7E-8E0E-C2644A591D77 377 | version 378 | 1 379 | 380 | 381 | config 382 | 383 | argumenttype 384 | 1 385 | keyword 386 | qrp 387 | subtext 388 | Create and open QR code in Preview with '{query}' 389 | text 390 | Create QR Code 391 | withspace 392 | 393 | 394 | type 395 | alfred.workflow.input.keyword 396 | uid 397 | 97570741-BC1B-4431-95D9-00CED513F925 398 | version 399 | 1 400 | 401 | 402 | config 403 | 404 | conditions 405 | 406 | 407 | inputstring 408 | 409 | matchcasesensitive 410 | 411 | matchmode 412 | 1 413 | matchstring 414 | 415 | outputlabel 416 | Use Input 417 | uid 418 | C43E5DC4-79EB-42A1-A07E-6170E1173C63 419 | 420 | 421 | elselabel 422 | Use Clipboard 423 | 424 | type 425 | alfred.workflow.utility.conditional 426 | uid 427 | 7E5026FA-0CEB-44B4-A9A4-09B7AE9A9E03 428 | version 429 | 1 430 | 431 | 432 | config 433 | 434 | argument 435 | {query} 436 | passthroughargument 437 | 438 | variables 439 | 440 | USES_PREVIEW 441 | yes 442 | 443 | 444 | type 445 | alfred.workflow.utility.argument 446 | uid 447 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 448 | version 449 | 1 450 | 451 | 452 | config 453 | 454 | concurrently 455 | 456 | escaping 457 | 68 458 | script 459 | on run argv 460 | try 461 | set theText to (the clipboard as text) 462 | return theText 463 | end try 464 | end run 465 | scriptargtype 466 | 1 467 | scriptfile 468 | 469 | type 470 | 6 471 | 472 | type 473 | alfred.workflow.action.script 474 | uid 475 | 69E74F08-81D7-4945-A81C-D2152D5B903A 476 | version 477 | 2 478 | 479 | 480 | config 481 | 482 | lastpathcomponent 483 | 484 | onlyshowifquerypopulated 485 | 486 | removeextension 487 | 488 | text 489 | The QR creation failed due to clipboard not containing text 490 | title 491 | QR Failed 492 | 493 | type 494 | alfred.workflow.output.notification 495 | uid 496 | 13509B60-16B9-4CAB-B12C-8DF10B5ED8C1 497 | version 498 | 1 499 | 500 | 501 | config 502 | 503 | conditions 504 | 505 | 506 | inputstring 507 | 508 | matchcasesensitive 509 | 510 | matchmode 511 | 1 512 | matchstring 513 | 514 | outputlabel 515 | Success 516 | uid 517 | 011E373E-95CC-4934-941E-ACB64E5D1D60 518 | 519 | 520 | elselabel 521 | Failure 522 | 523 | type 524 | alfred.workflow.utility.conditional 525 | uid 526 | DD056B37-7CB9-4DF6-8E62-AA7BFF44323A 527 | version 528 | 1 529 | 530 | 531 | config 532 | 533 | argumenttype 534 | 1 535 | keyword 536 | qrc 537 | subtext 538 | Create and copy QR code with '{query}' 539 | text 540 | Create QR Code 541 | withspace 542 | 543 | 544 | type 545 | alfred.workflow.input.keyword 546 | uid 547 | C33AEA5B-EF43-41A0-A642-D58BC42BB124 548 | version 549 | 1 550 | 551 | 552 | config 553 | 554 | argument 555 | {query} 556 | passthroughargument 557 | 558 | variables 559 | 560 | USES_PREVIEW 561 | no 562 | 563 | 564 | type 565 | alfred.workflow.utility.argument 566 | uid 567 | ED4BA57A-6E92-465F-804D-C0610F36F3D8 568 | version 569 | 1 570 | 571 | 572 | config 573 | 574 | acceptsfiles 575 | 576 | acceptsmulti 577 | 0 578 | acceptstext 579 | 580 | acceptsurls 581 | 582 | name 583 | Create QR Code (clipboard) 584 | 585 | type 586 | alfred.workflow.trigger.universalaction 587 | uid 588 | 26D6F3D1-0F26-4DF6-9DC8-5907D095CC7D 589 | version 590 | 1 591 | 592 | 593 | readme 594 | All of the QR code generator workflows I've come across use a dependency, such as an external installation, embedded app, or web service. Given that MacOS can create QR codes natively, that's what I did with this workflow. 595 | 596 | I've configured this to use two different keywords, qrc & qrp. The qrc keyword creates a QR code that copied to the clipboard. The other keyword, qrp does the same thing, except at the end it'll open the QR code in Preview to allow saving as an image/pdf. 597 | 598 | When using either qrc or qrp without a parameter this workflow will attempt to use text contained on the clipboard. This same flow is followed if you set a hotkey for the selection and nothing is selected. 599 | 600 | The universal actions act use the selected text as the parameter. 601 | 602 | Example Usage 603 | 604 | qrp https://github.com/TorreyBetts/Alfred-QRCode 605 | uidata 606 | 607 | 085ABB0D-A6F1-4195-AF37-23C05BC3A68F 608 | 609 | colorindex 610 | 3 611 | note 612 | Set your hotkey to enable QR creation from text selection or clipboard text 613 | xpos 614 | 30 615 | ypos 616 | 20 617 | 618 | 13509B60-16B9-4CAB-B12C-8DF10B5ED8C1 619 | 620 | xpos 621 | 755 622 | ypos 623 | 440 624 | 625 | 26D6F3D1-0F26-4DF6-9DC8-5907D095CC7D 626 | 627 | colorindex 628 | 7 629 | xpos 630 | 30 631 | ypos 632 | 565 633 | 634 | 2C5AB846-2028-4D02-9553-4DAB82486288 635 | 636 | xpos 637 | 760 638 | ypos 639 | 145 640 | 641 | 69E74F08-81D7-4945-A81C-D2152D5B903A 642 | 643 | xpos 644 | 420 645 | ypos 646 | 425 647 | 648 | 6D021D24-E739-4C01-9FCF-D4080D197015 649 | 650 | colorindex 651 | 7 652 | xpos 653 | 30 654 | ypos 655 | 200 656 | 657 | 7E5026FA-0CEB-44B4-A9A4-09B7AE9A9E03 658 | 659 | xpos 660 | 265 661 | ypos 662 | 340 663 | 664 | 97570741-BC1B-4431-95D9-00CED513F925 665 | 666 | xpos 667 | 30 668 | ypos 669 | 320 670 | 671 | 9D4FD58E-9295-46E7-AE60-61E5353CF1DF 672 | 673 | xpos 674 | 465 675 | ypos 676 | 175 677 | 678 | C33AEA5B-EF43-41A0-A642-D58BC42BB124 679 | 680 | xpos 681 | 30 682 | ypos 683 | 445 684 | 685 | D800CE2C-2360-449D-9F4E-526651F15365 686 | 687 | xpos 688 | 625 689 | ypos 690 | 225 691 | 692 | DD056B37-7CB9-4DF6-8E62-AA7BFF44323A 693 | 694 | xpos 695 | 610 696 | ypos 697 | 445 698 | 699 | E56EEFCE-2FF8-4FD0-9B5B-F4018F944025 700 | 701 | xpos 702 | 185 703 | ypos 704 | 350 705 | 706 | ED4BA57A-6E92-465F-804D-C0610F36F3D8 707 | 708 | xpos 709 | 180 710 | ypos 711 | 475 712 | 713 | FB75E7A7-CEE2-4D7E-8E0E-C2644A591D77 714 | 715 | xpos 716 | 765 717 | ypos 718 | 270 719 | 720 | 721 | variablesdontexport 722 | 723 | version 724 | 1.0.3 725 | webaddress 726 | https://github.com/TorreyBetts/Alfred-QRCode 727 | 728 | 729 | --------------------------------------------------------------------------------