Your Own Actions
Make your own actions for the action menu. An action takes the selected text, does something with it, and gives you a result.
Ready-made actions
Typefu comes with more than 50 actions you can use right away. Open Actions in the sidebar to see them. They cover:
- Searching the selection on popular sites and references
- Opening an address in a map
- Markdown: link, bullet list, numbered list, checklist, blockquote, inline code, code block
- Lines: join, reverse, shuffle, remove empty lines, comma-separated list
- Text: slugify, wrap in quotes or parentheses, straighten quotes, alternating case, ROT13
- Code: escape and unescape HTML, validate JSON, toggle line comments, Unicode code points, Unix timestamps
- Extract all emails or all links from the selection
- Add the numbers in the selection
Right-click an action and choose Show in Action Menu. A star marks the ones already in the menu.
You can edit any ready-made action. Right-click it and choose Restore Original to undo your changes.
More actions are shared in the GitHub repo (opens in a new tab).
Make an action
- Open Actions in the sidebar.
- Click New Action and pick a kind.
- Write the action, then try it on sample text with Run in Try It.
Kinds
| Kind | How it gets the selection | Example |
|---|---|---|
| Open URL | {text} is replaced with the selection, URL-encoded. Add pipes like {text | lower}. | https://github.com/search?q={text} |
| Shell Script | Runs with zsh. The selection is on standard input and in $EXPANDER_TEXT. Standard output is the result. | tr a-z A-Z |
| AppleScript | The selection is in the variable selectedText. The script's result is the action's result. | return "Hello " & selectedText |
| JavaScript | The selection is in the variable text. The value of the last expression is the result. | text.split("").reverse().join("") |
| Shortcut | Runs the shortcut with the selection as input. Its output is the result. | The name of a shortcut |
Output
Choose what happens with the result:
- Replace selection
- Insert after selection
- Copy to clipboard
- Show result
- Nothing
Show when
Show the action only when it makes sense:
- Any text, A link, An email address or A file path.
- Matches pattern: A regular expression the whole selection must match.
- A minimum and maximum number of characters.
- Only in apps and Never in apps: Bundle identifiers, separated by commas.
Actions with conditions show a Conditional badge in the list.
Share actions
Right-click an action and choose Export… to save it as a file. Use Import Actions… to add actions from .json or .js files.
JavaScript actions can be plain .js files. Put the settings in comments at the top:
// @name Reverse Text
// @icon arrow.left.arrow.right
// @output replace
// @regex .+
// @apps com.apple.TextEdit, com.apple.Notes
return text.split("").reverse().join("")@name: The name in the menu.@icon: An SF Symbol name.@output:replace,insertAfter,copy,showornone.@regex: Optional. Only show when the selection matches.@apps: Optional. Only show in these apps.