Add items to OS right-click context menu (Windows and Mac)



I would like to create a right-click context menu with functionalty similar to Dropbox’s, where the Dropbox option icons only appear in the context menu if the file is located in the Dropbox folder. I would like this option to appear with a custom ICON in Windows explorer / Mac finder when I right-click a file.

I found a few helpful answers expaling the steps for Specific file types, but nothing for a folder/directory, and nothing for Mac/OSX:

Add a Windows Shell context menu entry for a specific extension (not file type)

Add menu item to windows context menu only for specific filetype

I’m aware that the requirements may be language-agnostic, but its for an Electron App. I found node package for Windows (win32shellmenu), but nothing for Mac/OSX.

How can I accomplish this for Windows and Mac/OSX?

Thanks in advance.