Jasondm007 Posted June 6, 2019 Share Posted June 6, 2019 (edited) In Alfred 4, were there changes made to the way the JSON Config utility works with File Filters? I have a workflow, that relies on these elements, that now behaves differently after the upgrade. However, I suspect that the workflow was never configured appropriately in the first place, which is why I have not posted this as a bug. In short, this part of the workflow feeds a variable for a Finder tag/label from the JSON Config utility into a File Filter. It also feeds an argument (for an asterisk *) to pre-populate the File Filter's results in a manner that makes them visible to the user in Alfred's search bar (i.e., for those of us who need a gentle reminder about which files include the tag). Unfortunately, since upgrading to Alfred 4, I am no longer able refine or narrow the File Filter's displayed search results by adding more text to Alfred's search bar. The File Filter just spits out the results for the tag/label and does not respond to any text that is added while the results are displayed, which might otherwise narrow the results. Example w. Config To explain, consider the following example for a tag with the value “Yellow” from Finder. The JSON Config utility includes the following code (where the variable “tag” is defined in earlier stages of the workflow and can take on any value, such as Yellow): { "alfredworkflow" : { "arg" : "*", "config" : { "fields" : [ { "field" : "kMDItemUserTags", "split" : false, "not" : false, "value" : "{var:tag}", "words" : true, }, ] } } } Next, the JSON Config utility feeds to a File Filter whose settings are essentially blanked out as follows: Under both Alfred 3 and 4, when triggered, the Filter spits out results that look something like the following: Now, say I’m looking for the “Pooled” Excel file in the results from above. In Alfred 3, if I typed “Pooled” in the search bar, it would narrow the results down accordingly. However, now in Alfred 4, the results no longer narrow when adding additional text - as shown in the screenshot below. To be clear, since the JSON Config utility doesn’t contain any field-related information and the File Filter is essentially blanked out, I've never understood what fields Alfred 3 used to narrow its search results (though it looked like it was using the title). But it always worked like a charm!! If I had to guess, I’d say that Alfred 4’s new sorting options are impacting it. But, to be fair, I’m not sure that the workflow was ever setup correctly in the first place. Does anyone know how to change the JSON config or the File Filter so that it behaves in the same way that it did in Alfred 3 (i.e., to further narrow its results, as described above)? I tried toying with both elements of the workflow but have not had any luck. For testing purposes, I have created a small workflow that includes the relevant portions described above, and uploaded it here: https://cl.ly/0d64ceb966bc It is not the full workflow - which is specific to my odd Finder tags/labels, and contains a few additional steps. In any case, it should help get the ball rolling if my description above is a little tough to follow. Thanks for any help you can lend!! Edited June 6, 2019 by Jasondm007 typos Link to comment Share on other sites More sharing options...
Andrew Posted June 6, 2019 Share Posted June 6, 2019 @Jasondm007 I'm going to move this into the bugs forum to remind me to look at this in the morning. Quite a bit changed with regards to the file filter object, and I want to make sure I haven't introduced a regression. Cheers, Andrew Link to comment Share on other sites More sharing options...
Jasondm007 Posted June 6, 2019 Author Share Posted June 6, 2019 You're the best, @Andrew. Thanks for taking a look at it! Andrew 1 Link to comment Share on other sites More sharing options...
Andrew Posted June 7, 2019 Share Posted June 7, 2019 @Jasondm007 I've taken a quick look at this - you're missing the query field in your fields, so Alfred doesn't know you want to narrow things down. In both Alfred 3 and Alfred 4, your JSON would need to look a bit more like this (note there are normal brackets around the query value to tell Alfred to use the typed {query} instead of the fixed {query} passed into the JSON config😞 { "alfredworkflow" : { "arg" : "*", "config" : { "fields" : [ { "not" : false, "split" : true, "field" : "kMDItemDisplayName", "value" : "(query)", "words" : true }, { "field" : "kMDItemUserTags", "split" : false, "not" : false, "value" : "{var:tag}", "words" : true, }, ] } } } It's also worth noting that I'm making a couple of tweaks in Alfred 4.0.2 which will make using {var:} much more robust within the "Fields" prefs directly (this was added as a v4 feature), so you won't need to use the JSON config at all. I'll be getting 4.0.2 in pre-release today. Cheers, Andrew Jasondm007 1 Link to comment Share on other sites More sharing options...
Andrew Posted June 7, 2019 Share Posted June 7, 2019 4.0.2 is now in pre-release, so you should be able to reliably use {var:tag} directly in Alfred's Fields prefs instead of needing to configure it in JSON. Jasondm007 1 Link to comment Share on other sites More sharing options...
Jasondm007 Posted June 7, 2019 Author Share Posted June 7, 2019 @Andrew Thanks for the clarification on the JSON Config utility! In past attempts to fix the workflow after the upgrade I had mistakenly used the curly brackets {} and not the parentheses () with query, which explains why it didn't work. Also, thanks for the File Filter update in 4.0.2. It works perfectly without the JSON Config utility! It's a million times easier now!! Unrelated to this thread, but thanks for fixing some of the dark mode-related quirks in 4.0.2. It looks great! Thanks again for all of your help, and attention to everything! Honestly, I don't know how people work without Alfred. Hope you have a great weekend! Andrew 1 Link to comment Share on other sites More sharing options...
Andrew Posted June 8, 2019 Share Posted June 8, 2019 @Jasondm007 Thanks for the kind words! Link to comment Share on other sites More sharing options...
Jasondm007 Posted June 8, 2019 Author Share Posted June 8, 2019 (edited) For those who come across this post in the future, and who are looking to do something similar, I’ve uploaded a new version of the test workflow described above here: https://cl.ly/fe0cb259c299 It’s updated to show the two different ways you can accomplish what’s described above. All of the usual caveats apply. Here’s a screenshot of it: The old approach - shown in yellow above - relies on the JSON Config utility (which now works again, thanks to @Andrew). And the new approach - shown in red above - accomplishes everything through the File Filter itself, and by adding the asterisks * directly to the Arg & Vars utility. It will only work if you're using Alfred 4.0.2 or newer. As for the new approach, here’s a few screenshots of the relevant utilities’ settings: File Filter - New Approach Arg & Vars - New Approach (old approach simply excludes the *) Hope this helps! Edited June 8, 2019 by Jasondm007 update screenshot w. correct update no. 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