Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling Tag Order #53

Open
petersparker opened this issue Jun 16, 2020 · 9 comments
Open

Controlling Tag Order #53

petersparker opened this issue Jun 16, 2020 · 9 comments

Comments

@petersparker
Copy link

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
Copy link
Author

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.

@jdberry
Copy link
Owner

jdberry commented Jun 17, 2020

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?

@petersparker
Copy link
Author

petersparker commented Jun 23, 2020 via email

@jhein05
Copy link

jhein05 commented Jun 24, 2020

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

@ghost
Copy link

ghost commented Dec 25, 2021

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 :-)

@porg
Copy link

porg commented May 24, 2023

❤️ 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:

@porg
Copy link

porg commented May 24, 2023

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

Ordered-Tags-in-macOS-Finder.mp4

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
Copy link

porg commented May 25, 2023

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
Copy link

porg commented May 25, 2023

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 tag --add TAG --at=POSITION — To insert tag(s) at a desired position #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants