Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ItemInstance

An instance of an ItemFactory

Hierarchy

Index

Properties

Optional arg

arg: any

The argument which is passed through the workflow to the connected output action.

Optional autocomplete

autocomplete: undefined | string

An optional but recommended string you can provide which is populated into Alfred's search field if the user auto-complete's the selected result (⇥ by default).

If the item is set as "valid": false, the auto-complete text is populated into Alfred's search field when the user actions the result.

Optional icon

icon: undefined | object

The icon displayed in the result row. Workflows are run from their workflow folder, so you can reference icons stored in your workflow relatively.

Optional match

match: undefined | string

From Alfred 3.5, the match field enables you to define what Alfred matches against when the workflow is set to "Alfred Filters Results". If match is present, it fully replaces matching on the title property.

{
  "match": "my family photos"
}

Note that the match field is always treated as case insensitive, and intelligently treated as diacritic insensitive. If the search query contains a diacritic, the match becomes diacritic sensitive.

Optional mod

mod: undefined | object

The mod element gives you control over how the modifier keys react. You can now define the valid attribute to mark if the result is valid based on the modifier selection and set a different arg to be passed out if actioned with the modifier.

{
  "mods": {
    "alt": {
        "valid": true,
        "arg": "alfredapp.com/powerpack",
        "subtitle": "https://www.alfredapp.com/powerpack/"
    },
    "cmd": {
        "valid": true,
        "arg": "alfredapp.com/powerpack/buy/",
        "subtitle": "https://www.alfredapp.com/powerpack/buy/"
    },
  }
}

Private object

object: function

Write to stdout.

param

Type declaration

    • (arg: Object): string
    • Parameters

      • arg: Object

      Returns string

Optional quicklookurl

quicklookurl: undefined | string

A Quick Look URL which will be visible if the user uses the Quick Look feature within Alfred (tapping shift, or cmd+y). Note that quicklookurl will also accept a file path, both absolute and relative to home using ~/.

{
  "quicklookurl": "https://www.alfredapp.com/"
}

Optional subtitle

subtitle: undefined | string

The subtitle displayed in the result row.

Optional text

text: undefined | object

The text element defines the text the user will get when copying the selected result row with ⌘C or displaying large type with ⌘L.

{
  "text": {
    "copy": "https://www.alfredapp.com/ (text here to copy)",
    "largetype": "https://www.alfredapp.com/ (text here for large type)"
  }
}

If these are not defined, you will inherit Alfred's standard behaviour
where the arg is copied to the Clipboard or used for Large Type.

title

title: string

The title displayed in the result row. There are no options for this element and it is essential that this element is populated.

Optional type

type: "default" | "file" | "file:skipcheck"

By specifying "type": "file", this makes Alfred treat your result as a file on your system. This allows the user to perform actions on the file like they can with Alfred's standard file filters.

When returning files, Alfred will check if the file exists before presenting that result to the user. This has a very small performance implication but makes the results as predictable as possible. If you would like Alfred to skip this check as you are certain that the files you are returning exist, you can use "type": "file:skipcheck".

Optional uid

uid: undefined | string

This is a unique identifier for the item which allows help Alfred to learn about this item for subsequent sorting and ordering of the user's actioned results.

It is important that you use the same UID throughout subsequent executions of your script to take advantage of Alfred's knowledge and sorting. If you would like Alfred to always show the results in the order you return them from your script, exclude the UID field.

Optional valid

valid: undefined | false | true

If this item is valid or not. If an item is valid then Alfred will action this item when the user presses return. If the item is not valid, Alfred will do nothing. This allows you to intelligently prevent Alfred from actioning a result based on the current {query} passed into your script.

If you exclude the valid attribute, Alfred assumes that your item is valid.

write

write: function

Write to stdout.

param

Type declaration

    • (...params: any[]): void
    • Parameters

      • Rest ...params: any[]

      Returns void

Generated using TypeDoc