Skip to content

jphenow/alfredio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Alfred IO

I wrote this using Deno to experiment with Deno and improve a workflow I wrote for myself for Alfred.

The basic idea:

  • In code configure your various sub-tasks
  • In Alfred, point to your script for querying and for executing
  • Use Alfred

Usage

This isn't currently in any kind of package management because it felt overkill for what I needed at this point. So steps to running are like so:

  • Install Alfred
  • Install Deno
  • Pull this code
  • Author your Alfred items in code
  • Point Alfred workflow at your code
  • Execute your query

Authoring Alfred Items

I recommend having a bin dir in your Home directory. In there you might add something like this:

import { Parser, ItemHandler } from "../Code/alfredio/alfredio.ts";

const items = [new ItemHandler({
    uid: "jonphenow.alfred.gh",
    type: "default",
    title: "Open My GitHub",
    autocomplete: "github",
    arg: "github",

    action: ["open", "https://github.com/jphenow"],
    matcher: (query) => {
        if (query.length === 0) { return true; }

        const [subcommand] = query;
        return "github".startsWith(subcommand);
    }
})];

Parser.process(items, Deno.args.slice(1));

For more information on the format of the AlfredItems see the interface and the Alfred Docs

Point Alfred workflow at your code

  • In Alfred Preferences, create a new workflow
  • Right-click on the workflow area and select Inputs > Script Filter
    • Set a keyword like jp
    • ✅ With space
    • Argument Optional

Now for the most important part. In the script area:

/usr/local/bin/deno --allow-all "path/to/your/alfred/config/from/above.ts" query $@

Save the Script filter then grab the little nub sticking out and drag it.

  • Select Actions > Run Script
  • /bin/bash
  • with input as arv

Then in the script:

/usr/local/bin/deno --allow-all "path/to/your/alfred/config/from/above.ts" execute $@

Execute your query

At this point you should be able to open Alfred and use your Alfred items.

If you have issues, from the Alfred Workflow, select the bug in the top-right to see any log or error output.

About

Alfred Workflow Script Manager written in Deno

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published