All Projects → drgrib → alfred

drgrib / alfred

Licence: other
A fast, simple way to make Alfred workflow script filters in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to alfred

alfred-string-operations
Perform string operations to clipboard content
Stars: ✭ 70 (+180%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow, alfred3
Alfred Dark Mode
Alfred 3 workflow to toggle the system dark mode
Stars: ✭ 165 (+560%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
alfred-last2imgur
Alfred workflow to upload the last screenshot taken to Imgur + (delete and minify image)
Stars: ✭ 15 (-40%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
adb-alfred
adb alfred - all in one
Stars: ✭ 60 (+140%)
Mutual labels:  alfred, alfred-workflow, alfred3
Alfred Iconfinder Search
Alfred 3 workflow for Iconfinder instant search
Stars: ✭ 14 (-44%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Bluetooth Connect
Alfred plugin that allowed to connect/disconnect to paired bluetooth device
Stars: ✭ 28 (+12%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Pdf Tools
Optimize, encrypt and manipulate PDF files.
Stars: ✭ 69 (+176%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Workflow
Full-featured library for writing Alfred 3 & 4 workflows
Stars: ✭ 2,622 (+10388%)
Mutual labels:  alfred, alfred-workflow, alfred3
Alfred Bear
Streamlined note searching and creation for Bear using Alfred
Stars: ✭ 203 (+712%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfredmagic
一个面向效率提升的中文Workflow
Stars: ✭ 178 (+612%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Collection
A collection of all known Alfred3 workflows
Stars: ✭ 785 (+3040%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
wipfred
🚧Manage your wip.chat todos with alfred
Stars: ✭ 23 (-8%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Awgo
Go library for Alfred 3 + 4 workflows
Stars: ✭ 556 (+2124%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Atom
Alfred workflow to browse and open Atom projects
Stars: ✭ 41 (+64%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Emoj
Alfred 3 workflow to find relevant emoji from text
Stars: ✭ 325 (+1200%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Bear
Alfred 3 workflow to create and search notes in Bear.
Stars: ✭ 319 (+1176%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Things
Interact with Things 3 using Alfred.
Stars: ✭ 278 (+1012%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Npms
Alfred 3 workflow to search for npm packages with npms.io
Stars: ✭ 312 (+1148%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfy
Create Alfred workflows with ease
Stars: ✭ 2,232 (+8828%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow
Alfred Pinboard Rs
Alfred Workflow for Pinboard (Rust)
Stars: ✭ 223 (+792%)
Mutual labels:  alfred, alfred-workflow, alfred3-workflow

Easy Alfred Workflow Script Filters in Go

GoDoc

This is a lean but comprehensive implementation of the Alfred Script Filter JSON Format to get Alfred workflows off the ground quickly with blazingly fast script filters in Go that can be seamlessly developed inside or outside Alfred.

It uses standard, familiar Go syntax and conventions as much as possible for rapid use by Go developers and integration with other Go code.

Installation

go get github.com/drgrib/alfred

Full Alfred JSON Support

full-json.md has examples of how to produce the full range of JSON output for Alfred's Script Filter JSON Format.

A Simple Example

Let's say we want to create a simple script filter that converts a given query to title case, lower case, or upper case, for which Go conveniently has built-in support.

Let's start by prototyping our logic in Go with a case.go file in our workflow folder. We can do this on the command line or in the editor of our choice and easily run it inside or outside of Alfred:

package main

import (
	"strings"

	"github.com/drgrib/alfred"
)

func addCases(arg string) {
	titlecase := strings.Title(arg)
	alfred.Add(alfred.Item{
		Title:    titlecase,
		Subtitle: "Title",
		Arg:      titlecase,
		UID:      "titlecase",
	})

	lowercase := strings.ToLower(arg)
	alfred.Add(alfred.Item{
		Title:    lowercase,
		Subtitle: "Lower",
		Arg:      lowercase,
		UID:      "lowercase",
	})

	uppercase := strings.ToUpper(arg)
	alfred.Add(alfred.Item{
		Title:    uppercase,
		Subtitle: "Upper",
		Arg:      uppercase,
		UID:      "uppercase",
	})
}

func main() {
	arg := "just a test"
	addCases(arg)
	alfred.Run()
}
{
    "items": [
        {
            "uid": "title",
            "title": "Just A Test",
            "subtitle": "Title",
            "arg": "Just A Test"
        },
        {
            "uid": "lower",
            "title": "just a test",
            "subtitle": "Lower",
            "arg": "just a test"
        },
        {
            "uid": "upper",
            "title": "JUST A TEST",
            "subtitle": "Upper",
            "arg": "JUST A TEST"
        }
    ]
}

Looks good. Now let's add os.Args support and test it on the command line to simulate Alfred input:

package main

import (
	"os"
	"strings"

	"github.com/drgrib/alfred"
)

// [same stuff in the middle]

func main() {
	arg := os.Args[1]
	addCases(arg)
	alfred.Run()
}
go build case.go
./case "another test"
{
    "items": [
        {
            "uid": "title",
            "title": "Another Test",
            "subtitle": "Title",
            "arg": "Another Test"
        },
        {
            "uid": "lower",
            "title": "another test",
            "subtitle": "Lower",
            "arg": "another test"
        },
        {
            "uid": "upper",
            "title": "ANOTHER TEST",
            "subtitle": "Upper",
            "arg": "ANOTHER TEST"
        }
    ]
}

Right again. Alright. Now let's drop this into our script filter:

script-filter

And give it a whirl:

test

Why not copy these to the clipboard so we can actually use them?

clipboard

With a few simple runs and a glance at the Alfred clipboard history, we can see we are ready for business:

clipboard

Easy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].