Skip to main content

Utilities for Alfred script filters.

Project description

Authors:

Mike Spindel

Version:
0.2

AlfredApp is an application launcher and general productivity tool for Mac OS X. It can be extended and customized with custom workflows and plugin scripts.

Plugin scripts, called “script filters” by AlfredApp, operate by printing an XML document to standard output. python-alfred is a Python library for easily building these XML documents.

Installation

$ pip install alfred

Usage

As an example, consider a filter that converts numeric input into binary and hexadecimal.:

import sys
import alfred


if __name__ == "__main__":
    try:
        val = int(sys.argv[1])
    except:
        sys.exit(1)

    # Use the icon associated with the Calculator app
    icon = alfred.Icon(filepath="/Applications/Calculator.app")

    # Create an item for the hex conversion
    hex_item = alfred.Item(
        uid='hex',
        arg="",
        title=hex(val),
        subtitle="Hexadecimal",
        valid=False,
        icon=icon)

    # Create an item for the binary conversion
    bin_item = alfred.Item(
        uid='bin',
        arg="",
        title=bin(val),
        subtitle="Binary",
        valid=False,
        icon=icon)

    # Call alfred.render to generate the XML document
    print alfred.render([hex_item, bin_item])

Requirements

python-alfred requires lxml.

Changes

0.2 - June 8, 2013

  • Added support for new <arg></arg> elements

0.1 - June 4, 2013

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alfred-0.2.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file alfred-0.2.tar.gz.

File metadata

  • Download URL: alfred-0.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for alfred-0.2.tar.gz
Algorithm Hash digest
SHA256 1a0876b2b6f276d509f4bf11e370573a5a35763a5e97a43c0f4e78df78ed52ab
MD5 1c1aebc7c3ccf4bbaba3acebb21a7001
BLAKE2b-256 8db3c3f8079c11329e0e18f7b85063134c384b6593bf26b5994f8b98cac4ddff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page