Skip to content

Feature: Use Finder as the source of truth for tags on macOS - #248

Open
lextm wants to merge 1 commit into
MemerGamer:mainfrom
lextudio:macos/finder-favorite-tags
Open

lextm wants to merge 1 commit into
MemerGamer:mainfrom
lextudio:macos/finder-favorite-tags

Conversation

@lextm

@lextm lextm commented Dec 6, 2026

Copy link
Copy Markdown

On macOS, Finder owns tags: the sidebar, Open dialogs and other apps all show Finder's tags. This makes Files follow Finder instead of keeping its own list. Linux keeps the existing JSON-backed FileTagsSettingsService unchanged.

Changes

  • MacOSFileTagsSettingsService (registered as IFileTagsSettingsService under DESKTOP_MACOS only):
    • The tag list is Finder's favourite tags (FavoriteTagNames in com.apple.finder). A tag is identified by its name, as in Finder (uid finder:<name>).
    • Creating, renaming, reordering, importing and deleting tags rewrite Finder's favourites, through NSUserDefaults/cfprefsd. An unreadable preference is left alone.
    • Finder tags on files that are not favourites still resolve (GetTagById/GetTagsByName), so they are not dropped from files.
  • Colours come from Finder, read in the background so startup is not blocked:
    • A colour found on a tagged file wins. The file is found with Spotlight (mdfind, no shell, 5 s limit enforced by killing the process).
    • Otherwise the standard colour tag names in every language are used ("Red", "红色", …, TG_COLOR_1..7 in FinderKit's LocalizableMerged.loctable).
  • MacOSFileTagsStore: tags written onto files use the same colours. A localized standard name such as 红色 now gets its colour; before, only English names did. A colour chosen in the app replaces the colour a file carries.
  • FileTagsHelper: UntagAllFilesAsync now goes through a new ReplaceTagOnAllFilesAsync, which is also used to rename or recolour a tag on known files. Linux behaviour is unchanged.

Validation

  • dotnet build src/Files.App -f net10.0-desktop for macOS and with -p:FilesDesktopOS=Linux: both succeeded.
  • dotnet test --project tests/Files.Platform.Tests/Files.Platform.Tests.csproj --filter "FullyQualifiedName~Tags": 61 passed, 8 skipped (Linux-only xattr tests). The new MacOSFinderTagsTests cover colour parsing, colour codes, the FinderKit name table, merging favourites, chosen-colour precedence and query escaping.
  • In the running app on macOS, the sidebar Tags section showed Finder's seven favourite tags with Finder's colours.

Limitations

  • Writing Finder's favourites (create, rename, delete) was not exercised against a real account.
  • Tag search still searches the app's tag database (files the app has seen). Searching through Spotlight could be a follow-up.
  • Tags that a previous build kept in the app's JSON settings on macOS are no longer used and are not migrated.

🤖 Generated with Claude Code

On macOS the tag list is now Finder's favourite tags, and a tag is
identified by its name as Finder does. Creating, renaming, reordering and
deleting tags in the app update Finder's favourites. Colours come from
Finder: a colour found on a tagged file, else the standard colour of a
standard tag name in any language (Red, 红色, ...). They are read in the
background. Tags written onto files use the same colours. Linux keeps the
existing tag settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant