Jump to content
Sign in to follow this  
tmonney

Index kMDItemAlternateNames attribute

Recommended Posts

Hi,

 

First of all, thanks for this great tool!

 

I noticed that Alfred does not take the kMDItemAlternateNames attribute into account when indexing/searching.

 

The basic use case is described at https://github.com/phinze/homebrew-cask/issues/2847. Basically, homebrew-cask now allows to change the target symlink it creates in ~/Applications. This is useful when several applications have the same final name (for example, multiple Eclipse IDE variations end up in ~/Applications/Eclipse.app. Using target renaming, one can have ~/Applications/Eclipse.app and ~/Applications/Scala IDE.app, pointing to /opt/homebrew-cask/Caskroom/eclipse-ide/4.3.1/eclipse/Eclipse.app, resp. /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app.

 

The problem now is that one cannot search 'Scala IDE', since neither Alfred nor Spotlight index symlinks. A solution is to add extended attributes to the application bundle. Concretely, running the following:

 

$ xattr -w com.apple.metadata:kMDItemAlternateNames '("Scala IDE")' /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app

 

allows Spotlight to find the application with the 'Scala IDE' query. Alfred does not index it though. It would be nice to

  1. index the kMDItemAlternateNames attribute
  2. use it as the displayed label in the Alfred search box when a match is found on this attribute

Thoughts?

 

Share this post


Link to post
Share on other sites

Hi,

 

First of all, thanks for this great tool!

 

I noticed that Alfred does not take the kMDItemAlternateNames attribute into account when indexing/searching.

 

The basic use case is described at https://github.com/phinze/homebrew-cask/issues/2847. Basically, homebrew-cask now allows to change the target symlink it creates in ~/Applications. This is useful when several applications have the same final name (for example, multiple Eclipse IDE variations end up in ~/Applications/Eclipse.app. Using target renaming, one can have ~/Applications/Eclipse.app and ~/Applications/Scala IDE.app, pointing to /opt/homebrew-cask/Caskroom/eclipse-ide/4.3.1/eclipse/Eclipse.app, resp. /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app.

 

The problem now is that one cannot search 'Scala IDE', since neither Alfred nor Spotlight index symlinks. A solution is to add extended attributes to the application bundle. Concretely, running the following:

 

$ xattr -w com.apple.metadata:kMDItemAlternateNames '("Scala IDE")' /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app

 

allows Spotlight to find the application with the 'Scala IDE' query. Alfred does not index it though. It would be nice to

  1. index the kMDItemAlternateNames attribute
  2. use it as the displayed label in the Alfred search box when a match is found on this attribute

Thoughts?

 

Alfred does take into account alternative names, but not in his app cache. I've actually fixed this already for the upcoming Alfred 2.2 release though, as it also addresses a localisation issue.

 

If you prefix a search with [spacebar], it bypasses the app cache, so you'll likely see eclipse when typing:

 

[spacebar]scala

 

Cheers,

Andrew

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...