#!/bin/bash case $1 in "METADATA") METADATA='{ "iid":"org.albert.extension.external.v1", "id":"org.albert.extension.external.goldendict", "name":"Goldendict", "version":"1.0", "author":"Manuel Schneider", "dependencies":["goldendict"], "providesMatches":true, "providesFallbacks":true, "runTriggeredOnly":true, "triggers":["gd "] }' echo -n "${METADATA}" exit 0 ;; "NAME") echo -n "Goldendict" exit 0 ;; "INITIALIZE") if ! hash goldendict 2>/dev/null; then echo "Goldendict seems to be not installed"; fi exit 0 ;; "FINALIZE") exit 0 ;; "SETUPSESSION") exit 0 ;; "TEARDOWNSESSION") exit 0 ;; "QUERY") RESULTS='[{ "id":"goldendict", "name":"Goldendict", "description":"Lookup '\'${2:3}\'' in goldendict.", "icon":"goldendict", "actions":[{ "name":"goldendict", "command":"goldendict", "arguments":["'${2:3}'"] }] }]' echo -n "${RESULTS}" exit 0 ;; # Fallbacks in scripts are currently discouraged since the fallbacks are not sorted! # # "FALLBACKS") # FALLBACKS='[{ # "id":"goldendict", # "name":"GoldenDict", # "description":"Lookup '\'${2}\'' in goldendict.", # "icon":"goldendict", # "actions":[{ # "name":"goldendict", # "command":"goldendict", # "arguments":["'$2'"] # }] # }]' # echo -n "${FALLBACKS}" # exit 0 # ;; esac exit 1