From e067a444097248e7f16079d03a3a47f8e3d731cd Mon Sep 17 00:00:00 2001 From: Nikita Voloboev Date: Mon, 4 Dec 2017 18:17:05 +0100 Subject: [PATCH] Added many modifier actions to the workflow --- info.plist | 314 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 267 insertions(+), 47 deletions(-) diff --git a/info.plist b/info.plist index ba57a4b..cffa78c 100644 --- a/info.plist +++ b/info.plist @@ -5,14 +5,14 @@ bundleid org.jeef.workflowdirectory category - Productivity + productivity connections - BF84CB60-A776-4978-93FE-3FD1512337D4 + 47E954E2-03A9-4F55-B643-6DD779441AE8 destinationuid - 3B3FA92E-C99A-47DA-A688-064FB6BAED07 + BF84CB60-A776-4978-93FE-3FD1512337D4 modifiers 0 modifiersubtext @@ -21,11 +21,11 @@ - DB996B62-C0E0-4804-A5B6-D808145B54D6 + 64C28C6D-0728-491B-B23E-37CC5AE97CE5 destinationuid - B1026A6A-6CDA-436B-AC40-1F56F4F88836 + 92704491-D6B8-426F-8720-2AE09980D332 modifiers 0 modifiersubtext @@ -34,17 +34,93 @@ + BF84CB60-A776-4978-93FE-3FD1512337D4 + + + destinationuid + 3B3FA92E-C99A-47DA-A688-064FB6BAED07 + modifiers + 1048576 + modifiersubtext + Finder + vitoclose + + + + destinationuid + CE721269-CA3B-4868-BA98-FE7B2BA4864A + modifiers + 0 + modifiersubtext + + vitoclose + + + + destinationuid + 0E5139D8-9337-4E94-938D-C0FE21998102 + modifiers + 0 + modifiersubtext + + vitoclose + + + + destinationuid + 1A5581BD-77C9-4B41-99D8-F9F1662E3259 + modifiers + 8388608 + modifiersubtext + Open in VS Code + vitoclose + + + + destinationuid + 64C28C6D-0728-491B-B23E-37CC5AE97CE5 + modifiers + 262144 + modifiersubtext + Export workflow to ~/Desktop + vitoclose + + + + destinationuid + 3DF122EA-2D9F-43F6-A2E9-D6F3578D5E9C + modifiers + 524288 + modifiersubtext + Open in Sublime text + vitoclose + + + createdby Jeff Stein description - Shortcut to open in term or open in finder for Workflows + Shortcut to open in term or open in finder for workflows disabled name - Work Flow Directory + Workflow directory objects + + config + + triggerid + search + + type + alfred.workflow.trigger.external + uid + 47E954E2-03A9-4F55-B643-6DD779441AE8 + version + 1 + config @@ -65,6 +141,10 @@ alfredfiltersresults + alfredfiltersresultsmatchmode + 0 + argumenttrimmode + 0 argumenttype 1 escaping @@ -106,61 +186,162 @@ config - escaping - 0 - script - cd "{query}" + paths + + /Applications/iTerm.app + + toggle + type - alfred.workflow.action.terminalcommand + alfred.workflow.action.launchfiles uid - B1026A6A-6CDA-436B-AC40-1F56F4F88836 + CE721269-CA3B-4868-BA98-FE7B2BA4864A version 1 config - alfredfiltersresults - - argumenttype - 1 + concurrently + escaping 102 - keyword - wft - queuedelaycustom - 3 - queuedelayimmediatelyinitially - - queuedelaymode - 0 - queuemode - 1 - runningsubtext - Open a file script - python scan.py + tell application "iTerm" + if exists window 1 then + tell current window + tell current session to write text "cd {query}" + end tell + else + create window with default profile + tell current window + tell current session to write text "cd {query}" + end tell + end if +end tell +tell application "System Events" + if frontmost of process "iTerm2" is false then key code 13 using {option down, control down, shift down, command down} +end tell scriptargtype - 1 + 0 scriptfile - subtext - Open a workflow directory in Terminal + type + 6 + + type + alfred.workflow.action.script + uid + 0E5139D8-9337-4E94-938D-C0FE21998102 + version + 2 + + + config + + openwith + /Applications/Visual Studio Code.app + sourcefile + + + type + alfred.workflow.action.openfile + uid + 1A5581BD-77C9-4B41-99D8-F9F1662E3259 + version + 3 + + + config + + lastpathcomponent + + onlyshowifquerypopulated + + removeextension + + text + title - Workflow Directory + Exported to ~/Desktop + + type + alfred.workflow.output.notification + uid + 92704491-D6B8-426F-8720-2AE09980D332 + version + 1 + + + config + + concurrently + + escaping + 36 + script + readonly workflow_dir="{query}" + +if [[ ! "${workflow_dir}" == *'Alfred.alfredpreferences/workflows/user.workflow.'* ]] +then + echo "You need to be inside the workflow’s directory in Alfred’s preferences directory." >&2 + exit 1 +fi + +readonly workflow_name="$(/usr/libexec/PlistBuddy -c 'print name' "${workflow_dir}/info.plist")" +readonly workflow_version="$(/usr/libexec/PlistBuddy -c 'print version' "${workflow_dir}/info.plist")" +readonly workflow_file="${HOME}/Desktop/${workflow_name}.alfredworkflow" + +find "${workflow_dir}" -iname '.DS_Store' -delete + +if /usr/libexec/PlistBuddy -c 'Print variablesdontexport' "${workflow_dir}/info.plist" &> /dev/null +then + readonly workflow_dir_to_package="$(mktemp -d)" + cp -R "${workflow_dir}/"* "${workflow_dir_to_package}" + readonly tmp_info_plist="${workflow_dir_to_package}/info.plist" + /usr/libexec/PlistBuddy -c 'print variablesdontexport' "${tmp_info_plist}" | grep ' ' | sed -E 's/ {4}//' | xargs -I {} /usr/libexec/PlistBuddy -c "set variables:'{}' ''" "${tmp_info_plist}" +else + readonly workflow_dir_to_package="${workflow_dir}" +fi + +if ditto -ck "${workflow_dir_to_package}" "${workflow_file}" +then + echo "Created ${workflow_file}" + exit 0 +else + echo "There was and error creating ${workflow_file}" + exit 1 +fi + scriptargtype + 0 + scriptfile + type 0 - withspace - type - alfred.workflow.input.scriptfilter + alfred.workflow.action.script uid - DB996B62-C0E0-4804-A5B6-D808145B54D6 + 64C28C6D-0728-491B-B23E-37CC5AE97CE5 version 2 + + config + + openwith + /Applications/Sublime Text.app + sourcefile + + + type + alfred.workflow.action.openfile + uid + 3DF122EA-2D9F-43F6-A2E9-D6F3578D5E9C + version + 3 + readme This is a alfred plugin for developers that will quick-open in finder a workflow directory. Useful for development. @@ -172,33 +353,72 @@ Eventually will add the open in terminal command as well. `wft` opens the thing in the terminal uidata + 0E5139D8-9337-4E94-938D-C0FE21998102 + + note + cd to folder in current iTerm tab + xpos + 500 + ypos + 270 + + 1A5581BD-77C9-4B41-99D8-F9F1662E3259 + + xpos + 500 + ypos + 420 + 3B3FA92E-C99A-47DA-A688-064FB6BAED07 xpos - 540 + 500 ypos - 360 + 30 - B1026A6A-6CDA-436B-AC40-1F56F4F88836 + 3DF122EA-2D9F-43F6-A2E9-D6F3578D5E9C xpos + 500 + ypos + 680 + + 47E954E2-03A9-4F55-B643-6DD779441AE8 + + xpos + 10 + ypos + 30 + + 64C28C6D-0728-491B-B23E-37CC5AE97CE5 + + note + Export workflow + xpos + 500 + ypos 540 + + 92704491-D6B8-426F-8720-2AE09980D332 + + xpos + 660 ypos - 490 + 540 BF84CB60-A776-4978-93FE-3FD1512337D4 xpos - 220 + 180 ypos - 360 + 30 - DB996B62-C0E0-4804-A5B6-D808145B54D6 + CE721269-CA3B-4868-BA98-FE7B2BA4864A xpos - 220 + 500 ypos - 490 + 150 version