Introducing Extension Snippets

PopClip 2021.11 introduced a new, simple way to create and share your own extensions, which I am calling Extension Snippets.

EDIT, 13 Oct, 2023: Snippets now have their own page in the PopClip documentation here: Snippets

It is easiest to show with examples, so without further ado, here is an extension snippet:

# popclip
name: Emojipedia
url: https://emojipedia.org/search/?q=***

Select that text above, and you’ll see an “Install Extension” action in PopClip:

CleanShot 2021-11-16 at 17.51.09

Wait, what just happened?!:exploding_head:

You installed a new extension in PopClip just by selecting some text! This particular extension will search Emojipedia for the selected text.

Hopefully you are starting to realise the possibilities. You can now create your own extensions just by typing text in a text field and selecting it. You can do it anywhere you can type text — in the TextEdit app, in your favourite notes app, anywhere you like.

For example, you can go ahead and change the name and the URL from the example above to anything you like, to create your own search extension (keeping the *** as the search query placeholder).

Extension snippets are also easy to share with others, since you can put them anywhere you can put text.

NOTE: When typing a snippet in this forum, you’ll need to format it as Preformatted Text (using the toolbar button, or use three backticks ``` on the lines before and after)

I need to know more :teacher:

The format of an extension snippet is actually the same as for a regular extension — which is all documented in detail here.

A snippet must start with the first line # popclip (with or without the space) and must be no more than 1000 5000 characters.

The snippet uses a format called YAML to define the extension’s properties such as its name, icon, and to define its action. If that sounds complicated, don’t worry. Usually you can just copy one of the examples and edit it.

Snippets can be used for all types of PopClip extension, except Shell Script extensions. So you can use snippets to open URLs, run Shortcuts, call Services, press keys, run AppleScripts, and run JavaScript code.

Adding an icon :artist:

Let’s go back to the Emojipedia example. Let’s say we want to give it an icon. We can do this as follows:

# popclip
name: Emojipedia
icon: search filled E
url: https://emojipedia.org/search/?q=***

You’ll see I added the line icon: search filled E. This gives the action a magnifying glass icon with an E in it:

Instead of a magnifying glass you can put it in a circle or a square, filled or not filled. And using symbol:<symbol name> you can use macOS’s built in SF Symbols icons. Here are some examples:

Next steps :foot:

Rather than make this post really long, I’m going to be posting in this forum some “How To” guides with examples of various types of extension (see below).

Please use the PopClip Extensions forum category to post snippets you’ve made that might be useful to others.

Hopefully, that whetted your appetite for the possibilities of Extension Snippets. Stay tuned for more to come.

Snippet Guides

18 Likes
How to make a Key Press extension in PopClip — TextExpander example
Clip selection to Obsidian
Idea: Paste with reference
Copy from address bar as Markdown URL with title
add a fixed text (configurable) before the selection and search the set on Google
Google search – option for exact match
Snippet: Bing search in Microsoft Edge
Request: Replace various types of types of quotes
Idea: Restore Clipboard
Send to Raycast
Request: Extension for Kagi Search
Underline extension?
A PopClip extension for ChatGPT
Arc Browser by "The Browser Company"
Creating email: subject and body
Removed "Show & Tell" category
Updated extension: DeepL Translator
Mighty Browser support
Add specific phrase before selected text
New Word document with text
Excel & Spotlight
Paste w/ Prepend or Append
Open URL in IINA
Convert words to hashtags ("Hashtag List")
Reddit search extension
Adding an Option to the + Extension
Emoji Extension snippet
Dropover extension
Redacting each character in a selection
New extention for Weee! (an Asian / Hispano online grocery store)
S p a c e d w o r d s
Create a new .txt file?
Example snippet: Use of regex, copy to clipboard (remove $ symbols)
Timestamp only for time
Snippet: Search DuckDuckGo in DuckDuckGo Browser
Open links in background
Opening custom extension's URL with a non-default web browser
No ❤️ for LogSeq?
TEXT TO AUDIO FILE using Popclip
PopClip extension snippet for DeepL Write
Snippet: Replace Slash with Dash or Period
Calculate time from text
SCIENTISTS NEED HELP (Extension for Sci-Hub)
‌‌‌‌‌Get the context of the selected text
Extension snippet: Start Dictation
Extension to rename PDFs
Get archive link from the Wayback Machine
Can You add the option to change font colors
Add chrome:// prefix to Open Link
Possible to connect to Notebooks?
How to get a Strikethrough extension in PopClip
Apple Notes extension isn't working
Grab URL of Selected Text?
[Feature Request] Option to always search using default browser
Amboss,Goodnotes incorporation issue
Extension for OpenStreetMap
Extension for Iconify
Add hyperlink to text
Etymologies and Ancient languages
Extension for searching LEGO® sets
Set my own Search Query Option?
How to access macOS Writing Tools using PopClip
Quotes ext: add asterisk?
Paste Wikilink as Text Alias in Obsidian
Modification of an Extension of Brackets
Error "Cannot Install Extension"
Remove /* */ comments
Can "Open Link" go to default browser instead of current?
Europen numbers
Open App instead of Web Browser
Append Selected Text to URL and Go
Extension for GoToFile
Request: Terminology App
Clean up spaces (duplicate and/or non-breaking)
Extension to make a link (⌘K)
Remove Vertical Line(s)
Extension to remove new lines and hyphens at the end of the line
Reddit Search Extension + Reddit via Google
How to turn an extension snippet into an openable extension [.popcliptxt files]
[request] Extension: Search on Tenor
WineSearcher Search Extension?
Replace single line breaks with double line breaks
Copy link to text in web page [URL Fragment Text Directives]
Plugin for Twos app
String pasting extension?
Any Extension for Fancy or Styled Text (Unicode Fonts)?
Incorrect PopClip extension made by ChatGPT
Twitter & Instagram username search
Swap Name (Doe, John → John Doe)
Date converter snippet
Sentence case in German
Extension Snippet: Remove Dots
A PopClip extension for ChatGPT
Popclip to Dynalist
Search two (or more) sites at once
Search with "pronounce:" and "define:"
Swap Name (Doe, John → John Doe)
Possible to connect to Upnote?
Possible to connect to Upnote?
Form an MD link from highlighted text and URL
Remove MediaWiki links
Snippet: Replace Slash with Dash or Period
English comma to Chinese full-width enumeration comma
Etimonline, please :-)
Snippet: Uppercase first letter of each line
Add double square brackets to selection (Wikilinks)
Spotify extension does not work since latest Spotify app update
Remove Duplicate Words
Delete hyphen and close up word
Incorrect PopClip extension made by ChatGPT
Extension ideas for searching media (Metacritic, Genius and JustWatch)
Add custom icon functionality
Extension for pressing various keyboard shortcuts
Search extensions - how-to & snippet examples
Search extensions - how-to & snippet examples
Extension: Add a dot to the end of every line
Remove multiple spaces
Help creating an extension using Python
Extension to make a link (⌘K)
Snippet for Wiktionary search

Wow. That was easy! A super simple modification for your “Remove Spaces” extension, called “Remove Dots”

# popclip
name: Remove Dots
icon: square filled dot
javascript: popclip.pasteText(popclip.input.text.replace(/\./g, ''))
description: Remove dots from the selected text.
2 Likes

Love it! It’s kind of surprising how easy it is isn’t it :slight_smile: Really happy you were able to put it together. My aim with this has been to distill the extensions down to their simplest form without all the XML files and identifiers and extra gubbins that used to be needed, so that more people can create their own extensions.

p.s. I took the liberty of editing your opening backticks as ```yaml to make the syntax highlighting nice. An alternative is ```text to get all one colour.

edit: I’ve now set ```text as the default on the forum.

3 Likes

This is wonderful, great work!!

1 Like

Bugger. I accidentally deleted my previous post when I was trying to copy it to share in the new subforum. Please find it here: Remove Dots

1 Like

I have magic powers :sparkles:

1 Like

8 posts were split to a new topic: Allocine search

Hey Nick - thinking back on the icon limitation and the other thread where you asked about updated snippet length… If you did increase the snippets to 3000-5000 chars, could you also support base64 encoded text for icons? Then I could do icon: iVBORw0KGgoAAAANSUhEUgAAAI[…]AAAACACAYAAADDP==. I guess the issue would still be the total character limit…

1 Like

@brokosz Yes icons as data does make sense. As you say, it would have to go along with an increased snippet size limit, to make sense. It’s just the snippets wouldn’t be quite so ‘snippety’ any more… I did say I would think about this but I didn’t do anything about it for 2022.5.

That said, I do have what I think is a really good idea to enable a lot more icons in snippets. Say tuned…

P.S., welcome to all PopClip users viewing this thread for the first time! many of you may only be discovering the snippets feature now due to the recent PopClip update mentioning it in the release notes.

I’ve just added a new guide: How to run a macOS Shortcut from PopClip

3 Likes

With the latest PopClip update, snippets gained new capabilities. I wrote a new post about it:

3 Likes