├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── config.yml
│ └── feature_suggestion.yml
├── LICENSE
├── README.md
└── Workflow
├── icon.png
├── images
└── about
│ ├── brewalias.png
│ └── macvim.png
└── info.plist
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: File a bug report
3 | body:
4 | - type: input
5 | attributes:
6 | label: Workflow version
7 | description: Open the Workflow in Alfred Preferences and find it at the top, near the description
8 | validations:
9 | required: true
10 | - type: input
11 | attributes:
12 | label: Alfred version
13 | description: In the top left corner of Alfred Preferences → General
14 | validations:
15 | required: true
16 | - type: input
17 | attributes:
18 | label: macOS version
19 | description: Click on the menubar → About This Mac
20 | validations:
21 | required: true
22 | - type: textarea
23 | attributes:
24 | label: Debugger output
25 | description: Perform the failing action with [the debugger](https://www.alfredapp.com/help/workflows/advanced/debugger/) open
26 | render: alfred_debugger
27 | validations:
28 | required: true
29 | - type: textarea
30 | attributes:
31 | label: More details
32 | description: Explain what you did, what happened, and what you expected to happen
33 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_suggestion.yml:
--------------------------------------------------------------------------------
1 | name: Feature Suggestion
2 | description: Suggest a new feature
3 | body:
4 | - type: textarea
5 | attributes:
6 | label: Feature details
7 | description: Explain the feature idea
8 | validations:
9 | required: true
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021, Running with Crayons Ltd
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #
Alias Homebrew Apps Alfred Workflow
2 |
3 | Create shortcuts to Homebrew formula app bundles
4 |
5 | [⤓ Install on the Alfred Gallery](https://alfred.app/workflows/alfredapp/alias-homebrew-apps)
6 |
7 | ## Setup
8 |
9 | Set the formulae you want linked in the [Workflow’s Configuration](https://www.alfredapp.com/help/workflows/user-configuration/).
10 |
11 | ## Usage
12 |
13 | Alias your Homebrew Cellar apps to the Applications Folder via the `brewalias` keyword. This will allow them to be indexed by macOS and found.
14 |
15 | 
16 |
17 | 
18 |
19 | To trigger the workflow from a terminal, define a `brewalias` command in your shell’s startup files:
20 |
21 | ```
22 | alias brewalias='/usr/bin/osascript -e "tell application id \"com.runningwithcrayons.Alfred\" to run trigger \"build\" in workflow \"com.alfredapp.vitor.aliashomebrewapps\""'
23 | ```
24 |
--------------------------------------------------------------------------------
/Workflow/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alfredapp/alias-homebrew-apps-workflow/75a19f41e099829d225f8ce1f40661dd7ec6bb16/Workflow/icon.png
--------------------------------------------------------------------------------
/Workflow/images/about/brewalias.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alfredapp/alias-homebrew-apps-workflow/75a19f41e099829d225f8ce1f40661dd7ec6bb16/Workflow/images/about/brewalias.png
--------------------------------------------------------------------------------
/Workflow/images/about/macvim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alfredapp/alias-homebrew-apps-workflow/75a19f41e099829d225f8ce1f40661dd7ec6bb16/Workflow/images/about/macvim.png
--------------------------------------------------------------------------------
/Workflow/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | bundleid
6 | com.alfredapp.vitor.aliashomebrewapps
7 | connections
8 |
9 | 26E2AE7C-9A24-4AD8-B0AB-152FFB18DFD3
10 |
11 |
12 | destinationuid
13 | 3160046E-E8C2-4F20-8987-53BFD7A1276D
14 | modifiers
15 | 0
16 | modifiersubtext
17 |
18 | vitoclose
19 |
20 |
21 |
22 | 3160046E-E8C2-4F20-8987-53BFD7A1276D
23 |
24 | 97E477F9-94DB-4FC8-9D06-8017AA9E1E7A
25 |
26 |
27 | destinationuid
28 | 3160046E-E8C2-4F20-8987-53BFD7A1276D
29 | modifiers
30 | 0
31 | modifiersubtext
32 |
33 | vitoclose
34 |
35 |
36 |
37 |
38 | createdby
39 | Vítor Galvão
40 | description
41 | Create shortcuts to Homebrew formula app bundles
42 | disabled
43 |
44 | name
45 | Alias Homebrew Apps
46 | objects
47 |
48 |
49 | config
50 |
51 | concurrently
52 |
53 | escaping
54 | 102
55 | script
56 | # Helpers
57 | function new_alias {
58 | local -r app="${1}"
59 | local -r dest_dir="${2}"
60 |
61 | /usr/bin/osascript -e '
62 | on run argv
63 | tell application "Finder" to make alias to POSIX file (item 1 of argv) at POSIX file (item 2 of argv)
64 | end run
65 | ' "${app}" "${dest_dir}"
66 | }
67 |
68 | function update_alias {
69 | local -r alias="${1}"
70 | local -r app="${2}"
71 |
72 | /usr/bin/osascript -e '
73 | on run argv
74 | tell application "Finder" to set original item of (POSIX file (item 1 of argv) as alias) to (POSIX file (item 2 of argv) as alias)
75 | end run
76 | ' "${alias}" "${app}"
77 | }
78 |
79 | # Main
80 | readonly formulae_arr=("${(f)formulae}")
81 |
82 | for formula in "${formulae_arr[@]}"; do
83 | while IFS= read -r app; do
84 | app_dest="${apps_dir}/$(basename "${app}")"
85 |
86 | if [[ -e "${app_dest}" ]]; then
87 | if [[ "$(file --brief "${app_dest}")" != 'MacOS Alias file' ]]; then
88 | echo "${app_dest} is not an alias! Skipping…" >&2
89 | continue
90 | fi
91 |
92 | update_alias "${app_dest}" "${app}"
93 | continue
94 | fi
95 |
96 | new_alias "${app}" "${apps_dir}"
97 | done < <(find "$(brew --cellar)/${formula}" -type d -name '*app')
98 | done
99 |
100 | # Make sure Alfred shows aliases in Default Results
101 | readonly prefs="${alfred_preferences}/preferences/features/defaultresults/prefs.plist"
102 |
103 | # If aliases are already ignored, exit
104 | if /usr/libexec/PlistBuddy -c 'Print :showUserDefined:' "${prefs}" | grep --quiet '^\s*com.apple.alias-file$'; then
105 | exit 0
106 | fi
107 |
108 | # Create array (and file) if it does not exist
109 | if ! /usr/libexec/PlistBuddy -c 'Print :showUserDefined:' "${prefs}"; then
110 | /usr/libexec/PlistBuddy -c 'Add :showUserDefined array' "${prefs}"
111 | fi
112 |
113 | # Add key
114 | /usr/libexec/PlistBuddy -c 'Add :showUserDefined: string "com.apple.alias-file"' "${prefs}"
115 | scriptargtype
116 | 1
117 | scriptfile
118 |
119 | type
120 | 11
121 |
122 | type
123 | alfred.workflow.action.script
124 | uid
125 | 3160046E-E8C2-4F20-8987-53BFD7A1276D
126 | version
127 | 2
128 |
129 |
130 | config
131 |
132 | argumenttype
133 | 2
134 | keyword
135 | {var:alias_keyword}
136 | skipuniversalaction
137 |
138 | subtext
139 | Create shortcuts to Homebrew formula app bundles
140 | text
141 | Alias Homebrew Apps
142 | withspace
143 |
144 |
145 | type
146 | alfred.workflow.input.keyword
147 | uid
148 | 26E2AE7C-9A24-4AD8-B0AB-152FFB18DFD3
149 | version
150 | 1
151 |
152 |
153 | config
154 |
155 | availableviaurlhandler
156 |
157 | triggerid
158 | build
159 |
160 | type
161 | alfred.workflow.trigger.external
162 | uid
163 | 97E477F9-94DB-4FC8-9D06-8017AA9E1E7A
164 | version
165 | 1
166 |
167 |
168 | readme
169 | ## Setup
170 |
171 | Set the formulae you want linked in the [Workflow’s Configuration](https://www.alfredapp.com/help/workflows/user-configuration/).
172 |
173 | ## Usage
174 |
175 | Alias your Homebrew Cellar apps to the Applications Folder via the `brewalias` keyword. This will allow them to be indexed by macOS and found.
176 |
177 | 
178 |
179 | 
180 |
181 | To trigger the workflow from a terminal, define a `brewalias` command in your shell’s startup files:
182 |
183 | ```
184 | alias brewalias='/usr/bin/osascript -e "tell application id \"com.runningwithcrayons.Alfred\" to run trigger \"build\" in workflow \"com.alfredapp.vitor.aliashomebrewapps\""'
185 | ```
186 | uidata
187 |
188 | 26E2AE7C-9A24-4AD8-B0AB-152FFB18DFD3
189 |
190 | xpos
191 | 55
192 | ypos
193 | 50
194 |
195 | 3160046E-E8C2-4F20-8987-53BFD7A1276D
196 |
197 | xpos
198 | 275
199 | ypos
200 | 50
201 |
202 | 97E477F9-94DB-4FC8-9D06-8017AA9E1E7A
203 |
204 | xpos
205 | 55
206 | ypos
207 | 195
208 |
209 |
210 | userconfigurationconfig
211 |
212 |
213 | config
214 |
215 | default
216 | brewalias
217 | placeholder
218 |
219 | required
220 |
221 | trim
222 |
223 |
224 | description
225 |
226 | label
227 | Alias Keyword
228 | type
229 | textfield
230 | variable
231 | alias_keyword
232 |
233 |
234 | config
235 |
236 | default
237 | /Applications
238 | filtermode
239 | 0
240 | placeholder
241 |
242 | required
243 |
244 |
245 | description
246 |
247 | label
248 | Applications Folder
249 | type
250 | filepicker
251 | variable
252 | apps_dir
253 |
254 |
255 | config
256 |
257 | default
258 |
259 | required
260 |
261 | trim
262 |
263 | verticalsize
264 | 3
265 |
266 | description
267 | Newline-separated list of formulae. Leave empty to alias every app bundle in Homebrew’s Cellar.
268 | label
269 | Formulae
270 | type
271 | textarea
272 | variable
273 | formulae
274 |
275 |
276 | version
277 | 2024.2
278 | webaddress
279 | https://github.com/alfredapp/alias-homebrew-apps-workflow/
280 |
281 |
282 |
--------------------------------------------------------------------------------