Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apps in spotlight #188

Closed
wants to merge 2 commits into from
Closed

Apps in spotlight #188

wants to merge 2 commits into from

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Apr 6, 2013

Alright folks. Here's a PR for commentary.

This addresses both #99 and #143 - and possibly a few more I'm missing.

Please comment and question and poke and prod here and once we all feel good we can merge!

🔍 🔎 🔍 🔎

@patcon
Copy link
Contributor

patcon commented Apr 7, 2013

Sahweet. You're now in my bitcoin-qt address book. Just sent you a beer :)
https://blockchain.info/address/1BueqoZU3vyhPWx5nJDsAsyDDaWtZz6yit

Also: https://twitter.com/patconnolly/status/320693929018273793

@vitorgalvao
Copy link
Member

There seems to be no objections, I say “do it”.

@ghost
Copy link

ghost commented Apr 12, 2013

Sounds good.

I'm not against the move to /opt if it's the best way to handle this but I do wonder if there isn't a way to change system settings somehow to get spotlight to properly index the current location. Having everything under /usr/local is kind of nice.

@ghost
Copy link

ghost commented Apr 12, 2013

Maybe this is already known but if you do a spotlight search (through Finder), hit +, change the first pulldown (should say 'Kind') to 'Other…' and select 'System files' and the second pulldown to 'are included', then if you do a search for an app you have installed in /usr/local/Caskroom, it will show up.

I don't know much about how spotlight works under the hood but this suggests to me that there may be some way to get this to work by default through a configuration setting.

@phinze
Copy link
Contributor Author

phinze commented Apr 12, 2013

@darinmorrison thanks for those instructions - that explanation makes sense.

Unfortunately from all my research I have not been able to find a way to add items to Spotlight programmatically. After all the hours I've spent scouring the internet and coding up workaround solutions (Finder Alias, Appify), I think I've settled on moving to /opt as the cleanest and safest solution for now.

I'd welcome anyone else who'd like to jump in on this, but for now I'm going to be done messing with this nasty closed-off area of the Apple kingdom. :) 🍎 👉 💣

@phinze phinze closed this in 74bdbd8 Apr 12, 2013
@pangratz
Copy link
Contributor

😍 🍻 Thanks @phinze !!

@ghost
Copy link

ghost commented Apr 13, 2013

@phinze totally understand.

FWIW, I spent some time digging around to see what I could come up with. Something like the following should work but I can't seem to get it to, at least on 10.8.3.

NOTE: If you want to play around with it, backup $SPOTLIGHT_SETTINGS before. If you run --unmodify before --modify, it will trash some settings. A better way would be to make a backup of the original file and then restore it.

#!/bin/bash

SPOTLIGHT_SETTINGS="/System/Library/CoreServices/Finder.app/Contents/Resources/default_smart.plist"

function modify_spotlight
{
    # use PlistBuddy to modify the default spotlight search settings
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0                dict"                                             $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:rowType        integer 0"                                        $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:displayValues  array"                                            $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:displayValues: string  \"SEARCH_SYSTEM_FILES\""                  $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:displayValues: string  \"YES\""                                  $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:subrows        array"                                            $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:criteria       array"                                            $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:criteria:      string  \"com_apple_SearchSystemFilesAttribute\"" $SPOTLIGHT_SETTINGS
    sudo /usr/libexec/PlistBuddy -c "Add :SearchCriteria:FXCriteriaSlices:0:criteria:      integer 1220"                                     $SPOTLIGHT_SETTINGS
}

function unmodify_spotlight
{
    # use PlistBuddy to unmodify the default spotlight search settings
    sudo /usr/libexec/PlistBuddy -c "Delete :SearchCriteria:FXCriteriaSlices:0"                                                              $SPOTLIGHT_SETTINGS
}

function usage
{
    echo "usage: $0 [--modify | --unmodify]"
}

case $1 in
    -m | --modify )     modify_spotlight
                        ;;
    -u | --unmodify )   unmodify_spotlight
                        ;;
    -h | --help )       usage
                        exit
                        ;;
    * )                 usage
                        exit 1
esac

faun pushed a commit to faun/homebrew-cask that referenced this pull request Jun 15, 2014
downgrade keepassx2 (alpha) to keepassx0 (old)
@phinze phinze mentioned this pull request Jun 11, 2016
1 task
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Applications don't appear in spotlight
4 participants