pseudometa Posted April 23 Share Posted April 23 When using a Script Filter, we can use `$.getenv("alfred_workflow_keyword")` to display different content depending on the keyword used. For example, using `foo||bar` as the keyword, the Script Filter then shows different results for when using `foo` or `bar` as keyword. Now, when you also use the new cache mechanic from Alfred 5.5, there appears to be a bad interaction between the two: I run the Script Filter first with `foo …` and get some results displayed. If I afterward run `bar …`, Alfred uses the results cached for `foo` instead of running the script again with `bar` as `$.getenv("alfred_workflow_keyword")`. This results in the wrong results being displayed. In short, it appears that Alfred creates one cache per Script Filter, and not one cache per keyword. As a consequence, this means the caching mechanic cannot be used when also using alternate keywords. Build: Alfred 5.5.2257 Link to comment Share on other sites More sharing options...
Andrew Posted May 10 Share Posted May 10 I'm going to move this to feature suggestions as Alfred is caching as intended, and to manage expectations, it's unlikely the caching will be environmentally aware in the foreseeable future (i.e. cache differently per keyword used). On 4/23/2024 at 10:30 AM, pseudometa said: When using a Script Filter, we can use `$.getenv("alfred_workflow_keyword")` to display different content depending on the keyword used. While you _could_ do this, I generally wouldn't recommend using keywords for logic in a script, as keywords are better configurable by the end user. You have a few options: Use multiple Script Filters which bootstrap to the same script Implement some custom caching within your script Cheers, Andrew pseudometa 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now