tag icon indicating copy to clipboard operation
tag copied to clipboard

Controlling Tag Order

Open petersparker opened this issue 5 years ago • 9 comments

First of all, this is a great utility. Thanks!

I'm trying to tag a bunch of movie files, and would like the "Year" tag to always be the first tag in the group. Other tags are actors, directors, and movie type.

Is there a way to control the order of the tag?

I've tried a few things, but it seems to always be a bit random.

Thanks!

petersparker avatar Jun 16 '20 06:06 petersparker

Adding on to this, is there a way to SORT tags on a file?

When you pull up the tag list, it is always out of order - it would be much easier to have the tags sorted.

petersparker avatar Jun 17 '20 15:06 petersparker

Is there a way to control the order of the tag?

In general, ordering of tags is not guaranteed. There is no inherent order to them. At some point somebody proposed an alteration to maintain the ordering of tags on a file, but I never felt like that was a particularly good idea.

When you pull up the tag list, it is always out of order - it would be much easier to have the tags sorted.

Now I'm confused. What operation are you doing to "pull up" the tag list. The tag utility tries to sort the tags before it displays them to you. Is it not doing that?

jdberry avatar Jun 17 '20 16:06 jdberry

Tag works and sorts fine as Tag.

The issue I’m having is displaying tags in a sorted order in the Finder.

My goal in all this was to be able to sort by name or year (using tags) in the Finder.

I turn on the "Tags” display column in the Finder, and from there, you can sort by the first tag.

I have client tax folders, and I have the clients sorted by name, and then use the tag field to sort by year.

I used "find" and “tag" in a script to tag a list of keywords to the files.

That’s when the ordering problem in the Finder became apparent.

In using the command line tag, I found that no matter what order I applied tags, they don’t go in in a deterministic order. Some go in one way, and others go in another.

That’s what lead to all this digging in deeper.

I was able to use some utility (CRS) to list the xml “Plist” of the xattr, and discovered that the order of the tags in the attached xattr xml “plist” are the order they appear in the finder.

Eventually, I was able to use PathFinder 9 to manually reorder the tags in the plist, but manually reordering over 200 tags was a real pain.

If there is a way to ensure the write order of tags to the xattr, it would allow ordering of tags as the Finder sees them.

Again, Tag is a great utility. Keep up the good work.

Hope this helps explain things.

Pete

PS - Some side comments

I also discovered a utility named "Ammonite” which allows tag selection and refinement, with the caveat that is takes a while to handle large tag groups.

Another utility that is useful is “HoudahSpot”, which allows searching for multiple fields across multiple drives, and is very fast, but doesn’t “Zoom” in.

(Apple) BUG REPORT: When using rsync to a Synology NAS, even if you use the -X flag for copying xattr’s, it still loses the tags. Finder copying to a disk does not, but then you have to copy everything all over again.  

On Jun 17, 2020, at 9:35 AM, James Berry [email protected] wrote:

Adding on to this, is there a way to SORT tags on a file?

In general, ordering of tags is not guaranteed. There is no inherent order to them.

When you pull up the tag list, it is always out of order - it would be much easier to have the tags sorted.

Now I'm confused. What operation are you doing to "pull up" the tag list. The tag utility tries to sort the tags before it displays them to you. Is it not doing that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jdberry/tag/issues/53#issuecomment-645477351, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVIO35FAMN5ABLSMRVEAD3RXDWEXANCNFSM4N7JJJ7Q.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/jdberry/tag/issues/53#issuecomment-645477351", "url": "https://github.com/jdberry/tag/issues/53#issuecomment-645477351", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

petersparker avatar Jun 23 '20 20:06 petersparker

Tag works and sorts fine as Tag. The issue I’m having is displaying tags in a sorted order in the Finder.

I am using tags since when you had to use OpenMeta. From what I know, tags are stored without any order. If you see them sorted or not, is the job of the app that displays them to you. Looks like tags does that, but the Finder does not. I am using PathFinder too, and I think its tagging functionality sucks too. You might want to have a look at Leap (https://ironicsoftware.com/leap/). It has it's problems too, but it is the best of the tag-aware Finders and does exactly what you describe.

(Apple) BUG REPORT: When using rsync to a Synology NAS, even if you use the -X flag for copying xattr’s, it still loses the tags. Finder copying to a disk does not, but then you have to copy everything all over again.

I would guess, that that's an Apple bug then. I have used rsync multiple times to move data from an old Synology box to a new one and there never were problems with tags.

I am using tags to manage a big archive of files on a Synology NAS including spotlight and it took me years to get everything to work the way I wanted. In case you need some inspiration: In addition to this project, I am using Leap, Noodlesoft Hazel, and Keyboard Maestro.

Good luck :) Julian

