Alfred
Alfred is a powerful launcher that you can program to show anything you want. It saved me a lot of time as I use it to search through anything instantly.
It has a great community and amazing workflows that you can use.
I wrote an article on how anyone can start developing workflows of their own using Go language and AwGo library.
Raycast & Script Kit are nice alternatives.
Workflows I use
My most used workflows at current time are:
- Searchio
- GitHub Jump
- Web Searches
- Learn Anything
- Safari Assistant
- Ask, Create Share
- My Mind
- Maestro
- Fast Menu Bar Search
Coupled with many small workflows I made. I hope to add more workflows of my own to the mix with time.
Alfred theme
I most often use Mono Dim theme when in macOS dark appearance.
I use Mono Light theme with macOS light appearance (when light is hitting the screen).
I also made Mono theme but stopped using it.
The themes work best with GitHub VSCode & iTerm dim themes.
Snippets
I use Alfred together with Keyboard Maestro to automate text expansions. Alfred for simple expansions, KM for complex or per app expansions.
Symlink workflows
It is a great idea to symlink workflows you are working on so you can work on them in the comfort of your file system and not inside Alfred UUID named directories.
I use this script to achieve this. In example of this workflow you can use it as follows. Assuming the workflow
directory contains Alfred workflow contents (info.plist
file). You can run workflow-install.py -s workflow
.
I can also then use this script and build my workflow with workflow-build.py -v source
.
Notes
- Package workflows from CLI with version numbers
- Alfred can preserve a user's Hotkey shortcuts, keywords and workflow variable values. Everything else in the workflow directory gets overwritten.
- I prefix my own workflows that I have not published out to the world with a. prefix. This way I know off hand that this workflow is either private or unreleased yet.
- Sometimes when passing things from one object into another, you want to clear your {query} being passed to get a clean prompt. To achieve this you can set argument utility and set it as empty like here:
- You can exclude certain folders or files from being searched. For example, if you have a file filter that searches through some folders and its contents but you don't wish for it to search some big
node_modules
folder. You can simply add this folder to Spotlight preferences under privacy tab like here:
- Adding
alfred:ignore
tag to files/folders will have Alfred ignore the file/folder in its searches. - If you copy the selected text, then open Alfred's clipboard manager, you can use cmd+s on the selected clipboard entry, and this will open Alfred's preferences and pre-fill a snippet for you to save.
- File note found? Go to Alfred's preferences > Help > Troubleshooting and run the File Search Troubleshooting, dragging in some of the files you are expecting to see in your File Filter. Check the
Content Type:
field. It could be something likecom.unknown.md
instead ofnet.daringfireball.markdown
you might expect.
Code
Strip title and subtext from input. Put inside JSON utility. Useful to get clean prompts in Alfred (i.e. it's used in web-searches workflow)
{
"alfredworkflow": {
"arg": "{query}",
"config": {
"title": "",
"runningsubtext": "",
"subtext": ""
},
"variables": {}
}
}
Export workflow to a location with version number in clipboard.
readonly workflow_dir="{query}"
if [[ ! "${workflow_dir}" == *'Alfred.alfredpreferences/workflows/user.workflow.'* ]]
then
echo "You need to be inside the workflow’s directory in Alfred’s preferences directory." >&2
exit 1
fi
readonly workflow_name="$(/usr/libexec/PlistBuddy -c 'print name' "${workflow_dir}/info.plist")"
readonly workflow_version="$(/usr/libexec/PlistBuddy -c 'print version' "${workflow_dir}/info.plist")"
readonly workflow_file="${HOME}/Desktop/${workflow_name}-${workflow_version}.alfredworkflow"
find "${workflow_dir}" -iname '.DS_Store' -delete
if /usr/libexec/PlistBuddy -c 'Print variablesdontexport' "${workflow_dir}/info.plist" &> /dev/null
then
readonly workflow_dir_to_package="$(mktemp -d)"
cp -R "${workflow_dir}/"* "${workflow_dir_to_package}"
readonly tmp_info_plist="${workflow_dir_to_package}/info.plist"
/usr/libexec/PlistBuddy -c 'print variablesdontexport' "${tmp_info_plist}" | grep ' ' | sed -E 's/ {4}//' | xargs -I {} /usr/libexec/PlistBuddy -c "set variables:'{}' ''" "${tmp_info_plist}"
else
readonly workflow_dir_to_package="${workflow_dir}"
fi
if ditto -ck "${workflow_dir_to_package}" "${workflow_file}"
then
echo "Created ${workflow_file}"
exit 0
else
echo "There was and error creating ${workflow_file}"
exit 1
fi
Links
- Reporting Problems with Workflows
- How to: workflow / environment variables
- fuzzy-list - Self-updating list filter workflow template.
- fuzzy-search - Fuzzy search helper.
- Deanishe's approach in building Go workflows
- Pacmax - Explore & Share Great Packages for Alfred.
- Fix for running compiled workflows in Catalina
- Alfred Workflows Store
- AlfredExtraPane - Spotight-like rich previews for Alfred workflows. (Forum post)
- Workflow Icon Generator
- How to Programmatically Add Folders to the Spotlight Ignore List (2020)
- Alfred Workflow ScriptFilter in Swift (Discussion)
- AlfredSwift - Swift package to access and manipulate metadata and preferences for Alfred and workflows.
- Workflow Development
- Alfred Workflows (Rust)
- Updated Third-Party Python 2 Workflows
- Alfred-Workflow - Full-featured library for writing Alfred 3 & 4 workflows.
- go-alfred - Alfred Workflow utility library for Go. Useful CLI too.
- powerpack - Supercharge your Alfred workflows by building them in Rust.
- Alfred Automation Tasks