Jump to content

Alfred’s scope can no longer be changed programatically?


vitor

Recommended Posts

In homebrew-cask, there’s a brew cask alfred link command, that’ll add the Caskroom (think of it as analogous to the Cellar, in homebrew) to Alfred’s scope.

That feature has stopped working with the latest 2.4 update. rolandwalker seems to have narrowed down the origin of the issue a bit. Is there a new preferred way to change Alfred’s scope programatically, or can we consider this a bug in Alfred?

Link to comment
Share on other sites

In homebrew-cask, there’s a brew cask alfred link command, that’ll add the Caskroom (think of it as analogous to the Cellar, in homebrew) to Alfred’s scope.

That feature has stopped working with the latest 2.4 update. rolandwalker seems to have narrowed down the origin of the issue a bit. Is there a new preferred way to change Alfred’s scope programatically, or can we consider this a bug in Alfred?

 

Hey Vitor,

 

This isn't a bug in Alfred, it's just the Alfred local preferences are now stored in a different place (due to a shared preference inheritance issue in Yosemite). The search scope is now stored in...

 

.../Alfred.alfredpreferences/preferences/local/[uID]/features/defaultresults/prefs.plist

 

If you modify that plist file, Alfred will pick up the changes automatically... Essentially, com.runningwithcrayons.Alfred-Preferences is all but deprecated for Alfred 2.4+

 

The path to the preferences and the UID are available in the 2.4 workflow script environment variables:

http://support.alfredapp.com/kb:script-environment-variables

 

If there is anything you need to make this easier to edit, let me know and I'll see what I can do!

 

Cheers,

Andrew

 

[moving to investigating]

Link to comment
Share on other sites

But aren’t those variables available only inside Alfred? Seeing as the UID will presumably change, that can pose an issue to changing the scope from an outside command. As rolandwalker noticed, the issue is we can’t access those preferences with the usual defaults command. Not that it’d be imperative to use that exact command. What we’re looking for is a way to reliably edit (or at the very least add) a new search scope, but the UID complicates matters.

Link to comment
Share on other sites

But aren’t those variables available only inside Alfred? Seeing as the UID will presumably change, that can pose an issue to changing the scope from an outside command. As rolandwalker noticed, the issue is we can’t access those preferences with the usual defaults command. Not that it’d be imperative to use that exact command. What we’re looking for is a way to reliably edit (or at the very least add) a new search scope, but the UID complicates matters.

 

To be honest, there is nothing really wrong with just adding /opt/homebrew-cask/Caskroom for all UIDs under...

 

.../Alfred.alfredpreferences/preferences/local/[uID]/features/defaultresults/prefs.plist

 

If you have multiple Macs syncing, you'll see multiple UIDs and adding the /opt/homebrew-cask/Caskroom folder to each UID means you'd only need to do the link on one Mac and it will set it on all Macs.

 

It's also worth noting that with Alfred's prefs framework, changes are picked up without having to restart Alfred. With the defaults write and the old prefs location, Alfred wouldn't usually pick these up until after a restart of Alfred due to the way preferences are cached and synced while an app is running.

 

Cheers,

Andrew

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...