Jump to content
patowod

Convenient way to tag files with Alfred?

Recommended Posts

Hi everyone on the forum, 

 

I've been reading silent for a long time and love looking through the forums... Today though, I have to ask for some help... I remember having a workflow that made it easy to find and tag files using Alfred. It's been a long time and I can't seem to find anything that does the job quite right.  I know about the built in tag search but it seems as if I can't find any hint on tagging through Alfred. 

 

I only find rather old stuff or repos with a 404. Is there anybody out there that can help, or has a hint on convenient tagging within Alfred?

 

Cheers and thanks in advance for looking at this question

patowod

Share this post


Link to post

Hello and welcome, @patowod,

 

Maybe you’re looking for LabelColor (disclaimer: I wrote it). It’s still supported and will continued to be for the foreseeable future.

 

Share this post


Link to post

Hi vitor, 

 

and thanks for the hint. This sure looks very handy but I'm more in for something like getting the selected file in finder (no problem) and adding e.g. a comma separated tag list or choose from already existing tags. It's pretty cumbersome to add tags to existing files through finder only…

 

Share this post


Link to post

That's how it works (if I've understood you correctly). Use ⌘⌥\ (CMD+OPT+BACKSLASH) to open Alfred with your current Finder selection.

 

It's also extremely easy to edit tags directly in Finder if you add a keyboard shortcut for the Tags… menu item. Be sure to name it Tags… with a single ellipsis (press ⌥;) not Tags... with three periods.

Share this post


Link to post

Ha! Thanks for the hint deanishe… 

 

I knew about ⌘⌥\ (CMD+OPT+BACKSLASH) but somehow didn't think of the way you proposed. Works like a charm and sure is a viable solution. Maybe someday there will be a pure Alfred workflow again, though. Thanks again :)

Share this post


Link to post

AFAIK, there isn't a particularly easy way to get a list of all your tags (though this might have changed since I last looked).

 

I usually use Alfred for tagging files (unless I want to edit multiple tags at once—then I use Finder).

 

I've set up a File Action for each of the tags I commonly use that toggles the tag on/off, which allows me to hit CMD+OPT+\ and directly type the name of the tag.

 

This works better for me than a generic tagging workflow would, as the tagging script I wrote is smarter and allows me to toggle pairs of tags.

 

For example, my "Toggle watched tag" action assigns one of watched or unwatched, rather than just adding/removing a single tag.

 

If the script would be useful to anyone, I can post it. 

Edited by deanishe
Thanks dfay

Share this post


Link to post

See also https://github.com/jdberry/tag

 

But the really great idea is setting the file action (not file filter, correct?) to toggle, not just add.

 

FWIW I use Finder for almost all my tagging -- using a keyboard shortcut as Dean suggests -- auto-completion is super fast. 

Edited by dfay

Share this post


Link to post
3 hours ago, dfay said:

But the really great idea is setting the file action (not file filter, correct?) to toggle, not just add.

 

Yup. Thanks for spotting the error!

 

The script also works as a filter, like grep.

Edited by deanishe

Share this post


Link to post

Hi deanishe, thanks for linking your script. I have to admit I'm not too familiar with this level of detail. How would I set it up within Alfred? 

 

@dfay

tag looks great - are you just referencing it for command line usage, or are you using it with Alfred?

 

Share this post


Link to post

I use it in Alfred file actions, mostly (I can't think offhand of any conventional workflows where I use it....).  

 

e.g. I have a file action "Move to Dropbox tagging current"

 

which runs the following bash script:

 

/opt/local/bin/tag -a current {query}
mv {query} '~/Dropbox/'

 

Edited by dfay

Share this post


Link to post
On 01/05/2017 at 8:06 PM, patowod said:

Hi deanishe, thanks for linking your script. I have to admit I'm not too familiar with this level of detail. How would I set it up within Alfred?

 

I have a bunch of File Actions, one per tag:

w8RsZdO.png 

 

The "normal" ones are connected to a Run Script that looks like this (this example toggles the todo tag):

export PATH=$HOME/.dotfiles/bin:$PATH

tag -t todo -v "$@"

(The PATH business is because the scripts live in ~/.dotfiles/bin.)

 

The point of my tag script is that it toggles tags itself: you don't have to figure out for yourself whether the file already has a tag.

 

The killer feature, however, is the ability to toggle a pair of tags. This is the script that the Toggle watched tag File Action is connected to:

export PATH=$HOME/.dotfiles/bin:$PATH

filetypes -t video -v "$@" | tag -p unwatched watched -v

(filetypes is another script that filters files based on their type.)

 

As is it configured, the File Filter will replace an unwatched tag with watched, or if there is no unwatched tag, the script adds it.

Edited by deanishe
Whoever wrote the IPB frontend is an idiot

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...