r/AwesomeCopy • Developer • 11d ago

Text selection extensions demo

https://youtu.be/TbKrNYWEmxM

There are so many cool things you can do with the text selection extensions. here is just one, but I'll add a list of tons more below, and you can come up with your own and do anything you want really. also note that this video shows some not yet released features such as add the YAML text directly into the settings window.. currently you have to import a file which is slightly less convenient.

Awesome Copy: Text Selection Extension Examples

Awesome Copy lets you create custom text selection actions using YAML. Select text in almost any Mac app and instantly search websites, transform text, run scripts, and more.

Here are 25 examples organized by category. Each example can be added to your own extension.

🔎 Web Search & Research

Search Google

- title: Search Google
  icon: G
  url: https://www.google.com/search?q={text}

Search DuckDuckGo

- title: Search DuckDuckGo
  icon: D
  url: https://duckduckgo.com/?q={text}

Search Reddit

- title: Search Reddit
  icon: R
  url: https://www.reddit.com/search/?q={text}

Search Images

- title: Search Images
  icon: photo
  url: https://www.google.com/search?tbm=isch&q={text}

Search YouTube

- title: Search YouTube
  icon: play.rectangle
  url: https://www.youtube.com/results?search_query={text}

Search Wikipedia

- title: Search Wikipedia
  icon: W
  url: https://en.wikipedia.org/w/index.php?search={text}

Urban Dictionary

- title: Urban Dictionary
  icon: U
  url: https://www.urbandictionary.com/define.php?term={text}

Wolfram Alpha

- title: Wolfram Alpha
  icon: function
  url: https://www.wolframalpha.com/input?i={text}

Wayback Search

- title: Wayback Search
  icon: clock.arrow.circlepath
  url: https://web.archive.org/web/*/{text}

📖 Productivity & Reference

Open Dictionary

- title: Open Dictionary
  icon: book
  url: dict://{text}

Translate

- title: Translate
  icon: character.book.closed
  url: https://translate.google.com/?sl=auto&tl=en&text={text}&op=translate

Email Selection

- title: Email Selection
  icon: envelope
  url: mailto:?subject={text}&body={text}

Search Maps

- title: Search Maps
  icon: map
  url: https://www.google.com/maps/search/{text}

✏️ Text Formatting & Transformation

Script output is copied to the clipboard.

Uppercase Selection

- title: Uppercase Selection
  icon: textformat
  interpreter: /bin/zsh
  script: |
    printf '%s\n' "$AWESOME_COPY_TEXT" | tr '[:lower:]' '[:upper:]'

Lowercase Selection

- title: Lowercase Selection
  icon: textformat
  interpreter: /bin/zsh
  script: |
    printf '%s\n' "$AWESOME_COPY_TEXT" | tr '[:upper:]' '[:lower:]'

Title Case

- title: Title Case
  icon: textformat.size
  interpreter: python3
  script: |
    import os
    print(os.environ["AWESOME_COPY_TEXT"].title())

Slugify

Convert text into a URL-friendly slug.

- title: Slugify
  icon: link
  interpreter: python3
  script: |
    import os
    import re
    text = os.environ["AWESOME_COPY_TEXT"].lower()
    text = re.sub(r"[^a-z0-9]+", "-", text).strip("-")
    print(text)

Markdown Quote

- title: Markdown Quote
  icon: text.quote
  interpreter: /bin/zsh
  script: |
    printf '%s\n' "$AWESOME_COPY_TEXT" | sed 's/^/> /'

Quote Text

- title: Quote Text
  icon: quote.bubble
  interpreter: python3
  script: |
    import os
    text = os.environ["AWESOME_COPY_TEXT"]
    print(f'"{text}"')

💻 Developer Utilities

JSON String

- title: JSON String
  icon: curlybraces
  interpreter: python3
  script: |
    import json
    import os
    print(json.dumps(os.environ["AWESOME_COPY_TEXT"]))

URL Encode

- title: URL Encode
  icon: percent
  interpreter: python3
  script: |
    import os
    import urllib.parse
    print(urllib.parse.quote(os.environ["AWESOME_COPY_TEXT"], safe=""))

URL Decode

- title: URL Decode
  icon: percent
  interpreter: python3
  script: |
    import os
    import urllib.parse
    print(urllib.parse.unquote(os.environ["AWESOME_COPY_TEXT"]))

HTML Escape

