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

Applications don't appear in spotlight #99

Closed
phinze opened this issue Nov 15, 2012 · 19 comments
Closed

Applications don't appear in spotlight #99

phinze opened this issue Nov 15, 2012 · 19 comments

Comments

@phinze
Copy link
Contributor

phinze commented Nov 15, 2012

Pivotal folks have brought this issue up. Needs fixing!

It seems spotlight may not deal with symlinks properly. Needs more investigation.

@patcon
Copy link
Contributor

patcon commented Dec 6, 2012

I can't remember whether this was brought up anywhere, but finder aliases will still show up in spotlight, albeit as "Documents". If this is worth pursuing, then aliases can be created programmatically through applescript, which can be run from a single terminal command:

http://macstuff.beachdogs.org/blog/?p=37
http://hints.macworld.com/article.php?story=20010427022452992

/cc @mkocher @cunnie

@passcod
Copy link
Contributor

passcod commented Dec 7, 2012

Better yet, we could use appify (or port it to Ruby) to create .apps that launch (instead of link to) the application (which could stay in the Cellar). I believe this is the strategy used by Steam :)

@patcon
Copy link
Contributor

patcon commented Dec 7, 2012

Hm. I like that! 👍

Might be helpful to port to ruby, and then we could probably grab the icon somehow too

@passcod
Copy link
Contributor

passcod commented Dec 14, 2012

OK, I ported it to ruby in its own Gem: https://rubygems.org/gems/appify
An integration (using #114) could look like this:

require 'appify'

app = Appify::App.new
app.run = "#!/bin/bash\nopen #{cask.destination_path}/#{file}.app"
app.write Cask.appdir.join "#{file}.app"
# done.

I might just improve the gem a bit so it can support adding and reading custom metadata (so we can manage the cask aliases more effectively) and icons (everybody loves pretty shiny things). But, just yet, as a proof-of-concept, it doesn't look too bad, huh?

Screen Shot 2012-12-14 at 11 16 22 PM
It shows up in Spotlight just fine, and launching it from there works!

@patcon
Copy link
Contributor

patcon commented Dec 14, 2012

Nice!! This is effin awesome. I could kiss you @passcod, if there wasn't all this internet between us! Count your lucky stars

@patcon
Copy link
Contributor

patcon commented Jan 28, 2013

Hey @passcod, I don't suppose the code for the appify port is on github?

@passcod
Copy link
Contributor

passcod commented Jan 28, 2013

It's not, actually. You can get at it by expanding the gem... it's in a git repo on my home box, I'll push it up this afternoon.

@phinze
Copy link
Contributor Author

phinze commented Jan 28, 2013

Oh I stumbled across a simpler and potentially cleaner solution to this the other day.

Homebrew recently incorporated code to make a "Finder alias" when linking, which allows spotlight to find apps properly.

https://github.com/mxcl/homebrew/pull/14821/files

Seems simple enough to suit our needs. I was going to give it a shot this week. Thoughts?

@passcod
Copy link
Contributor

passcod commented Jan 28, 2013

Wow magic prefix! This is cool. Definitely simpler and Homebrew-supported == free work :)

@patcon
Copy link
Contributor

patcon commented Jan 29, 2013

@phinze
Copy link
Contributor Author

phinze commented Jan 29, 2013

Just tested locally, Works for me ™️

More specifically, I tried:

osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/Cellar/iterm2/1.0.0.20120203/iTerm.app" at POSIX file "/Applications/"'

And:

osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/Cellar/caffeine/1.1.1/Caffeine.app" at POSIX file "/Applications/"'

Spotlight has them showing up under "Documents", but selecting them does indeed launch.

@patcon
Copy link
Contributor

patcon commented Jan 29, 2013

Nice!

cc @cunnie Does that solve the use-case satisfactorily?

@passcod
Copy link
Contributor

passcod commented Feb 16, 2013

