Jump to content
_mk_

Mavericks Tags - File and Email Tagging with Alfred 2 (updated to v1.4)

Recommended Posts

Here's something you can experiment with.

 

- Use Homebrew to install 'tag' (https://github.com/jdberry/tag/).

- Create a test file and tag it with a tag that's not in use on your system.

- Create another test file and go to Finder. Bring up the info view and click in the tags area. If you start to type the name of your test tag, it'll autocomplete. Finder knows about it.

- Look in the com.apple.finder.plist. The tag isn't in there.

 

So _something_ is monitoring tags and keeping a running list of tags used on the system. It might be just in memory but I don't think so, because the list survives restarts. It might be just in Finder, it might be an unpublished system call. 

 

Curious.

Share this post


Link to post

It looks like there's a second file - ~/Library/SyncedPreferences/com.apple.finder.plist - that has a list of all of the "pure" tags, e.g., not a label that acts like a faux tag. Unfortunately, this list is only updated by Finder when you assign a tag to a file through Finder. If you tag a file and never interact with it through Finder then the tag doesn't show up in this file. Still, if you merge the contents of both preferences lists you'll get closer to a comprehensive tag list.

Share this post


Link to post

Just for the record, Paul Kim, the developer of Hazel, struggled with the exact same issue when updating Hazel to manage Mavericks tags (I should know – I was the one reporting the issue to him :)). AFAIK, he ended implementing the exact same solution…

Share this post


Link to post

What the workflow does is:

/usr/bin/mdfind -0 "(kMDItemUserTags == '*')" |xargs -0 mdls -name kMDItemUserTags |grep '^    ' |cut -c5- |cut -d , -f 1 |sort -u

This queries all tagged files and then extracts the distinct tag names. I am a bit concerned about the performance if one has lots of tagged files. I hope that Apple will come up with an improved tagging support in the future.

Share this post


Link to post

It works if you select the application in Alfred's file browser and invoke the "Manage Tags" file action. I'll have a look why it's not working with the Finder selection.

Share this post


Link to post

Hmm, I think that's what I'm doing. Invoke Alfred, start typing the name of the application, then arrow-key to Manage Tags and hit enter. It brings up the Alfred pane with ".tags" ready to add. I type in a tag, hit enter, and up pops the error. Is that the wrong route? Thanks.

Share this post


Link to post

After you have selected "Manage Tags" and hit ENTER, make sure to select "Add Tag" and hit ENTER. Then input the tag name and press ENTER again.

Share this post


Link to post

How do you tag multiple files at once? Whether using Alfred's buffer, or selecting multiple files in Finder, the action "Manage Tags" doesn't display for me.

 

Edit: I see it works with the hotkey. Is it possible to get the "Manage Tags" action working for multiple files as well?

Edited by paulw

Share this post


Link to post

I'm trying to figure out how to tag emails. No success so far. I've tried both

 

select email --> press ⌘-⌥-\ # nothing happened, beeping sound for failure.

 

select email --> open aflred --> type .tag --> enter tag  # tag is applied on previously selected fie

 

 

I can tag single file using

 

select file --> press ⌘-⌥-\ --> manage tags --> add tag

 

 

I cannot find how to do multiple files though.

Share this post


Link to post

The workflow was updated to version 1.4:


 


New Features:


  • "Manage Tags" file actions now supports multiple files from Alfred's file buffer

Share this post


Link to post

I'm trying to figure out how to tag emails. No success so far. I've tried both

 

select email --> press ⌘-⌥-\ # nothing happened, beeping sound for failure.

 

select email --> open aflred --> type .tag --> enter tag  # tag is applied on previously selected fie

 

 

I can tag single file using

 

select file --> press ⌘-⌥-\ --> manage tags --> add tag

 

 

I cannot find how to do multiple files though.

 

The hotkey for tagging mails is ⌥M

Share this post


Link to post

Great workflow!
but in my system, Mac OS X 10.9.2 Japanese language, my all japanese tags are garbled.
Do you have any idea?
 
Thanks in advance.

screenshotTopost.jpg

Edited by eijitokyo

Share this post


Link to post

The workflow looks interesting. Will it autocomplete tags while they are typed?

 

I too was wondering about this. I haven't dug too deeply but the autocomplete functionality is essentially broken but also completely unneeded. When searching for a tag "todo":

.tagged tod

...Alfred's already filled with files matching any tag starting with "tod" (on my system, only the "todo" tag). Hitting TAB at this point autocompletes the first item's file name; I believe since it's a filefilter the item is treated as a file would be - which autofills "Grocery List.txt" intending to search for a tag with that name.

 

In any case, the only reason you'd need TAB to autocomplete to the intended tag is if you were looking at multiple tags starting with, as an example, "tod" maybe like "todo" and "today". If that were the case, how would you expect TAB to react? Autocomplete the one with more files, or the one most recently used, or most frequently used? Any, I don't see a huge need for the tag autocompletion.

 

...what I would LOVE to see (FEATURE REQUEST!) is the ability to search for file/folder names that are tagged with X. The theoretical format would be like this:

.tagged todo grocery list

Now I'm not sure if OS X allows spaces in tags, I'll assume it does, so some sort of delimiter is probably needed in my example between "todo" and "grocery" - the colon is a likely choice since that can't be used in filenames.

 

Ironically, I just realized it would be useful to have tags autocompleted for this operation.

.tagged to[TAB]do: grocery

Anyway. Thanks for all the work you've put into this workflow. It's been great to use!

Share this post


Link to post

I get the following error when trying to tag an application on 10.9.5

"Processing output 'alfred.workflow.output.notification' with arg 'tag: The operation couldn’t be completed. (OSStatus error -5000.)Tag Startup added to file(s): Fresh.app'"

Share this post


Link to post

You can just replace all the references in info.plist to Alfred 2 with Alfred & it will work.  Except the .taglist is taking eons to complete. 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...