├── .github └── workflows │ └── releases.yml ├── .gitignore ├── .idea ├── .gitignore ├── alfred-zoxide.iml ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── LICENSE ├── README.md ├── images ├── demo.gif └── icon.png └── src ├── Zoxide.alfredworkflow └── info.plist /.github/workflows/releases.yml: -------------------------------------------------------------------------------- 1 | name: Automatic Tag Release 2 | on: 3 | push: 4 | tags: 5 | - "*" 6 | jobs: 7 | tagged-release: 8 | name: "Tagged Release" 9 | runs-on: "ubuntu-latest" 10 | 11 | steps: 12 | - name: Release tag 13 | uses: "marvinpinto/action-automatic-releases@latest" 14 | with: 15 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 16 | prerelease: false 17 | # Checkout to the repository so we can access the files 18 | - name: Checkout 19 | uses: actions/checkout@v3 20 | # Upload files to the release 21 | - name: Upload alfredworkflow to release 22 | uses: softprops/action-gh-release@v1 23 | with: 24 | files: | 25 | src/Zoxide.alfredworkflow 26 | LICENSE -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### VisualStudioCode template 2 | .vscode/* 3 | !.vscode/settings.json 4 | !.vscode/tasks.json 5 | !.vscode/launch.json 6 | !.vscode/extensions.json 7 | !.vscode/*.code-snippets 8 | 9 | # Local History for Visual Studio Code 10 | .history/ 11 | 12 | # Built Visual Studio Code Extensions 13 | *.vsix 14 | 15 | ### JetBrains template 16 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 17 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 18 | 19 | # User-specific stuff 20 | .idea/**/workspace.xml 21 | .idea/**/tasks.xml 22 | .idea/**/usage.statistics.xml 23 | .idea/**/dictionaries 24 | .idea/**/shelf 25 | 26 | # AWS User-specific 27 | .idea/**/aws.xml 28 | 29 | # Generated files 30 | .idea/**/contentModel.xml 31 | 32 | # Sensitive or high-churn files 33 | .idea/**/dataSources/ 34 | .idea/**/dataSources.ids 35 | .idea/**/dataSources.local.xml 36 | .idea/**/sqlDataSources.xml 37 | .idea/**/dynamic.xml 38 | .idea/**/uiDesigner.xml 39 | .idea/**/dbnavigator.xml 40 | 41 | # Gradle 42 | .idea/**/gradle.xml 43 | .idea/**/libraries 44 | 45 | # Gradle and Maven with auto-import 46 | # When using Gradle or Maven with auto-import, you should exclude module files, 47 | # since they will be recreated, and may cause churn. Uncomment if using 48 | # auto-import. 49 | # .idea/artifacts 50 | # .idea/compiler.xml 51 | # .idea/jarRepositories.xml 52 | # .idea/modules.xml 53 | # .idea/*.iml 54 | # .idea/modules 55 | # *.iml 56 | # *.ipr 57 | 58 | # CMake 59 | cmake-build-*/ 60 | 61 | # Mongo Explorer plugin 62 | .idea/**/mongoSettings.xml 63 | 64 | # File-based project format 65 | *.iws 66 | 67 | # IntelliJ 68 | out/ 69 | 70 | # mpeltonen/sbt-idea plugin 71 | .idea_modules/ 72 | 73 | # JIRA plugin 74 | atlassian-ide-plugin.xml 75 | 76 | # Cursive Clojure plugin 77 | .idea/replstate.xml 78 | 79 | # SonarLint plugin 80 | .idea/sonarlint/ 81 | 82 | # Crashlytics plugin (for Android Studio and IntelliJ) 83 | com_crashlytics_export_strings.xml 84 | crashlytics.properties 85 | crashlytics-build.properties 86 | fabric.properties 87 | 88 | # Editor-based Rest Client 89 | .idea/httpRequests 90 | 91 | # Android studio 3.1+ serialized cache file 92 | .idea/caches/build_file_checksums.ser 93 | 94 | # ignore env file 95 | .env 96 | 97 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/alfred-zoxide.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 117 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Loo Yi Hou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | Logo 4 |

Alfred Zoxide

