Alfred 5.5 is here - Find out what's new

Snippet Trigger

Snippet Triggers can be used to perform an action without showing Alfred, simply by typing a pre-set text keyword in any text field on your Mac.

The Snippet Trigger is useful for cases where standard Snippets and Dynamic Placeholders aren't flexible enough.

How Can I Use Snippet Triggers?

  • To run a script that adds "Good morning!", "Good afternoon!" or "Good evening!" to a snippet before pasting depending on time of day.
  • To select a quote from a pre-defined list before pasting your email signature

Take a look at our tutorial on creating a Snippet Trigger Workflow using either a free text field or a list of pre-defined items.

Snippet Triggers tutorial


Using a Snippet Trigger

To add a snippet trigger, right-click on the workflow canvas to pop up the objects menu and, under Triggers, choose Snippet.

image

To configure the snippet trigger, set a keyword. Keep in mind that you'll need to type the prefix followed by your keyword. By default, the Shared Prefix is set to \\ with no Suffix set.

For example, in the screenshot above, typing \\thanks would run the snippet trigger set above.

You can change the Shared Prefix and Suffix, but keep in mind that this is shared across all of your Snippet Triggers, so it's best to use the default or set a clear and useful one from the start.

Focused App Variable

If you exclusively want the snippet to trigger in a specific application, check the box for the Focused App Variable, and add the relevant app's bundle ID.


Considerations about Snippet Triggers

Stripping snippet keywords on import

When importing a new workflow, snippet triggers are stripped, as well as hotkeys. This ensures that the snippet triggers you set are relevant and useful for you, and don't clash with existing snippets or keywords you've already set.

As such, you'll need to double-click to view the configuration of the Snippet object, and set it to your own trigger keywords.

Conflicting keywords with snippets

You can also use snippets-based actions in the Snippet text auto-expansion feature, so it's possible to create a snippet trigger object that conflicts with an existing snippet keyword.

Workflows always take precedence when a keyword is used both in a trigger object and in a text snippet. In other words, if you set the same keyword in a snippet for auto-expansion AND in a snippet trigger object, the workflow will take precedence and the conflict will only appear in red in the Snippets feature preferences, where you'll be able to change the keyword.

We recommend using a prefix for your Snippet Triggers that is sufficiently different to your snippet keywords that these won't accidentally conflict.

Latest Blog Post:

Video Tutorial: Using Web Searches and Creating Custom Searches in Alfred

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2024 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.