Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add badge icon overlay to Finder icons and folders?

When we open Dropbox folder, we can see icon on the left bottom of the folder.

Dropbox badges

I am developing an application in which i also want the same behavior. If folder is syncing then it will show sync icon and for other operation it will show other icon. The marked files/folder when viewed in Finder must be shown with a custom icon. But when they are selected for preview ( using spacebar) they must show their original icon ( i.e the blue icon for folder etc) .

enter image description here

like image 581
Parag Bafna Avatar asked Nov 03 '11 06:11

Parag Bafna


3 Answers

Starting with Yosemite (10.10), there is now an officially supported (and thus Mac App Store compatible) method for displaying sync status badges in Finder icons in the form of Finder Sync extensions.

like image 93
Pierre Lebeaupin Avatar answered Nov 20 '22 01:11

Pierre Lebeaupin


Dropbox has developed a NSPlugin for showing icon badges on each folder/file. As you would know, NSPlugins for Finder were deprecated by Apple starting with Snow Leopard. I think Dropbox worked around it with a hack - that reenabled plugin support. I don't think Apple would have liked that. Apple wants third party apps to only provide services support, since they don't want any third party code in Finder's process, but services are underwhelming.

like image 32
Aditya Kumar Pandey Avatar answered Nov 20 '22 02:11

Aditya Kumar Pandey


In addition to the Finder Sync Extension mentioned in other answers, badges (and other metadata) on files can additionally be accomplished via the File Provider API:

File Provider

An extension other apps use to access files and folders managed by your app and synced with a remote storage.

https://developer.apple.com/documentation/fileprovider

Specifically, the NSFileProviderItemDecorating class:

Badge
The system displays the badge image on top of the item’s icon. It only displays the first Badge image.

FolderBadge
Only available on folder items. The system embosses the image over the folder icon. It only displays the first FolderBadge image.

like image 2
pkamb Avatar answered Nov 20 '22 00:11

pkamb