From bb6160bae4bde93356edce6f331d54b89f0ca8e2 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Sun, 15 Jan 2023 21:39:42 -0500 Subject: [PATCH] Fix `open` completion for macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS 11+ (possibly 12+) has an additional place where certain applications will be installed, `/System/Applications`. This is a sealed system volume and includes the following applications: - `App Store.app` - `Automator.app` - `Books.app` - `Calculator.app` - `Calendar.app` - `Chess.app` - `Clock.app` - `Contacts.app` - `Dictionary.app` - `FaceTime.app` - `FindMy.app` - `Font Book.app` - `Freeform.app` - `Home.app` - `Image Capture.app` - `Launchpad.app` - `Mail.app` - `Maps.app` - `Messages.app` - `Mission Control.app` - `Music.app` - `News.app` - `Notes.app` - `Photo Booth.app` - `Photos.app` - `Podcasts.app` - `Preview.app` - `QuickTime Player.app` - `Reminders.app` - `Shortcuts.app` - `Siri.app` - `Stickies.app` - `Stocks.app` - `System Settings.app` - `TextEdit.app` - `Time Machine.app` - `TV.app` - `Utilities` - `VoiceMemos.app` - `Weather.app` The change here adds `/System/Applications` to the search locations for `-a` and `-b` options on the macOS completions for `open`. There are possibly other locations that may be considered (I’m not using `mdls` or `mdfind` in my functions for "reasons"), but this is partially based on https://github.com/halostatue/fish-macos/blob/main/functions/__macos_app_find.fish --- share/completions/open.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/open.fish b/share/completions/open.fish index 8ec76f4b7..e4e56fba1 100644 --- a/share/completions/open.fish +++ b/share/completions/open.fish @@ -1,6 +1,6 @@ if test (uname) = Darwin # OS X - complete -c open -s a -d 'specify app name' -r -a "(mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /Developer/Applications 'kMDItemContentType==com.apple.application-*' | string replace -r '.+/(.+).app' '\$1')" - complete -c open -s b -d 'specify app bundle id' -x -a "(mdls (mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /Developer/Applications 'kMDItemContentType==com.apple.application-*') -name kMDItemCFBundleIdentifier | string replace -rf 'kMDItemCFBundleIdentifier = \"(.+)\"' '\$1')" + complete -c open -s a -d 'specify app name' -r -a "(mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /System/Applications -onlyin /Developer/Applications 'kMDItemContentType==com.apple.application-*' | string replace -r '.+/(.+).app' '\$1')" + complete -c open -s b -d 'specify app bundle id' -x -a "(mdls (mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /System/Applications -onlyin /Developer/Applications 'kMDItemContentType==com.apple.application-*') -name kMDItemCFBundleIdentifier | string replace -rf 'kMDItemCFBundleIdentifier = \"(.+)\"' '\$1')" complete -c open -s e -d 'open in TextEdit' complete -c open -s t -d 'open in default editor' complete -c open -s f -d 'open stdin with editor'