item#
Alfred Workflow Script Filter Item module.
- class afwf.item.Icon(path: str, type: Optional[str] = None)[source]#
represent an icon object in script filter item.
Reference:
Search
icon : OBJECT (optional)
in https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
- class afwf.item.Text(copy: Optional[str] = None, largetype: Optional[str] = None)[source]#
Represent a text object in script filter item.
Reference:
Search
text : OBJECT (optional)
in https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
- class afwf.item.ModEnum(value)[source]#
List of available modifier keys. Hit enter with the modifier key can lead to different behavior.
Reference:
Search
mods : OBJECT (optional)
in https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
- class afwf.item.Item(title: str, subtitle: Optional[str] = None, arg: Optional[str] = None, autocomplete: Optional[str] = None, icon: Optional[Union[Dict[str, Any], AttrsClass]] = None, valid: bool = True, uid: Optional[str] = None, match: Optional[str] = None, type: Optional[str] = None, mods: Optional[dict] = None, action: Optional[Union[str, List[str], Dict[str, Any]]] = None, text: Optional[Union[Dict[str, Any], AttrsClass]] = None, quicklookurl: Optional[str] = None, variables: dict = _Nothing.NOTHING)[source]#
Data model for alfred dropdown menu items.
Note
Please make sure the attribute name is exactly the same as the field name in the following document.
Ref: https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
- set_modifier(mod: str = 'cmd', subtitle: _CountingAttr(counter=31, _default=None, repr=True, eq=True, order=True, hash=None, init=True, on_setattr=None, alias=None, metadata={}) = None, arg: str = None, valid: bool = True) Item [source]#
Add modifier to item. Modifier allow you to return different title, subtitle and argument in Alfred drop down menu item when you hit a modifier key.
- Parameters:
mode – the modifier key
subtitle – the subtitle you want to display
arg – the argument passed to subsequence action
valid – whether the item is valid
- open_file(path: str) Item [source]#
Set variables to tell subsequence Alfred action to open a file.
Use the “Utilities -> Conditional” widget and set: if
{var:open_file}
is equal to “y”.Use the “Actions -> Open File” widget and set: File:
{var:open_file_path}
- Parameters:
path – the absolute path of the file to open
- launch_app_or_file(path: str) Item [source]#
Set variables to tell subsequence Alfred action to launch an app or file.
Use the “Utilities -> Conditional” widget and set: if
{var:launch_app_or_file}
is equal to “y”.Use the “Actions -> Launch Apps / Files” widget.
- Parameters:
path – the absolute path of the file or app to launch
- reveal_file_in_finder(path: str) Item [source]#
Set variables to tell subsequence Alfred action to launch an app or file.
Use the “Utilities -> Conditional” widget and set: if
{var:reveal_file_in_finder}
is equal to “y”.Use the “Actions -> Reveal File in Finder” widget.
- Parameters:
path – the absolute path of the file to reveal in Finder
- browse_in_terminal(path: str) Item [source]#
Set variables to tell subsequence Alfred action to browse in terminal.
Use the “Utilities -> Conditional” widget and set: if
{var:browse_in_terminal}
is equal to “y”.Use the “Actions -> Browse in Terminal” widget.
- browse_in_alfred(path: str) Item [source]#
Set variables to tell subsequence Alfred action to browse in Alfred.
Use the “Utilities -> Conditional” widget and set: if
{var:browse_in_alfred}
is equal to “y”.Use the “Actions -> Browse in Alfred” widget.
- open_url(url: str) Item [source]#
Set variables to tell subsequence Alfred action to open url.
Use the “Utilities -> Conditional” widget and set: if
{var:open_url}
is equal to “y”.Use the “Actions -> Open URL” widget and set:
File =
{var:open_url_arg}
- Parameters:
url – the url to open in browser
- run_script(cmd: str) Item [source]#
Set variables to tell subsequence Alfred action to run script.
Use the “Utilities -> Conditional” widget and set: if
{var:run_script}
is equal to “y”.Use the “Actions -> Run Script” widget and set:
Language =
/bin/bash
“with input as {query}”
running instances = “Sequentially”
Script =
{query}
- Parameters:
cmd – the full command to run, for example
python3 /path/to/test.py
- terminal_command(cmd: str) Item [source]#
Use the “Utilities -> Conditional” widget and set: if
{var:terminal_command}
is equal to “y”.Use the “Actions -> Terminal Command” widget and set:
Command =
{query}
- Parameters:
cmd – the full command to run in terminal, for example
python3 /path/to/test.py
- send_notification(title: str, subtitle: str = '') Item [source]#
Set variables to tell subsequence Alfred action to send notification.
Use the “Utilities -> Conditional” widget and set: if
{var:send_notification}
is equal to “y”.Use the “Outputs -> Post Notification” widget and set:
Title =
{var:send_notification_title}
Subtitle =
{var:send_notification_subtitle}
- Parameters:
title – the title of the notification
subtitle – the subtitle of the notification