I remembered (late, huh) to push appify. (for @patcon). Also, the advantage of appify over the magic number is that it appears under Applications in Spotlight. Just thought I'd mention that.

@patcon
Copy link
Contributor

patcon commented Feb 16, 2013

++
Seems important @passcod

@fbeeper
Copy link

fbeeper commented Apr 4, 2013

Hi there! I've been using this rudimentary AppleScript as a workaround to make the aliases to all my Cask apps:
https://github.com/fbeeper/fBootstrap/raw/master/sw/myCaskLinkApps.scpt
It works 👍 but it is not the nicest solution ever :P

I just wonder...
Are you planning officially include the aliases via the linkapps function like Homebrew did?
Anytime soon? May I help somehow?

phinze added a commit that referenced this issue Apr 5, 2013
phinze added a commit that referenced this issue Apr 5, 2013
 - abiliity to specify linkables #143 #105
 - use bona fide mac aliases for spotlight compat #99
 - started on specifying proper linkables for a subset of apps
@patcon
Copy link
Contributor

patcon commented Apr 6, 2013

@phinze can we get a reply on your thoughts about finder aliases (via applescript) vs "real" apps (appify). It seems spotlight will show finder aliases as "documents" whereas appify converts them to something that is recognized as "Applications".

Is this not a reason to use appify? I can understand if you think it deserves a new issue for the enhancement, but wondering if you think it's a valid concern. (I believe apps show up first in spotlight.) Thanks.

@phinze
Copy link
Contributor Author

phinze commented Apr 6, 2013

Sorry @patcon - I've been doing a lot of hacking this past week but I should have been writing more about it. :)

I set out this last week to get this issue solved once and for all:

I spent some time trying to get the appify strategy up and running consistently, and for the life of me I could not get it to work. I consistently got the PowerPC error [1]. So I turned my attention to the Finder Alias strategy, which I had success with (albeit with the Document caveat). I spent a buttload of time fighting the AppleScript layer - which seems to be the only reliable way to get OS X to create Finder Aliases.

So I have a working implementation of that on my branch, but the behavior is being so finicky that I don't feel comfortable merging it [2].

Now I have one more path I stumbled on along the way. I recently switched to Boxen on my laptop, which moves the Homebrew tree under /opt/boxen - and magically my Caskroom apps started showing up in Spotlight!

So I'm going to try on another branch simply moving the Caskroom to /opt/homebrew-cask/Caskroom to see if that works, and we'll have another potential solution to discuss.

We'll beat this issue soon I swear! 👊

[1] Reported here https://gist.github.com/mathiasbynens/674099/#comment-592022 and several other places
[2] Have a look at this and cry: https://github.com/phinze/homebrew-cask/blob/get-travis-passing/lib/cask/app_linker.rb#L43-L72

@patcon
Copy link
Contributor

patcon commented Apr 6, 2013

So I'm going to try on another branch simply moving the Caskroom to /opt/homebrew-cask/Caskroom to see if that works, and we'll have another potential solution to discuss.

Oh man, I apologize if I seemed ungrateful for all the work you've done one this -- I've been totally MIA from pivotal_workstation/homebrew-cask lately, so I do appreciate it! Hey, I don't suppose you have a bitcoin wallet that I could tip?

Regardless, thanks for the update!

@phinze
Copy link
Contributor Author

phinze commented Apr 6, 2013

Hey hey hey! Things are finally looking okay! Check out #188 and say what you have to say!

@patcon no worries whatsoever. i've been wanting to try out bitcoin! i set up a thing here http://phinze.com/bitcoin

@phinze phinze closed this as completed in 74bdbd8 Apr 12, 2013
fharbe pushed a commit to fharbe/homebrew-cask that referenced this issue Mar 11, 2014
…hon27-caveats

Use caveats DSL in Paraview Lion Python 2.7.
@miccal miccal removed the bug Issue describing a reproducible bug. label Dec 23, 2016
@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 a pull request may close this issue.

5 participants