5 |
6 | 7 | [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yihou/alfred-zoxide?sort=semver&style=flat-square)](https://github.com/yihou/alfred-zoxide/releases) 8 | [![GitHub downloads](https://img.shields.io/github/downloads/yihou/alfred-zoxide/total?style=flat-square)](https://github.com/yihou/alfred-zoxide/releases/download/v0.0.1/Zoxide.alfredworkflow) 9 | [![GitHub issues](https://img.shields.io/github/issues/yihou/alfred-zoxide?style=flat-square)](https://github.com/yihou/alfred-zoxide/issues) 10 | [![GitHub license](https://img.shields.io/github/license/yihou/alfred-zoxide?style=flat-square)](https://github.com/yihou/alfred-zoxide/blob/master/LICENSE) 11 | 12 | A simple [Alfred][1] workflow to search and navigate to directories that are saved in [Zoxide][2]. 13 | 14 | ## Installation 15 | 16 | 1. Install library [Zoxide][2], see [Dependencies](#dependencies) for more details. 17 | 2. Install [alfred-zoxide][3] workflow. 18 | 3. All further updates are handled automatically. 19 | 20 | ## Usage 21 | 22 | In Alfred, type `z` followed by search `query`. 23 | 24 | With the selected result, you can: 25 | 26 | - press `⌅`(Enter) to open directory in terminal 27 | - press `⌘`(Cmd) to open directory in Finder 28 | - press `⌃`(Shift) to copy directory path to clipboard 29 | 30 |

31 | demo.gif 32 |

33 | 34 | ## Dependencies 35 | 36 | [Zoxide][2] is required to be installed on your system. 37 | 38 | Zoxide installation from [Zoxide][2] README: 39 | 40 | > To install zoxide, use a package manager: 41 | > 42 | > | Repository | Instructions | 43 | > | --------------- | ----------------------------------------------------------------------------------------------------- | 44 | > | **[crates.io]** | `cargo install zoxide --locked` | 45 | > | **[Homebrew]** | `brew install zoxide` | 46 | > | [asdf] | `asdf plugin add zoxide https://github.com/nyrst/asdf-zoxide.git`
`asdf install zoxide latest` | 47 | > | [conda-forge] | `conda install -c conda-forge zoxide` | 48 | > | [MacPorts] | `port install zoxide` | 49 | > 50 | > Or, run this command in your terminal: 51 | > 52 | > ```sh 53 | > curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash 54 | > ``` 55 | 56 | ## Credits 57 | 58 | The workflow makes use of the following: 59 | 60 | [Zoxide][2] by Ajeet D'Souza as the backend to search for saved directories. 61 | 62 | [OneUpdater][4] by Vítor Galvão for handling automatic updates. 63 | 64 | [1]: https://www.alfredapp.com/ 65 | [2]: https://github.com/ajeetdsouza/zoxide 66 | [3]: https://github.com/yihou/alfred-zoxide 67 | [4]: https://github.com/vitorgalvao/alfred-workflows/tree/master/OneUpdater 68 | -------------------------------------------------------------------------------- /images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yihou/alfred-zoxide/d3f9f284f05dc3f9ae318613729938d6d899ed68/images/demo.gif -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yihou/alfred-zoxide/d3f9f284f05dc3f9ae318613729938d6d899ed68/images/icon.png -------------------------------------------------------------------------------- /src/Zoxide.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yihou/alfred-zoxide/d3f9f284f05dc3f9ae318613729938d6d899ed68/src/Zoxide.alfredworkflow -------------------------------------------------------------------------------- /src/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.yihou.alfred-zoxide 7 | category 8 | Tools 9 | connections 10 | 11 | 06B09CC4-667A-4041-8E57-B89912E3E931 12 | 13 | 14 | destinationuid 15 | C5544689-113F-4CB1-B0FE-0F34CACE99A2 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 1049A4F8-86E7-40DD-87FE-677CE600603F 25 | 26 | 27 | destinationuid 28 | 26DA2609-8A71-4F58-B9BF-DFD55318CC6D 29 | modifiers 30 | 0 31 | modifiersubtext 32 | 33 | vitoclose 34 | 35 | 36 | 37 | destinationuid 38 | 06B09CC4-667A-4041-8E57-B89912E3E931 39 | modifiers 40 | 1048576 41 | modifiersubtext 42 | Open "{query}" in Finder 43 | vitoclose 44 | 45 | 46 | 47 | destinationuid 48 | 778AE989-079D-431A-BE6A-776BCB3F4D0F 49 | modifiers 50 | 262144 51 | modifiersubtext 52 | Copy "{query}" to clipboard 53 | vitoclose 54 | 55 | 56 | 57 | 26DA2609-8A71-4F58-B9BF-DFD55318CC6D 58 | 59 | 60 | destinationuid 61 | C5544689-113F-4CB1-B0FE-0F34CACE99A2 62 | modifiers 63 | 0 64 | modifiersubtext 65 | 66 | vitoclose 67 | 68 | 69 | 70 | 778AE989-079D-431A-BE6A-776BCB3F4D0F 71 | 72 | 73 | destinationuid 74 | C5544689-113F-4CB1-B0FE-0F34CACE99A2 75 | modifiers 76 | 0 77 | modifiersubtext 78 | 79 | vitoclose 80 | 81 | 82 | 83 | 84 | createdby 85 | Loo Yi Hou 86 | description 87 | A simple workflow to search and navigate directories that are saved in zoxide 88 | disabled 89 | 90 | name 91 | Zoxide 92 | objects 93 | 94 | 95 | config 96 | 97 | escaping 98 | 0 99 | script 100 | z {query} 101 | 102 | type 103 | alfred.workflow.action.terminalcommand 104 | uid 105 | 26DA2609-8A71-4F58-B9BF-DFD55318CC6D 106 | version 107 | 1 108 | 109 | 110 | config 111 | 112 | alfredfiltersresults 113 | 114 | alfredfiltersresultsmatchmode 115 | 0 116 | argumenttreatemptyqueryasnil 117 | 118 | argumenttrimmode 119 | 0 120 | argumenttype 121 | 0 122 | escaping 123 | 102 124 | keyword 125 | z 126 | queuedelaycustom 127 | 3 128 | queuedelayimmediatelyinitially 129 | 130 | queuedelaymode 131 | 0 132 | queuemode 133 | 1 134 | runningsubtext 135 | Loading... 136 | script 137 | max_display_path_length=50 138 | ellipsis="..." 139 | 140 | # query with trimmed white space 141 | query=$(echo $1 | tr -s '[:blank:]') 142 | 143 | results=$(zoxide query $query -l) 144 | 145 | # Read each line of the multiline string into an array 146 | IFS=$'\n' read -d '' -ra items <<<"$results" 147 | 148 | echo "<?xml version='1.0'?>" 149 | echo "<items>" 150 | if [ -z "$items" ]; then 151 | echo "<item arg='${query}' valid='no'><title>No directories found.</title></item>" 152 | else 153 | 154 | # Loop through each item of the array 155 | for item in "${items[@]}"; do 156 | title="$(basename "$item")" 157 | full_path="${item}" 158 | if ((${#full_path} > $max_display_path_length)); then 159 | trimmed_path="${ellipsis}${full_path:${#full_path}-$max_display_path_length}" 160 | else 161 | trimmed_path="$item" 162 | fi 163 | # trim the path if it's too long 164 | echo "<item arg='${full_path}' valid='yes'>" 165 | echo "<title>${title}</title>" 166 | echo "<subtitle>${trimmed_path}</subtitle>" 167 | echo "<type>file</type>" 168 | echo "</item>" 169 | done 170 | fi 171 | echo "</items>" 172 | 173 | scriptargtype 174 | 1 175 | scriptfile 176 | 177 | subtext 178 | Select a directory 179 | title 180 | Key in search keyword(s) 181 | type 182 | 0 183 | withspace 184 | 185 | 186 | type 187 | alfred.workflow.input.scriptfilter 188 | uid 189 | 1049A4F8-86E7-40DD-87FE-677CE600603F 190 | version 191 | 3 192 | 193 | 194 | config 195 | 196 | path 197 | {query} 198 | 199 | type 200 | alfred.workflow.action.revealfile 201 | uid 202 | 06B09CC4-667A-4041-8E57-B89912E3E931 203 | version 204 | 1 205 | 206 | 207 | config 208 | 209 | concurrently 210 | 211 | escaping 212 | 0 213 | script 214 | # THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH. 215 | readonly remote_info_plist='https://raw.githubusercontent.com/yihou/alfred-zoxide/master/src/info.plist' 216 | readonly workflow_url='yihou/alfred-zoxide' 217 | readonly download_type='github_release' 218 | readonly frequency_check='7' 219 | 220 | # FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED! 221 | function abort { 222 | echo "${1}" >&2 223 | exit 1 224 | } 225 | 226 | function url_exists { 227 | curl --silent --location --output /dev/null --fail --range 0-0 "${1}" 228 | } 229 | 230 | function notification { 231 | readonly local notificator="$(find . -type d -name 'Notificator.app')" 232 | if [[ -n "${notificator}" ]]; then 233 | "${notificator}/Contents/Resources/Scripts/notificator" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available' 234 | return 235 | fi 236 | 237 | readonly local terminal_notifier="$(find . -type f -name 'terminal-notifier')" 238 | if [[ -n "${terminal_notifier}" ]]; then 239 | "${terminal_notifier}" -title "${alfred_workflow_name}" -subtitle 'A new version is available' -message "${1}" 240 | return 241 | fi 242 | 243 | osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\"" 244 | } 245 | 246 | # Local sanity checks 247 | readonly local_info_plist='info.plist' 248 | readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")" 249 | 250 | [[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.' 251 | [[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'." 252 | [[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number." 253 | 254 | # Check for updates 255 | if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then 256 | if ! url_exists "${remote_info_plist}"; then abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."; fi # Remote sanity check 257 | 258 | readonly tmp_file="$(mktemp)" 259 | curl --silent --location --output "${tmp_file}" "${remote_info_plist}" 260 | readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")" 261 | 262 | if [[ "${local_version}" == "${remote_version}" ]]; then 263 | touch "${local_info_plist}" # Reset timer by touching local file 264 | exit 0 265 | fi 266 | 267 | if [[ "${download_type}" == 'page' ]]; then 268 | notification 'Opening download page…' 269 | open "${workflow_url}" 270 | exit 0 271 | fi 272 | 273 | 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}")" 274 | 275 | if url_exists "${download_url}"; then 276 | notification 'Downloading and installing…' 277 | curl --silent --location --output "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" "${download_url}" 278 | open "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" 279 | else 280 | abort "'workflow_url' (${download_url}) appears to not be reachable." 281 | fi 282 | fi 283 | scriptargtype 284 | 1 285 | scriptfile 286 | 287 | type 288 | 0 289 | 290 | type 291 | alfred.workflow.action.script 292 | uid 293 | C5544689-113F-4CB1-B0FE-0F34CACE99A2 294 | version 295 | 2 296 | 297 | 298 | config 299 | 300 | autopaste 301 | 302 | clipboardtext 303 | {query} 304 | ignoredynamicplaceholders 305 | 306 | transient 307 | 308 | 309 | type 310 | alfred.workflow.output.clipboard 311 | uid 312 | 778AE989-079D-431A-BE6A-776BCB3F4D0F 313 | version 314 | 3 315 | 316 | 317 | readme 318 | A simple Alfred workflow to search and navigate directories that are saved in zoxide 319 | 320 | Installation 321 | 1. Install Zoxide from https://github.com/ajeetdsouza/zoxide 322 | 2. Install alfred-zoxide workflow. 323 | uidata 324 | 325 | 06B09CC4-667A-4041-8E57-B89912E3E931 326 | 327 | xpos 328 | 270 329 | ypos 330 | 170 331 | 332 | 1049A4F8-86E7-40DD-87FE-677CE600603F 333 | 334 | xpos 335 | 45 336 | ypos 337 | 50 338 | 339 | 26DA2609-8A71-4F58-B9BF-DFD55318CC6D 340 | 341 | xpos 342 | 270 343 | ypos 344 | 50 345 | 346 | 778AE989-079D-431A-BE6A-776BCB3F4D0F 347 | 348 | xpos 349 | 270 350 | ypos 351 | 290 352 | 353 | C5544689-113F-4CB1-B0FE-0F34CACE99A2 354 | 355 | colorindex 356 | 12 357 | note 358 | OneUpdater 359 | xpos 360 | 545 361 | ypos 362 | 170 363 | 364 | 365 | userconfigurationconfig 366 | 367 | version 368 | 0.0.1 369 | webaddress 370 | https://github.com/yihou/alfred-zoxide 371 | 372 | 373 | --------------------------------------------------------------------------------