Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _mac_applications patch for Mac OS X 10.4



In   _open I just have this:

  case "$state" in
    open_mac_applications)
      if [[ $OSTYPE[7] -ge '8' ]]; then
        _init_open_tiger
      else
        _init_open
        _alternative \
            "commands: :_mac_applications" \
            "files:: _open_absolute_application_path"
      fi
      ;;


I wrote an augmented open function and hacked an _open completion for it based on Motoi's version. The open function and its dependencies are here:

http://www.chemistry.ucsc.edu/%7Ewgscott/mystuff/zsh_tree.html

This gives open a few extra (non-apple) arguments, like open -p to open preference panes, open -w to open widgets, open -x to open x11 apps, and so forth.


Also I hacked the _fink completion function and made a function fink (same page) that updates the cache after an installation, update, and so on.

Please feel free to incorporate and/or improve any of these. I wrote them to learn shell scripting so they are unlikely to be works of art.



William G. Scott

Associate Professor
Department of Chemistry and Biochemistry
and The Center for the Molecular Biology of RNA
Sinsheimer Laboratories
University of California at Santa Cruz
Santa Cruz, California 95064
USA

On May 11, 2005, at 8:42 AM, lists wrote:

After poking around some more, I think the best thing to do would be to modify _retrieve_mac_apps() so that it uses Spotlight to find the apps if you're running Tiger, and the old way if you're not running Tiger. This way the apps would be found using Spotlight the first time, then added to the cache so you don't have to keep using mdfind every time you try to tab complete an app's name. Motoi, since you are the expert on _retrieve_mac_apps() what do you think?

-Ryan


On May 11, 2005, at 9:49 AM, lists wrote:

I've done some tweaking based on the submission in <http://www.zsh.org/mla/users/2005/msg00479.html> (thanks Scott and Wataru) and have put together a patch for _mac_applications which uses the _tiger_mac_applications function from the aforementioned submission (which I've renamed to _spotlight_mac_apps since Spotlight will probably be around after Tiger). _mac_applications will now use Spotlight (via _spotlight_mac_apps) if you're running Mac OS X 10.4, and will fall back to the old way if you're not. I'm also including the modified _spotlight_mac_apps function (which will now check for an Applications folder in your home directory as well). Please let me know if there are any problems/objections.

Thanks,
Ryan


<_mac_applications.diff.gz>
<_spotlight_mac_apps.gz>





Messages sorted by: Reverse Date, Date, Thread, Author