A template for creating Alfred workflows with KotlinJS
Actually useful workflow I've built using this: https://github.com/Stvad/FuzzyDate
-
Clone this repository
-
Build it via
./gradlew build
-
Add symlink from Alfred workflow directory to the
workflow_resources
directory- You can find out the Alfred workflow directory by righ-clicking any of the workflows you have and choosing
Open in Finder/Terminal
- You can find out the Alfred workflow directory by righ-clicking any of the workflows you have and choosing
-
At this point you should have a fully functional workflow that you can invoke via
this
keyword. It'd appendIs Awesome
to your input and would allow you to copy the result to clipboard or paste it into the frontmost application -
Now you can edit the workflow settings/details directly in Alfred
-
The core workflow logic is located in the example_workflow.kt file. Change it to build your own workflow.
Other points of interest:
AlfredResult
data class that represents an one item of results to be returned to Alfred- This template is using alfy library to abstract the details of communicating with Alfred. And to simplify publishing resulting workflow to NPM.
- Create and log into npm account
- Give the workflow a different name 😉
- Build it
- Go to the
build/js/packages/<package name>
and runnpm publish
npm install -g kotlin-alfred-workflow-template