jhein05 avatar Jun 24 '20 17:06 jhein05

Is there a way to control the order of the tag?

In general, ordering of tags is not guaranteed. There is no inherent order to them. At some point somebody proposed an alteration to maintain the ordering of tags on a file, but I never felt like that was a particularly good idea.

I would like to ask you to reconsider. Color tags in particular, are reliably ordered and displayed when set via the Finder (last set tag color is displayed on the left, with a previously set color displayed to its right and underneath):

Finder screenshot

mdls will list the tags in the order they were set:

folders % mdls -raw -name kMDItemUserTags bluegrey
(
    Blue,
    Grey
)%
folders % mdls -raw -name kMDItemUserTags greyblue
(
    Grey,
    Blue
)%
folders %

Sadly, tag --list (as well as tag --set and tag --add) do not retain/respect tag ordering like the Finder:

folders % tag --list bluegrey
bluegray                       	Blue,Grey
folders % tag --list greyblue
grayblue                       	Blue,Grey
folders %

Because the Finder does appear to reliably support tag ordering, I've come to rely on it to visually differentiate between files using Finder windows (e.g. leftmost tag is the "primary" subject of the file's contents, middle tag the "secondary" subject, rightmost tag is a "minor" subject of the file's contents, with each color representing a specific subject).

I am currently trying to automatically copy tags from source files to identically-named files elsewhere, and tag would fit the bill perfectly, except for the fact that it does not support ordering of tags.

I realize my use-case is rather uncommon, but I figure I can't be the only one using a similar approach, either.

Thanks for your consideration :-)

ghost avatar Dec 25 '21 20:12 ghost

❤️ In general I very much support tag order preservation for all read and write commands in tag!

  • macOS UX designers & developers were aware of tag order preservation as an advantage in comparison to many other tag systems, especially those in web apps, which often don't preserve order, but simply stubbornly use alphabetical order, or worse act totally random.
  • I make heavy use of tag order in Finder and rely on it (tags for the benefit of tags, tag order for the benefit of sorting hierarchically)
  • And the tag order persisted reliably over all macOS updates and file transfers for over a decade now.

👉 And specifically for the --add command I created feature request:

  • #72

porg avatar May 24 '23 21:05 porg

Why tag order preservation matters... a lot for certain use cases!

https://github.com/jdberry/tag/assets/737143/e0eeceee-7362-4c24-91f0-f702b67400ab

Video Transcript

  • A practical example:

    • I use ~ 400 apps.
    • Maybe ~ 20 on a daily basis.
    • The others only on special occasions.
      • Easy to forget which app for what purpose.
  • Here macOS metadata feats play out their strength!

    • /Applications/ folder
    • /Applications/_Software Index/
      • Here I keep aliases to
        • /Applications/*.app
        • CLI apps (either to path or .webloc)
        • Web Apps (as .webloc)
      • Using Finder Comment for pros/cons/remarks
      • Using Finder Tags in hierarchical order
        • Sort to group by type, sub-type, sub-sub…
        • Grouping to have topical clusters
        • Then you have an "outer" and "inner" order!
        • Status on top as "third order"
          • Achieved by my 7 base colored tags denoting status
          • Being all prefixed with "•" to be first in alphabetical order
          • Chose general & widely applicable names
          • Proved themselves well over the years!

I love ordered tags! ❤️

porg avatar May 24 '23 22:05 porg

Another use case: Ordered Tags in macOS Finder for documenting file processing

Ordered Tags in macOS Finder for documenting file processing 1 explained

Ordered Tags in macOS Finder for documenting file processing 2 failure

porg avatar May 25 '23 10:05 porg

My workaround for now

  • I saved the processing info into the files with an xattr with the name srcName and the value kept or changed accordingly: xattr -w srcName <kept|changed> $file

  • If #72 gets implemented one day, I could then transforms the xattr into the appropriate tags in a loop with: --tag <NameKept|NameChanged> --at=-0 $file

porg avatar May 25 '23 16:05 porg