paulmoons Posted December 25, 2022 Share Posted December 25, 2022 I've posted this in the help forum and after 37 views and no response, I figure this can't be done at present but it is a feature that I feel should be present! In the Alfred search results, Alfred should provide the option of showing a file's coloured dot that corresponds to its tag? My use case is that I have multiple iterations of the same file in archived folders and running a search turns up all of them - which is as I desire.. but I want to be able to quickly identify if I am looking at an old file (tagged with a red "archive" colour dot) or I am looking at an untagged (current) file. Please see the mock example I have created in the annotated image where two files have the same name but are located in two different folders. If one were tagged with a red dot as illustrated, it would make identification much easier of both which are tagged (archived files) and which are not (current). I know the URL gives this away but in a list of ten identical files, it is cumbersome identifier which gets even less useful when the URLs to compare are many and very similar. While the example image provided has the tag at the end of the result, this would probably work better at the front of the file name or perhaps at the front of the URL? Other than some kind of technical issue, I really can't for the life of me think why this hasn't been implemented earlier. Thoughts? TomBenz 1 Link to comment Share on other sites More sharing options...
paulmoons Posted January 18, 2023 Author Share Posted January 18, 2023 Nobody? Link to comment Share on other sites More sharing options...
giovanni Posted January 19, 2023 Share Posted January 19, 2023 (edited) it might be too slow, but I have added this feature to aadvarq (a draft workflow created in response to another question on the forum) Check the 'Show Label Colors' option, then search using the zzz keyword. Because it is so slow if there are many results, I restricted the search query to 4+ characters. happy to refine with a faster method (currently using mdls) if others have suggestions. Edited January 19, 2023 by giovanni paulmoons 1 Link to comment Share on other sites More sharing options...
paulmoons Posted January 19, 2023 Author Share Posted January 19, 2023 Hey there! Thanks for responding! I took a look at your extension and unfortunately I don't think it meets my use case. I'm trying to essentially see where a file is located instantly by using its tag. Searching via tag doesn't work because I want to see the tagged and untagged files, just want to instantly identify them visually. I could potentially use your workflow to always search with the "NOT <tag>" setting but this might be cumbersome? Wait. It's not a perfect solution but, having just looked through your links I noticed the alfred:ignore comment. In theory I could just use the alfred:ignore comment in place of my "archive" tag and therefore stop those files from turning up in the search results. Not ideal but it would make life easier. Hmm.. Thanks again for dropping by! Link to comment Share on other sites More sharing options...
giovanni Posted January 19, 2023 Share Posted January 19, 2023 Hi @paulmoons to clarify, what I added is a general search (keyword: zzz) which shows the tags Link to comment Share on other sites More sharing options...
paulmoons Posted January 19, 2023 Author Share Posted January 19, 2023 @giovanni Ooo.. that's pretty cool. Thanks! I'll investigate further. If only I could get Alfred to default to using this workflow. Dumb Question: Could you run a regular search in Alfred and then when you notice multiples of the same file apply a keystroke to invoke the workflow and bring up the dots? Link to comment Share on other sites More sharing options...
vitor Posted January 19, 2023 Share Posted January 19, 2023 7 hours ago, giovanni said: aadvarq Fun name! It will be in the Gallery soon under https://alfred.app/workflows/giovanni/aadvarq/. May I suggest grouping the configuration for both Keywords? The Tag keyword is configured at the top, while the Search keyword is at the bottom. 6 hours ago, paulmoons said: the alfred:ignore comment. In theory I could just use the alfred:ignore comment in place of my "archive" tag and therefore stop those files from turning up in the search results. The Ignore in Alfred workflow exists for that use case. Link to comment Share on other sites More sharing options...
paulmoons Posted January 19, 2023 Author Share Posted January 19, 2023 2 hours ago, vitor said: The Ignore in Alfred workflow exists for that use case. Thank-you. Looks like I have found a workaround, although I still think using coloured dots to see tags by default is a much better solution! Link to comment Share on other sites More sharing options...
giovanni Posted January 20, 2023 Share Posted January 20, 2023 (edited) On 1/19/2023 at 3:06 PM, vitor said: May I suggest grouping the configuration for both Keywords? I made this change. Still trying to get it to be faster... Right now, in order to get tag info, it runs mdls as a subprocess in the Python script. I tried mdfind and it is even slower. I also tried to run mdls directly in the shell, then passing 2 arrays (file paths and labels) to the Python script, and I was surprised to see that it is still slower than running subprocesses in Python? I must be doing something wrong. The shell script is below if anybody has suggestions. export PATH=/opt/homebrew/bin:/usr/local/bin:$PATH myQuery="$1" if [[ ${#myQuery} -gt 3 ]] then # Use the -0 option to separate file names with a null character IFS=$'\n' while read -r -d '' file; do # Append the file name to the array files+=("$file") done < <(mdfind "kMDItemDisplayName == '*$myQuery*'c" -0 -onlyin ~/) for file_path in "${files[@]}" do # Use mdls to retrieve the metadata of the file # then parse the output tags=$(mdls -name kMDItemUserTags "$file_path" | sed 's/kMDItemUserTags = (//g' | sed 's/)//g' | tr -d ' ' | tr -d '\n') # Append the tags to the array tags_array+=("$tags") done fi python3 aadv.py "$files" "$tags_array" else cat << EOB {"items": [ { "title": "❗Enter 4 characters at least", "subtitle": "length: ${#myQuery} (${myQuery})" } ]} EOB fi Edited January 20, 2023 by giovanni Link to comment Share on other sites More sharing options...
paulmoons Posted January 26, 2023 Author Share Posted January 26, 2023 You lost me. 😅 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