Jump to content

? command should substitute values for environmental variables


Recommended Posts

15 hours ago, Chris Messina said:

Shouldn't these results use the values of the environmental variables?

 

Depends how you look at it, I suppose.

 

You're effectively running the "Alfred help" workflow, and it doesn't set those variables, so there are no values to use.

 

I’m not sure it’s tenable to populate the variables from their source workflows in help mode because Alfred would potentially have to bootstrap all your workflows every time you run the help, which might absolutely murder performance.

 

This is mostly just a guess (only Andrew knows how Alfred actually works), but Alfred doesn't load workflows the way other programs load plugins (i.e. bootstrap and load everything on program start, and have it all in memory ready to go). It's more like your shell, where it knows what keywords/commands exist, but workflow's aren't loaded or running in any meaningful sense until you actually execute one. That way, Alfred's start-up time and RAM usage don't balloon as you install more workflows. Alfred's performance and resource usage remain basically the same, regardless of whether you have 10 workflows or 1000.

Edited by deanishe
Link to comment
Share on other sites

7 hours ago, deanishe said:

You're effectively running the "Alfred help" workflow, and it doesn't set those variables, so there are no values to use.

 

Yeah, I imagined that could be a faster lookup that didn't do any processing — because in some cases the variables won't be able to be calculated without running the workflow first. It just looked odd — like code was leaking into the UI, but I do see why it is this way.

Link to comment
Share on other sites

9 hours ago, Chris Messina said:

because in some cases the variables won't be able to be calculated without running the workflow first

 

Yeah. Actually running workflows is completely out of the question because of the side effects.

 

It might be possible for Alfred to also interpolate static values from info.plist/the config sheet when it’s compiling its help data. I have no idea how feasible that is architecturally. It does already read those variables when loading a workflow because you can use {var:...} in Keyword fields, too.

 

9 hours ago, Chris Messina said:

It just looked odd — like code was leaking into the UI

 

Yeah, it does look odd. It also means that you can't find workflows by keyword if the keyword is set via a variable. As far as help is concerned, it’s {var:keyword}.

 

keywords.png.28c861bf5234f0b770293366e572a577.png

This isn't very common, however, and there's no reason to do it at all any more.

 

Edited by deanishe
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...