- title: HTML Escape
  icon: chevron.left.forwardslash.chevron.right
  interpreter: python3
  script: |
    import html
    import os
    print(html.escape(os.environ["AWESOME_COPY_TEXT"]))

Base64 Encode

- title: Base64 Encode
  icon: "64"
  interpreter: python3
  script: |
    import base64
    import os
    data = os.environ["AWESOME_COPY_TEXT"].encode("utf-8")
    print(base64.b64encode(data).decode("ascii"))

Clean URL

Remove common tracking parameters from URLs.

- title: Clean URL
  icon: wand.and.stars
  interpreter: python3
  script: |
    import os
    import urllib.parse

    url = os.environ["AWESOME_COPY_TEXT"].strip()
    parsed = urllib.parse.urlsplit(url)
    blocked = {"fbclid", "gclid", "mc_cid", "mc_eid"}

    query = [
        (key, value)
        for key, value in urllib.parse.parse_qsl(
            parsed.query, keep_blank_values=True
        )
        if not key.startswith("utm_") and key not in blocked
    ]

    print(urllib.parse.urlunsplit((
        parsed.scheme,
        parsed.netloc,
        parsed.path,
        urllib.parse.urlencode(query),
        parsed.fragment
    )))

📝 Notes & Text Utilities

Save to Text File

Append selected text to a local file with a timestamp.

- title: Save to Text File
  icon: square.and.pencil
  interpreter: /bin/zsh
  script: |
    mkdir -p "$AWESOME_COPY_SUPPORT_DIR"
    {
      date '+%Y-%m-%d %H:%M:%S'
      printf '%s\n' "$AWESOME_COPY_TEXT"
    } >> "$AWESOME_COPY_SUPPORT_DIR/Text Selection Notes.txt"
    printf 'Saved to %s\n' "$AWESOME_COPY_SUPPORT_DIR/Text Selection Notes.txt"

Create Apple Note

Create a new note in Apple Notes. macOS may request Automation permission.

- title: Create Apple Note
  icon: note.text
  interpreter: /usr/bin/osascript
  script: |
    tell application "Notes"
        set selectedText to system attribute "AWESOME_COPY_TEXT"
        if selectedText is "" then return
        set noteTitle to "Awesome Copy Selection"
        make new note at default folder with properties {name:noteTitle, body:selectedText}
        activate
    end tell

Word Count

- title: Word Count
  icon: number
  interpreter: python3
  script: |
    import os
    text = os.environ["AWESOME_COPY_TEXT"]
    words = len(text.split())
    chars = len(text)
    print(f"{words} words, {chars} characters")

⚙️ Creating Your Own Extensions

The examples above are individual actions. To combine them into one extension, start your YAML file with:

name: Awesome Copy Text Selection Extension
actions:

Then place your chosen actions underneath actions:, indenting each action and its contents by two additional spaces.

For URL actions, {text} represents the selected text.

For scripts, AWESOME_COPY_TEXT contains the selected text, and AWESOME_COPY_SUPPORT_DIR provides a location for storing extension data.

These examples are just a starting point. You can customize the actions, use different interpreters, and build workflows that fit your needs.

Have an idea for another useful extension? Share it in the comments!

5 Upvotes

4 comments sorted by

2

u/KaleidoscopeStill123 Pro User 11d ago

Bookmarking this.

2

u/Awesome_Copy Developer 11d ago

🍻 I just cleaned up the examples above so they are easier to read

1

u/vcdx71 Pro User 10d ago

I've never been able to get the text selection stuff to work, even in the latest 8.1 b4 release. I had Antigravity check it out and it suggested to turn on activate on hover, which works, it said this is why.. I've not verified any of it but thought I'd let you know..

TextSelectionPanel uses .nonactivatingPanel and returns false from canBecomeKeyWindow (logging Warning: -[NSWindow makeKeyWindow] called on ...TextSelectionPanel which returned NO from -[NSWindow canBecomeKeyWindow] on showWindow).

TextSelectionPopupController wraps TextSelectionPopupView in a plain NSHostingView instead of FirstClickHostingView (acceptsFirstMouse(for:) -> true) or allowing canBecomeKeyWindow = true like PasteStackPanel / DynamicIslandPanel, so clicks on SwiftUI.Button(.plain) inside the inactive LSUIElement panel are dropped on macOS 27.2.1.

2

u/Awesome_Copy Developer 10d ago

wow that's so cool, thanks for this info, I'll see what I can do with this info to fix the issue!