This TypeScript library facilitates the creation of responses for Alfred Workflows. It defines the structure for result items based on Alfred's JSON format and provides a function to output these results appropriately.
-
Define Results: Create an array of
AlfredResult
objects, each representing an item in Alfred's search results. -
Output Response: Use the
response
function to output the JSON formatted results for Alfred to process.
-
AlfredResult
: Represents an individual result item with optional fields for UID, type, subtitle, and more. -
response
: Function that takes an array ofAlfredResult
and outputs the correct JSON format for Alfred.
import { response } from './path_to_this_module';
const results = [
{
uid: 'example',
title: 'Example',
subtitle: 'This is an example',
arg: '/path/to/action',
icon: {
type: 'fileicon',
path: '~/Desktop'
},
valid: true
}
];
response(...results);
For more details on Alfred's JSON format for script filters, visit Alfred's documentation.