deanishe / alfred-firefox

Search and control Firefox from Alfred
Other
345 stars 19 forks source link

Calling the executable directly, not from the workflow #38

Open Madd0g opened 2 years ago

Madd0g commented 2 years ago

I created a copy of the server.sh file that runs the executable directly.

#!/bin/zsh

# This script is a wrapper for the Firefox extension client/RPC server
# to set an Alfred-like environment when it is run by Firefox.

here="${${(%):-%x}:A:h}"

# getvar <name> | Read a value from info.plist
getvar() {
    local v="$1"
    /usr/libexec/PlistBuddy -c "Print :$v" "${here}/info.plist"
}

export alfred_workflow_bundleid=$( getvar "bundleid" )
export alfred_workflow_version=$( getvar "version" )
export alfred_workflow_name=$( getvar "name" )
export alfred_debug=0 # <---- 

export alfred_workflow_cache="${HOME}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/${alfred_workflow_bundleid}"
export alfred_workflow_data="${HOME}/Library/Application Support/Alfred/Workflow Data/${alfred_workflow_bundleid}"

mkdir -p "${alfred_workflow_data}"
mkdir -p "${alfred_workflow_cache}"

exec "${here}/alfred-firefox" $1 $2 $3 $4 $5

I'm getting results back in the terminal, but there are lots of log messages, like:

>  ./run.sh tab-info
01:06:29 ----- Firefox Assistant/0.2.2 (AwGo/0.27.1) ------
01:06:29 loaded URL action "Open in Default Application" from .....
01:16:34 RPC client connected to "Firefox"
{"alfredworkflow":{"variables":{"FF_INDEX":"1","FF_TAB":"2","FF_TITLE":"New Issue ......
01:19:10 ------------------- 4.672601ms -------------------

Is there a way to get just the JSON response back, without the extra log messages? I tried setting the alfred_debug variable to 0, don't know if it's related

Thanks