zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Update _retrieve_mac_apps for recent macOS
Date: Wed, 1 Apr 2020 17:53:29 -0500	[thread overview]
Message-ID: <0427896C-0EA7-4BD0-9605-E69F35055F09@dana.is> (raw)

I noticed that completion for e.g. `open -a` doesn't show stuff like QuickTime
Player on Catalina. That's because most of the built-in apps now live under
/System/Applications (Finder just merges everything together when it displays
/Applications)

But it should have been using Spotlight anyway — it wasn't because the way we
check to see if the root volume is indexed doesn't work any more, and hasn't
worked for a long time i think

This fixes both problems

PS: I didn't address workers/45418 here, but i still plan to

dana


diff --git a/Completion/Darwin/Type/_retrieve_mac_apps b/Completion/Darwin/Type/_retrieve_mac_apps
index f24d36c3c..655170d3a 100644
--- a/Completion/Darwin/Type/_retrieve_mac_apps
+++ b/Completion/Darwin/Type/_retrieve_mac_apps
@@ -73,7 +73,7 @@ _retrieve_mac_apps() {
     typeset retrieve
     if ! zstyle -s ":completion:*:*:${service}:commands" search-method retrieve
     then
-      if [[ -d /.Spotlight-V100 ]]; then
+      if [[ "$( command mdutil -s / 2>&1 )" == *enabled* ]]; then
         # / is indexed to use Spotlight
         retrieve=_mac_apps_spotlight_retrieve
       else
@@ -88,7 +88,10 @@ _retrieve_mac_apps() {
     if ! zstyle -a ":completion:${curcontext}:" application-path app_dir_root
     then
       if [[ $retrieve = _mac_apps_old_retrieve ]]; then
-        app_dir_root=( {,/Developer,/Network,"$HOME"}/{Applications*(N),Desktop} )
+        app_dir_root=(
+          {,/Developer,/Network,/System,$HOME}/{Applications*(N),Desktop}
+        )
+        app_dir_root=( $^app_dir_root(N) )
       else
         app_dir_root=( / )
       fi


                 reply	other threads:[~2020-04-01 22:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0427896C-0EA7-4BD0-9605-E69F35055F09@dana.is \
    --to=dana@dana.is \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).