diff --git a/README.md b/README.md
index 26a1943..a86fe98 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,12 @@ Run installled macOS shortcuts
## About
-Run `sc` to list all your shortcuts or `scd` to quickly filter them by folder name. Press ↵ to action.
+Run `sc` to list all your shortcuts or `scd` to quickly filter them by folder name. Press ↩ to action.
![Alfred search for sc](Workflow/images/about/sc.png)
-To run a shortcut with an argument, use the Universal Action or invoke it with ⌘↵. Use the File Action to run a shortcut on a file.
+To run a shortcut with an argument, use the Universal Action or invoke it with ⌘↩. Use the File Action to run a shortcut on a file.
-⌥↵ opens the the shortcut for editing.
+⌥↩ opens the the shortcut for editing.
⤓ Download Workflow
diff --git a/Workflow/info.plist b/Workflow/info.plist
index e331139..2da472f 100644
--- a/Workflow/info.plist
+++ b/Workflow/info.plist
@@ -8,6 +8,19 @@
0A77AD31-D9B7-4FE5-869D-ADAB4C03C845
+ 1128D030-5A3C-43C0-8B79-84EE063E2F1C
+
+
+ destinationuid
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
+ modifiers
+ 0
+ modifiersubtext
+
+ vitoclose
+
+
+
1323F48F-E437-45DD-B8A6-33410D2A376D
@@ -21,11 +34,11 @@
- 1536051B-9614-43F1-BAFF-69157E7507B5
+ 176F2785-CF64-434B-BA5E-B1C8896D5C01
destinationuid
- FA9FFB07-7249-47A4-A6CE-FB08B23064F9
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
modifiers
0
modifiersubtext
@@ -47,6 +60,32 @@
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
+
+
+ destinationuid
+ BFCDF55C-5BEF-4517-BDCB-4561FFAEA81B
+ modifiers
+ 0
+ modifiersubtext
+
+ vitoclose
+
+
+
+ 3DC66537-4080-4948-9659-D4295927FF6D
+
+
+ destinationuid
+ 54C3747A-A884-4018-BAD0-8D3926DDBCE9
+ modifiers
+ 0
+ modifiersubtext
+
+ vitoclose
+
+
+
4CA0F7EA-3AF3-48FB-9F9A-AEF9797EDC3B
@@ -60,24 +99,35 @@
- 6492FB28-292F-4EBA-AC97-1757CD7D9B1A
+ 54C3747A-A884-4018-BAD0-8D3926DDBCE9
destinationuid
- A4E64080-1FE3-4DC7-B236-87D07ED268B1
+ 72481DFD-5DA2-4A5C-A453-FF8E93304DD5
modifiers
0
modifiersubtext
+ sourceoutputuid
+ 756F0559-8EAD-4114-839C-92C1EA776DFF
vitoclose
-
- 6DA7C409-B928-45DB-A786-E994506DFB40
-
destinationuid
- 7BE86C9C-0CB1-491D-B216-6573F26BD365
+ 176F2785-CF64-434B-BA5E-B1C8896D5C01
+ modifiers
+ 0
+ modifiersubtext
+
+ sourceoutputuid
+ 05992BB6-2B0A-4367-885F-0CF4FCDED305
+ vitoclose
+
+
+
+ destinationuid
+ 1128D030-5A3C-43C0-8B79-84EE063E2F1C
modifiers
0
modifiersubtext
@@ -86,23 +136,24 @@
- 7BE86C9C-0CB1-491D-B216-6573F26BD365
+ 566F4FB1-471E-4356-AF50-6A47EBC49EC5
destinationuid
- F0916DDA-3E78-43CC-82B8-250F87B06233
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
modifiers
0
modifiersubtext
- sourceoutputuid
- 162C4049-4FA3-49CB-8E7E-9DC1B57AF737
vitoclose
+
+ 72481DFD-5DA2-4A5C-A453-FF8E93304DD5
+
destinationuid
- BB46B680-EDA9-41D6-84CA-45A5737C6B90
+ 566F4FB1-471E-4356-AF50-6A47EBC49EC5
modifiers
0
modifiersubtext
@@ -128,7 +179,7 @@
destinationuid
- 1536051B-9614-43F1-BAFF-69157E7507B5
+ 54C3747A-A884-4018-BAD0-8D3926DDBCE9
modifiers
0
modifiersubtext
@@ -150,11 +201,11 @@
- BA85DFB6-430D-4198-BB43-D7C2754CBB51
+ BFCDF55C-5BEF-4517-BDCB-4561FFAEA81B
destinationuid
- 6DA7C409-B928-45DB-A786-E994506DFB40
+ F0916DDA-3E78-43CC-82B8-250F87B06233
modifiers
0
modifiersubtext
@@ -180,7 +231,7 @@
destinationuid
- FA9FFB07-7249-47A4-A6CE-FB08B23064F9
+ 3DC66537-4080-4948-9659-D4295927FF6D
modifiers
0
modifiersubtext
@@ -190,11 +241,11 @@
destinationuid
- 6492FB28-292F-4EBA-AC97-1757CD7D9B1A
+ A4E64080-1FE3-4DC7-B236-87D07ED268B1
modifiers
1048576
modifiersubtext
- Run with argument
+
vitoclose
@@ -209,19 +260,6 @@
- FA9FFB07-7249-47A4-A6CE-FB08B23064F9
-
-
- destinationuid
- BA85DFB6-430D-4198-BB43-D7C2754CBB51
- modifiers
- 0
- modifiersubtext
-
- vitoclose
-
-
-
createdby
Vítor Galvão
@@ -277,34 +315,41 @@
config
- concurrently
+ argument
+ {var:input_paths}
+ passthroughargument
- escaping
- 102
- script
- readonly tmp_file="${1}"
-
-if [[ -n "${input_paths}" ]]; then
- IFS=$'\t\n' read -d '' -ra path_array <<< "${input_paths}"
- /usr/bin/shortcuts run "$(< "${tmp_file}")" --input-path "${path_array[@]}"
-else
- /usr/bin/shortcuts run "$(< "${tmp_file}")" <<< "${argument}"
-fi
-
-rm "${tmp_file}"
- scriptargtype
+ variables
+
+ inputmode
+ 1
+
+
+ type
+ alfred.workflow.utility.argument
+ uid
+ 72481DFD-5DA2-4A5C-A453-FF8E93304DD5
+ version
+ 1
+
+
+ config
+
+ delimiter
+
+ outputas
1
- scriptfile
-
- type
- 5
+ trimarguments
+
+ variableprefix
+ split
type
- alfred.workflow.action.script
+ alfred.workflow.utility.split
uid
- BA85DFB6-430D-4198-BB43-D7C2754CBB51
+ 566F4FB1-471E-4356-AF50-6A47EBC49EC5
version
- 2
+ 1
config
@@ -334,7 +379,11 @@ rm "${tmp_file}"
runningsubtext
Getting shortcuts…
script
- // Get STDOUT from command, as array split from newlines, without empty elements
+ function envVar(varName) {
+ return $.NSProcessInfo.processInfo.environment.objectForKey(varName).js
+}
+
+// Get STDOUT from command, as array split from newlines, without empty elements
function linesFromCommand(arguments) {
const task = $.NSTask.alloc.init
const stdout = $.NSPipe.pipe
@@ -377,30 +426,42 @@ const sfItems = shortcutsList.map(categorised => {
const shortcut = categorised[0]
const folder = categorised[1]
- const subtitle = (function() {
- // If an argument has been specified
- const envArgument = $.NSProcessInfo.processInfo.environment.objectForKey("argument").js
- if (envArgument) return "Argument: " + envArgument
-
+ const inputType = (function() {
// If input paths have been specificed
- const envInputPaths = $.NSProcessInfo.processInfo.environment.objectForKey("input_paths").js
+ const envInputPaths = envVar("input_paths")
if (envInputPaths) {
- const splitPaths = envInputPaths.split("\t")
- if (splitPaths.length > 1) return "Paths: " + splitPaths.join(", ")
- return "Path: " + splitPaths[0]
+ const inputPaths = envInputPaths.split("\t")
+ const pathsString = inputPaths.join("\n")
+
+ return {
+ subtitle: inputPaths.length > 1 ? "Paths: " + pathsString : "Path: " + pathsString,
+ mods: { cmd: { valid: false, subtitle: "Input already set: " + pathsString } }
+ }
}
- // Else return folder name
- return folder
+ // If an argument has been specified
+ const envArgument = envVar("argument")
+
+ if (envArgument) return {
+ subtitle: "Argument: " + envArgument,
+ mods: { cmd: { valid: false, subtitle: "Input already set: " + envArgument } }
+ }
+
+ // Else return folder name and allow new arguments
+ return {
+ subtitle: folder,
+ mods: { cmd: { subtitle: "Run with argument" } }
+ }
})()
return {
- "uid": shortcut + " " + folder,
- "title": shortcut,
- "subtitle": subtitle,
- "arg": shortcut,
- "match": shortcut + " " + folder
+ variables: { shortcut: shortcut },
+ uid: shortcut + " " + folder,
+ title: shortcut,
+ subtitle: inputType.subtitle,
+ mods: inputType.mods,
+ match: shortcut + " " + folder
}
})
@@ -524,50 +585,17 @@ fi
config
- concurrently
-
- escaping
- 102
- script
- echo "${alfred_version}" | cut -d. -f1 | tr -d '\n'
- scriptargtype
- 1
- scriptfile
-
- type
- 5
-
- type
- alfred.workflow.action.script
- uid
- 6DA7C409-B928-45DB-A786-E994506DFB40
- version
- 2
-
-
- config
-
- adduuid
-
- allowemptyfiles
-
- createintermediatefolders
-
- filename
- /tmp/com.alfredapp.shortcuts.txt
- filetext
- {query}
- ignoredynamicplaceholders
-
- relativepathmode
+ inputmode
+ -1
+ outputmode
0
- type
- 1
+ shortcut
+
type
- alfred.workflow.output.writefile
+ alfred.workflow.automation.runshortcut
uid
- FA9FFB07-7249-47A4-A6CE-FB08B23064F9
+ BFCDF55C-5BEF-4517-BDCB-4561FFAEA81B
version
1
@@ -593,28 +621,86 @@ fi
conditions
+
+ inputstring
+ {var:input_paths}
+ matchcasesensitive
+
+ matchmode
+ 1
+ matchstring
+
+ outputlabel
+ Paths
+ uid
+ 756F0559-8EAD-4114-839C-92C1EA776DFF
+
inputstring
matchcasesensitive
matchmode
- 2
+ 1
matchstring
- 4
+
outputlabel
- Update
+ Arguments
uid
- 162C4049-4FA3-49CB-8E7E-9DC1B57AF737
+ 05992BB6-2B0A-4367-885F-0CF4FCDED305
elselabel
- Version 4
+ No Input
+ hideelse
+
type
alfred.workflow.utility.conditional
uid
- 7BE86C9C-0CB1-491D-B216-6573F26BD365
+ 54C3747A-A884-4018-BAD0-8D3926DDBCE9
+ version
+ 1
+
+
+ config
+
+ argument
+ {query}
+ passthroughargument
+
+ variables
+
+ inputmode
+ 0
+
+
+ type
+ alfred.workflow.utility.argument
+ uid
+ 176F2785-CF64-434B-BA5E-B1C8896D5C01
+ version
+ 1
+
+
+ config
+
+ json
+ {
+ "alfredworkflow" : {
+ "arg" : "{query}",
+ "config" : {
+ "inputmode" : "{var:inputmode}",
+ "shortcut" : "{var:shortcut}",
+ "outputmode" : 0
+ }
+ }
+}
+
+ type
+ alfred.workflow.utility.json
+ uid
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
version
1
@@ -641,97 +727,58 @@ fi
config
- concurrently
+ argument
+ {var:argument}
+ passthroughargument
- escaping
- 0
- script
- # Special values for OneUpdater reuse
-readonly workflow_webaddress="$(/usr/libexec/PlistBuddy -c 'print webaddress' './info.plist')"
-readonly workflow_repo_name="$(basename "${workflow_webaddress}" | sed 's/-workflow$//')"
-
-# THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH.
-readonly remote_info_plist="https://github.com/alfredapp/legacy-workflows/raw/main/Workflows/${workflow_repo_name}/info.plist"
-readonly workflow_url="https://github.com/alfredapp/legacy-workflows/raw/main/Workflows/${workflow_repo_name}/${workflow_repo_name}.alfredworkflow"
-readonly download_type='direct'
-readonly frequency_check='4'
-
-# FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED!
-function abort {
- echo "${1}" >&2
- exit 1
-}
-
-function url_exists {
- curl --silent --location --output /dev/null --fail --range 0-0 "${1}"
-}
-
-function notification {
- local -r notificator="$(find . -type d -name 'Notificator.app')"
- if [[ -n "${notificator}" ]]; then
- "${notificator}/Contents/Resources/Scripts/notificator" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available'
- return
- fi
-
- local -r terminal_notifier="$(find . -type f -name 'terminal-notifier')"
- if [[ -n "${terminal_notifier}" ]]; then
- "${terminal_notifier}" -title "${alfred_workflow_name}" -subtitle 'A new version is available' -message "${1}"
- return
- fi
-
- osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\""
-}
-
-# Local sanity checks
-readonly local_info_plist='info.plist'
-readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")"
-
-[[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.'
-[[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'."
-[[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number."
-
-# Check for updates
-if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then
- if ! url_exists "${remote_info_plist}"; then abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."; fi # Remote sanity check
-
- readonly tmp_file="$(mktemp)"
- curl --silent --location --output "${tmp_file}" "${remote_info_plist}"
- readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")"
-
- if [[ "${local_version}" == "${remote_version}" ]]; then
- touch "${local_info_plist}" # Reset timer by touching local file
- exit 0
- fi
-
- if [[ "${download_type}" == 'page' ]]; then
- notification 'Opening download page…'
- open "${workflow_url}"
- exit 0
- fi
-
- download_url="$([[ "${download_type}" == 'github_release' ]] && curl --silent "https://api.github.com/repos/${workflow_url}/releases/latest" | grep 'browser_download_url' | head -1 | sed -E 's/.*browser_download_url": "(.*)"/\1/' || echo "${workflow_url}")"
-
- if url_exists "${download_url}"; then
- notification 'Downloading and installing…'
- curl --silent --location --output "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" "${download_url}"
- open "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow"
- else
- abort "'workflow_url' (${download_url}) appears to not be reachable."
- fi
-fi
- scriptargtype
- 1
- scriptfile
+ variables
+
+
+ type
+ alfred.workflow.utility.argument
+ uid
+ 3DC66537-4080-4948-9659-D4295927FF6D
+ version
+ 1
+
+
+ config
+
+ argument
- type
+ passthroughargument
+
+ variables
+
+ inputmode
+ -1
+
+
+ type
+ alfred.workflow.utility.argument
+ uid
+ 1128D030-5A3C-43C0-8B79-84EE063E2F1C
+ version
+ 1
+
+
+ config
+
+ argumenttype
0
+ subtext
+ {query}
+ text
+ Give {var:shortcut} argument
+ withspace
+
type
- alfred.workflow.action.script
+ alfred.workflow.input.keyword
uid
- BB46B680-EDA9-41D6-84CA-45A5737C6B90
+ A4E64080-1FE3-4DC7-B236-87D07ED268B1
version
- 2
+ 1
config
@@ -795,65 +842,6 @@ puts({ items: Script_filter_items }.to_json)
version
3
-
- config
-
- argumenttype
- 0
- subtext
- {query}
- text
- Give {var:shortcut} argument
- withspace
-
-
- type
- alfred.workflow.input.keyword
- uid
- A4E64080-1FE3-4DC7-B236-87D07ED268B1
- version
- 1
-
-
- config
-
- argument
- {var:shortcut}
- passthroughargument
-
- variables
-
- argument
- {query}
-
-
- type
- alfred.workflow.utility.argument
- uid
- 1536051B-9614-43F1-BAFF-69157E7507B5
- version
- 1
-
-
- config
-
- argument
-
- passthroughargument
-
- variables
-
- shortcut
- {query}
-
-
- type
- alfred.workflow.utility.argument
- uid
- 6492FB28-292F-4EBA-AC97-1757CD7D9B1A
- version
- 1
-
config
@@ -866,7 +854,7 @@ puts({ items: Script_filter_items }.to_json)
filename
/tmp/com.alfredapp.shortcuts.workflowname.txt
filetext
- {query}
+ {var:shortcut}
ignoredynamicplaceholders
relativepathmode
@@ -910,13 +898,13 @@ rm "${tmp_file}"
readme
- Run `sc` to list all your shortcuts or `scd` to quickly filter them by folder name. Press ↵ to action.
+ Run `sc` to list all your shortcuts or `scd` to quickly filter them by folder name. Press ↩ to action.
![Alfred search for sc](images/about/sc.png)
-To run a shortcut with an argument, use the Universal Action or invoke it with ⌘↵. Use the File Action to run a shortcut on a file.
+To run a shortcut with an argument, use the Universal Action or invoke it with ⌘↩. Use the File Action to run a shortcut on a file.
-⌥↵ opens the the shortcut for editing.
+⌥↩ opens the the shortcut for editing.
uidata
0A77AD31-D9B7-4FE5-869D-ADAB4C03C845
@@ -924,131 +912,133 @@ To run a shortcut with an argument, use the Universal Action or invoke it with
note
Edit shortcut
xpos
- 745
+ 760
+ ypos
+ 505
+
+ 1128D030-5A3C-43C0-8B79-84EE063E2F1C
+
+ xpos
+ 935
ypos
- 525
+ 305
1323F48F-E437-45DD-B8A6-33410D2A376D
note
Bypass NSTask decomposition
xpos
- 540
+ 580
ypos
- 525
+ 505
- 1536051B-9614-43F1-BAFF-69157E7507B5
+ 176F2785-CF64-434B-BA5E-B1C8896D5C01
xpos
- 895
+ 935
ypos
- 400
+ 235
1DFB80A0-3BC8-4D10-B25F-5738F65D531B
xpos
- 230
+ 230
+ ypos
+ 70
+
+ 25855119-4AFB-4E7F-85B6-368A1A69EB9B
+
+ xpos
+ 1115
ypos
- 70
+ 235
+
+ 3DC66537-4080-4948-9659-D4295927FF6D
+
+ note
+ Pass previously given argument
+ xpos
+ 620
+ ypos
+ 235
4CA0F7EA-3AF3-48FB-9F9A-AEF9797EDC3B
note
List shortcuts by folder name
xpos
- 50
+ 50
ypos
- 370
+ 370
- 6492FB28-292F-4EBA-AC97-1757CD7D9B1A
+ 54C3747A-A884-4018-BAD0-8D3926DDBCE9
- note
- Run shortcut with argument
xpos
- 620
+ 785
ypos
- 400
+ 210
- 6DA7C409-B928-45DB-A786-E994506DFB40
+ 566F4FB1-471E-4356-AF50-6A47EBC49EC5
- colorindex
- 5
- note
- Major Alfred version
xpos
- 1190
+ 1025
ypos
- 205
+ 165
- 7BE86C9C-0CB1-491D-B216-6573F26BD365
+ 72481DFD-5DA2-4A5C-A453-FF8E93304DD5
- colorindex
- 5
xpos
- 1350
+ 935
ypos
- 225
+ 165
8AD8B6B2-7CFD-4111-B81C-69158A3E4D4C
note
Prepare argument to run shortcut
xpos
- 50
+ 50
ypos
- 40
+ 40
A4E64080-1FE3-4DC7-B236-87D07ED268B1
xpos
- 745
+ 580
ypos
- 370
+ 370
B6B11028-3EFA-4B12-A13A-D2E45B31EEDB
note
Prepare path to run shortcut
xpos
- 50
- ypos
- 205
-
- BA85DFB6-430D-4198-BB43-D7C2754CBB51
-
- note
- Run shortcut
- xpos
- 965
+ 50
ypos
- 205
+ 205
- BB46B680-EDA9-41D6-84CA-45A5737C6B90
+ BFCDF55C-5BEF-4517-BDCB-4561FFAEA81B
- colorindex
- 12
- note
- OneUpdater
xpos
- 1490
+ 1210
ypos
- 355
+ 205
CFFE2B9A-5D09-42D3-AA37-04D143AD527C
xpos
- 230
+ 230
ypos
- 235
+ 235
EE84DB71-9CAA-4783-BFE6-528D7F1D1D47
note
List all shortcuts
xpos
- 400
+ 400
ypos
- 205
+ 205
F0916DDA-3E78-43CC-82B8-250F87B06233
@@ -1057,22 +1047,17 @@ To run a shortcut with an argument, use the Universal Action or invoke it with
note
OneUpdater
xpos
- 1490
- ypos
- 205
-
- FA9FFB07-7249-47A4-A6CE-FB08B23064F9
-
- note
- Bypass NSTask decomposition
- xpos
- 745
+ 1390
ypos
- 205
+ 205
+ userconfigurationconfig
+
+ variablesdontexport
+
version
- 2022.8
+ 2022.9
webaddress
https://github.com/alfredapp/shortcuts-workflow/